mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 16:50:58 +00:00
* Source/NSXMLDocument.m: Add #ifdef HAVE_LIBXSLT to compile out
portions of the code which depend on XSLT if they are not available. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/branches/nsxml_using_libxml2@34769 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
a74ecad5db
commit
f098cf9946
2 changed files with 22 additions and 1 deletions
|
@ -1,6 +1,13 @@
|
|||
2012-02-16 17:16-EST Gregory John Casamento <greg.casamento@gmail.com>
|
||||
|
||||
* Source/NSXMLDocument.m: Add #ifdef HAVE_LIBXSLT to compile out
|
||||
portions of the code which depend on XSLT if they are not
|
||||
available.
|
||||
|
||||
2012-02-16 Doug Simons <doug.simons@testplant.com>
|
||||
|
||||
* Source/NSXMLElement.m: Implement -normalizeAdjacentTextNodesPreservingCDATA:
|
||||
* Source/NSXMLElement.m: Implement
|
||||
-normalizeAdjacentTextNodesPreservingCDATA:
|
||||
method and supporting methods.
|
||||
* Source/NSXMLNode.m: Fix a logic error.
|
||||
|
||||
|
|
|
@ -29,10 +29,12 @@
|
|||
#import "NSXMLPrivate.h"
|
||||
#import "GSInternal.h"
|
||||
|
||||
#ifdef HAVE_LIBXSLT
|
||||
#import <libxslt/xslt.h>
|
||||
#import <libxslt/xsltInternals.h>
|
||||
#import <libxslt/transform.h>
|
||||
#import <libxslt/xsltutils.h>
|
||||
#endif
|
||||
|
||||
GS_PRIVATE_INTERNAL(NSXMLDocument)
|
||||
|
||||
|
@ -403,6 +405,7 @@ extern void clearPrivatePointers(xmlNodePtr aNode);
|
|||
arguments: (NSDictionary*)arguments
|
||||
error: (NSError**)error
|
||||
{
|
||||
#ifdef HAVE_LIBXSLT
|
||||
xmlChar *data = (xmlChar *)[xslt bytes];
|
||||
xmlChar **params = NULL;
|
||||
xmlDocPtr stylesheetDoc = xmlReadDoc(data, NULL, NULL, XML_PARSE_NOERROR);
|
||||
|
@ -436,12 +439,16 @@ extern void clearPrivatePointers(xmlNodePtr aNode);
|
|||
NSZoneFree([self zone], params);
|
||||
|
||||
return [NSXMLNode _objectForNode: (xmlNodePtr)resultDoc];
|
||||
#else
|
||||
return nil;
|
||||
#endif
|
||||
}
|
||||
|
||||
- (id) objectByApplyingXSLTString: (NSString*)xslt
|
||||
arguments: (NSDictionary*)arguments
|
||||
error: (NSError**)error
|
||||
{
|
||||
#ifdef HAVE_LIBXSLT
|
||||
NSData *data = [[NSData alloc] initWithBytes: [xslt UTF8String]
|
||||
length: [xslt length]];
|
||||
NSXMLDocument *result = [self objectByApplyingXSLT: data
|
||||
|
@ -449,17 +456,24 @@ extern void clearPrivatePointers(xmlNodePtr aNode);
|
|||
error: error];
|
||||
[data release];
|
||||
return result;
|
||||
#else
|
||||
return nil;
|
||||
#endif
|
||||
}
|
||||
|
||||
- (id) objectByApplyingXSLTAtURL: (NSURL*)xsltURL
|
||||
arguments: (NSDictionary*)arguments
|
||||
error: (NSError**)error
|
||||
{
|
||||
#ifdef HAVE_LIBXSLT
|
||||
NSData *data = [NSData dataWithContentsOfURL: xsltURL];
|
||||
NSXMLDocument *result = [self objectByApplyingXSLT: data
|
||||
arguments: arguments
|
||||
error: error];
|
||||
return result;
|
||||
#else
|
||||
return nil;
|
||||
#endif
|
||||
}
|
||||
|
||||
- (BOOL) validateAndReturnError: (NSError**)error
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue