mirror of
https://github.com/gnustep/libs-base.git
synced 2025-06-02 01:21:08 +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>
|
2012-02-16 Doug Simons <doug.simons@testplant.com>
|
||||||
|
|
||||||
* Source/NSXMLElement.m: Implement -normalizeAdjacentTextNodesPreservingCDATA:
|
* Source/NSXMLElement.m: Implement
|
||||||
|
-normalizeAdjacentTextNodesPreservingCDATA:
|
||||||
method and supporting methods.
|
method and supporting methods.
|
||||||
* Source/NSXMLNode.m: Fix a logic error.
|
* Source/NSXMLNode.m: Fix a logic error.
|
||||||
|
|
||||||
|
|
|
@ -29,10 +29,12 @@
|
||||||
#import "NSXMLPrivate.h"
|
#import "NSXMLPrivate.h"
|
||||||
#import "GSInternal.h"
|
#import "GSInternal.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBXSLT
|
||||||
#import <libxslt/xslt.h>
|
#import <libxslt/xslt.h>
|
||||||
#import <libxslt/xsltInternals.h>
|
#import <libxslt/xsltInternals.h>
|
||||||
#import <libxslt/transform.h>
|
#import <libxslt/transform.h>
|
||||||
#import <libxslt/xsltutils.h>
|
#import <libxslt/xsltutils.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
GS_PRIVATE_INTERNAL(NSXMLDocument)
|
GS_PRIVATE_INTERNAL(NSXMLDocument)
|
||||||
|
|
||||||
|
@ -403,6 +405,7 @@ extern void clearPrivatePointers(xmlNodePtr aNode);
|
||||||
arguments: (NSDictionary*)arguments
|
arguments: (NSDictionary*)arguments
|
||||||
error: (NSError**)error
|
error: (NSError**)error
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_LIBXSLT
|
||||||
xmlChar *data = (xmlChar *)[xslt bytes];
|
xmlChar *data = (xmlChar *)[xslt bytes];
|
||||||
xmlChar **params = NULL;
|
xmlChar **params = NULL;
|
||||||
xmlDocPtr stylesheetDoc = xmlReadDoc(data, NULL, NULL, XML_PARSE_NOERROR);
|
xmlDocPtr stylesheetDoc = xmlReadDoc(data, NULL, NULL, XML_PARSE_NOERROR);
|
||||||
|
@ -436,12 +439,16 @@ extern void clearPrivatePointers(xmlNodePtr aNode);
|
||||||
NSZoneFree([self zone], params);
|
NSZoneFree([self zone], params);
|
||||||
|
|
||||||
return [NSXMLNode _objectForNode: (xmlNodePtr)resultDoc];
|
return [NSXMLNode _objectForNode: (xmlNodePtr)resultDoc];
|
||||||
|
#else
|
||||||
|
return nil;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) objectByApplyingXSLTString: (NSString*)xslt
|
- (id) objectByApplyingXSLTString: (NSString*)xslt
|
||||||
arguments: (NSDictionary*)arguments
|
arguments: (NSDictionary*)arguments
|
||||||
error: (NSError**)error
|
error: (NSError**)error
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_LIBXSLT
|
||||||
NSData *data = [[NSData alloc] initWithBytes: [xslt UTF8String]
|
NSData *data = [[NSData alloc] initWithBytes: [xslt UTF8String]
|
||||||
length: [xslt length]];
|
length: [xslt length]];
|
||||||
NSXMLDocument *result = [self objectByApplyingXSLT: data
|
NSXMLDocument *result = [self objectByApplyingXSLT: data
|
||||||
|
@ -449,17 +456,24 @@ extern void clearPrivatePointers(xmlNodePtr aNode);
|
||||||
error: error];
|
error: error];
|
||||||
[data release];
|
[data release];
|
||||||
return result;
|
return result;
|
||||||
|
#else
|
||||||
|
return nil;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) objectByApplyingXSLTAtURL: (NSURL*)xsltURL
|
- (id) objectByApplyingXSLTAtURL: (NSURL*)xsltURL
|
||||||
arguments: (NSDictionary*)arguments
|
arguments: (NSDictionary*)arguments
|
||||||
error: (NSError**)error
|
error: (NSError**)error
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_LIBXSLT
|
||||||
NSData *data = [NSData dataWithContentsOfURL: xsltURL];
|
NSData *data = [NSData dataWithContentsOfURL: xsltURL];
|
||||||
NSXMLDocument *result = [self objectByApplyingXSLT: data
|
NSXMLDocument *result = [self objectByApplyingXSLT: data
|
||||||
arguments: arguments
|
arguments: arguments
|
||||||
error: error];
|
error: error];
|
||||||
return result;
|
return result;
|
||||||
|
#else
|
||||||
|
return nil;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) validateAndReturnError: (NSError**)error
|
- (BOOL) validateAndReturnError: (NSError**)error
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue