mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Add skeletal NSXML work as requested.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@27824 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
2f24254d4f
commit
910deff1a6
21 changed files with 2553 additions and 4 deletions
32
ChangeLog
32
ChangeLog
|
@ -1,3 +1,35 @@
|
|||
2009-02-09 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSArray.m: Implement new methods for inserting and replacing
|
||||
objects at indexes in an NSIndexSet.
|
||||
* Headers/Foundation/NSObject.h: Minor whitespace fix
|
||||
* Source/NSNetServices.m: Mark unimplemented method.
|
||||
* Headers/Foundation/NSXMLDocument.h: new class
|
||||
* Headers/Foundation/NSXMLNode.h: new class
|
||||
* Headers/Foundation/NSXMLNodeOptions.h: new class
|
||||
* Headers/Foundation/NSXMLDTD.h: new class
|
||||
* Headers/Foundation/NSXMLDTDNode.h: new class
|
||||
* Headers/Foundation/NSXMLElement.h: new class
|
||||
* Headers/Foundation/Foundation.h: Add new class headers
|
||||
* Source/NSXMLDocument.m: skeleton of class
|
||||
* Source/NSXMLDTD.m: skeleton of class
|
||||
* Source/NSXMLNode.m: skeleton of class
|
||||
* Source/NSXMLDTDNode.m: skeleton of class
|
||||
* Source/NSXMLElement.m: skeleton of class
|
||||
* Source/NSXMLPrivate.h: Private header for all NSXMLNode based stuff.
|
||||
* Source/GNUmakefile: Add new NSXML classes
|
||||
* Source/DocMakefile: ditto
|
||||
Mostly, add the (unimplemented) XML classes introduced in the latest
|
||||
version of MacOS-X. Currently the classes are unimplemented method
|
||||
stubs, but the idea is to wrap libxml2 in a similar way to that in
|
||||
which GSXML does it.
|
||||
NB. The current ivar layout is reverse engineered from MacOS-X on the
|
||||
assumption that we will try to be extremely compatible and use the
|
||||
same (inferred) mechanism of having the libxml2 tree be the master
|
||||
data and only using the objc ivars to cache information when we
|
||||
retrieve it in the form of NSStrings etc. Maybe we will chose to
|
||||
do something different later.
|
||||
|
||||
2009-02-09 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/Additions/GSObjCRuntime.m: Correct error comparing method
|
||||
|
|
|
@ -124,6 +124,12 @@
|
|||
#import <Foundation/NSUserDefaults.h>
|
||||
#import <Foundation/NSValue.h>
|
||||
#import <Foundation/NSValueTransformer.h>
|
||||
#import <Foundation/NSXMLDocument.h>
|
||||
#import <Foundation/NSXMLDTD.h>
|
||||
#import <Foundation/NSXMLDTDNode.h>
|
||||
#import <Foundation/NSXMLElement.h>
|
||||
#import <Foundation/NSXMLNode.h>
|
||||
#import <Foundation/NSXMLNodeOptions.h>
|
||||
#import <Foundation/NSXMLParser.h>
|
||||
#import <Foundation/NSZone.h>
|
||||
|
||||
|
|
|
@ -332,7 +332,7 @@ GS_EXPORT NSRecursiveLock *gnustep_global_lock;
|
|||
* (but cannot due to compiler constraint), and wants to make sure it is not
|
||||
* called by mistake. Default implementation raises an exception at runtime.
|
||||
*/
|
||||
- notImplemented:(SEL)aSel;
|
||||
- (id) notImplemented: (SEL)aSel;
|
||||
|
||||
/**
|
||||
* Message sent when an implementation wants to explicitly require a subclass
|
||||
|
|
156
Headers/Foundation/NSXMLDTD.h
Normal file
156
Headers/Foundation/NSXMLDTD.h
Normal file
|
@ -0,0 +1,156 @@
|
|||
/* Interface for NSXMLDTD for GNUStep
|
||||
Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Richard Frith-Macdonald <rfm@gnu.org>
|
||||
Created: September 2008
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#ifndef __NSXMLDTD_h_GNUSTEP_BASE_INCLUDE
|
||||
#define __NSXMLDTD_h_GNUSTEP_BASE_INCLUDE
|
||||
#import <GNUstepBase/GSVersionMacros.h>
|
||||
|
||||
#import <Foundation/NSXMLNode.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
@class NSData, NSMutableDictionary;
|
||||
@class NSXMLDTDNode;
|
||||
|
||||
/**
|
||||
* Encapsulates document type definition data.
|
||||
*/
|
||||
@interface NSXMLDTD : NSXMLNode
|
||||
{
|
||||
@private
|
||||
NSString *_name;
|
||||
NSString *_publicID;
|
||||
NSString *_systemID;
|
||||
NSArray *_children;
|
||||
BOOL _childrenHaveMutated;
|
||||
BOOL _modified;
|
||||
uint8_t _unused[sizeof(void*)-2];
|
||||
NSMutableDictionary *_entities;
|
||||
NSMutableDictionary *_elements;
|
||||
NSMutableDictionary *_notations;
|
||||
NSMutableDictionary *_attributes;
|
||||
NSString *_original;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a child after the existing children.
|
||||
*/
|
||||
- (void) addChild: (NSXMLNode*)child;
|
||||
|
||||
/**
|
||||
* Returns the attribute declaration named.
|
||||
*/
|
||||
- (NSXMLDTDNode*) attributeDeclarationForName: (NSString*)name
|
||||
elementName: (NSString*)elementName;
|
||||
|
||||
/**
|
||||
* Returns the element declaration named.
|
||||
*/
|
||||
- (NSXMLDTDNode*) elementDeclarationForName: (NSString*)name;
|
||||
|
||||
/**
|
||||
* Returns the entity declaration named.
|
||||
*/
|
||||
- (NSXMLDTDNode*) entityDeclarationForName: (NSString*)name;
|
||||
|
||||
/** Load data from URL and initialise the receiver with the contents.
|
||||
*/
|
||||
- (id) initWithContentsOfURL: (NSURL*)url
|
||||
options: (NSUInteger)mask
|
||||
error: (NSError**)error;
|
||||
|
||||
/** <init />
|
||||
*/
|
||||
- (id) initWithData: (NSData*)data
|
||||
options: (NSUInteger)mask
|
||||
error: (NSError**)error;
|
||||
|
||||
/**
|
||||
* Inserts a child node at the specified index in the document.
|
||||
*/
|
||||
- (void) insertChild: (NSXMLNode*)child atIndex: (NSUInteger)index;
|
||||
|
||||
/**
|
||||
* Inserts a number of child nodes at the specified index.
|
||||
*/
|
||||
- (void) insertChildren: (NSArray*)children atIndex: (NSUInteger)index;
|
||||
|
||||
/**
|
||||
* Returns the notation declaration named.
|
||||
*/
|
||||
- (NSXMLDTDNode*) notationDeclarationForName: (NSString*)name;
|
||||
|
||||
/**
|
||||
* Returns the predefined entity declaration matching named.
|
||||
*/
|
||||
+ (NSXMLDTDNode*) predefinedEntityDeclarationForName: (NSString*)name;
|
||||
|
||||
/**
|
||||
* Returns the public ID set for the document.
|
||||
*/
|
||||
- (NSString*) publicID;
|
||||
|
||||
/**
|
||||
* Remove the indexed child node.
|
||||
*/
|
||||
- (void) removeChildAtIndex: (NSUInteger)index;
|
||||
|
||||
/**
|
||||
* Replaces the child at index with another child.
|
||||
*/
|
||||
- (void) replaceChildAtIndex: (NSUInteger)index withNode: (NSXMLNode*)node;
|
||||
|
||||
/**
|
||||
* Replaces all existing children with the child nodes in the array.
|
||||
*/
|
||||
- (void) setChildren: (NSArray*)children;
|
||||
|
||||
/**
|
||||
* Sets the public id of this document.<br />
|
||||
* This identifier should be in the default catalog or in a location
|
||||
* given by the XML_CATALOG_FILES environment variable.<br />
|
||||
* You should also set the systemID when you set this.
|
||||
*/
|
||||
- (void) setPublicID: (NSString*)publicID;
|
||||
|
||||
/**
|
||||
* Sets the system ID ... a URL referring to the DTD document.
|
||||
*/
|
||||
- (void) setSystemID: (NSString*)systemID;
|
||||
|
||||
/**
|
||||
* Returns the system ID
|
||||
*/
|
||||
- (NSString*) systemID;
|
||||
|
||||
@end
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*__NSXMLDTD_GNUSTEP_BASE_INCLUDE */
|
148
Headers/Foundation/NSXMLDTDNode.h
Normal file
148
Headers/Foundation/NSXMLDTDNode.h
Normal file
|
@ -0,0 +1,148 @@
|
|||
/* Interface for NSXMLDTDNode for GNUStep
|
||||
Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Richard Frith-Macdonald <rfm@gnu.org>
|
||||
Created: September 2008
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#ifndef __NSXMLDTDNode_h_GNUSTEP_BASE_INCLUDE
|
||||
#define __NSXMLDTDNode_h_GNUSTEP_BASE_INCLUDE
|
||||
#import <GNUstepBase/GSVersionMacros.h>
|
||||
|
||||
#import <Foundation/NSXMLNode.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The kind of DTD node.
|
||||
*/
|
||||
enum {
|
||||
NSXMLEntityGeneralKind = 1,
|
||||
NSXMLEntityParsedKind,
|
||||
NSXMLEntityUnparsedKind,
|
||||
NSXMLEntityParameterKind,
|
||||
NSXMLEntityPredefined,
|
||||
NSXMLAttributeCDATAKind,
|
||||
NSXMLAttributeIDKind,
|
||||
NSXMLAttributeIDRefKind,
|
||||
NSXMLAttributeIDRefsKind,
|
||||
NSXMLAttributeEntityKind,
|
||||
NSXMLAttributeEntitiesKind,
|
||||
NSXMLAttributeNMTokenKind,
|
||||
NSXMLAttributeNMTokensKind,
|
||||
NSXMLAttributeEnumerationKind,
|
||||
NSXMLAttributeNotationKind,
|
||||
NSXMLElementDeclarationUndefinedKind,
|
||||
NSXMLElementDeclarationEmptyKind,
|
||||
NSXMLElementDeclarationAnyKind,
|
||||
NSXMLElementDeclarationMixedKind,
|
||||
NSXMLElementDeclarationElementKind
|
||||
};
|
||||
typedef NSUInteger NSXMLDTDNodeKind;
|
||||
|
||||
/**
|
||||
* Represents the nodes whose types are present only in DTDs.<br />
|
||||
* Object values for the different nodes are:
|
||||
* <deflist>
|
||||
* <term>Entity declaration</term>
|
||||
* <desc>The string that that entity resolves to eg "<"</desc>
|
||||
* <term>Attribute declaration</term>
|
||||
* <desc>The default value, if any</desc>
|
||||
* <term>Element declaration</term>
|
||||
* <desc>The validation string</desc>
|
||||
* <term>Notation declaration</term>
|
||||
* <desc>nil</desc>
|
||||
* </deflist>
|
||||
*/
|
||||
@interface NSXMLDTDNode : NSXMLNode
|
||||
{
|
||||
@protected
|
||||
NSXMLDTDNodeKind _DTDKind;
|
||||
NSString *_name;
|
||||
NSString *_notationName;
|
||||
NSString *_publicID;
|
||||
NSString *_systemID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns what kind of DTD node this is.
|
||||
*/
|
||||
- (NSXMLDTDNodeKind) DTDKind;
|
||||
|
||||
/** <init />
|
||||
* Initialises the receiver based on the contents of the supplied XML.
|
||||
*/
|
||||
- (id) initWithXMLString: (NSString*)string;
|
||||
|
||||
/**
|
||||
* Returns YES if the system id is set, NO otherwise.<br />
|
||||
* Is valid only for entities and notations.
|
||||
*/
|
||||
- (BOOL) isExternal;
|
||||
|
||||
/**
|
||||
* Returns the notation name.
|
||||
*/
|
||||
- (NSString*) notationName;
|
||||
|
||||
/**
|
||||
* Returns the public id.
|
||||
*/
|
||||
- (NSString*) publicID;
|
||||
|
||||
/**
|
||||
* Sets what kind of DTD node this is.
|
||||
*/
|
||||
- (void) setDTDKind: (NSXMLDTDNodeKind)kind;
|
||||
|
||||
/**
|
||||
* Sets the notation name if the receiver is an entity.
|
||||
*/
|
||||
- (void) setNotationName: (NSString*)notationName;
|
||||
|
||||
/**
|
||||
* Sets the public id of this node.<br />
|
||||
* This identifier should be in the default catalog or in a location
|
||||
* given by the XML_CATALOG_FILES environment variable.<br />
|
||||
* When the public id is set the system id must also be set.<br />
|
||||
* This is valid only for entities and notations.
|
||||
*/
|
||||
- (void) setPublicID: (NSString*)publicID;
|
||||
|
||||
/**
|
||||
* Sets the system ID ... a URL referring to the DTD document.
|
||||
*/
|
||||
- (void) setSystemID: (NSString*)systemID;
|
||||
|
||||
/**
|
||||
* Returns the system ID.
|
||||
*/
|
||||
- (NSString*) systemID;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*__NSXMLDTDNode_h_GNUSTEP_BASE_INCLUDE */
|
273
Headers/Foundation/NSXMLDocument.h
Normal file
273
Headers/Foundation/NSXMLDocument.h
Normal file
|
@ -0,0 +1,273 @@
|
|||
/* Interface for NSXMLDocument for GNUStep
|
||||
Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Richard Frith-Macdonald <rfm@gnu.org>
|
||||
Created: September 2008
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#ifndef __NSXMLDocument_h_GNUSTEP_BASE_INCLUDE
|
||||
#define __NSXMLDocument_h_GNUSTEP_BASE_INCLUDE
|
||||
#import <GNUstepBase/GSVersionMacros.h>
|
||||
|
||||
#import <Foundation/NSXMLNode.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
@class NSData;
|
||||
@class NSXMLDTD;
|
||||
|
||||
/*
|
||||
* Input options
|
||||
* NSXMLNodeOptionsNone
|
||||
* NSXMLNodePreserveAll
|
||||
* NSXMLNodePreserveNamespaceOrder
|
||||
* NSXMLNodePreserveAttributeOrder
|
||||
* NSXMLNodePreserveEntities
|
||||
* NSXMLNodePreservePrefixes
|
||||
* NSXMLNodePreserveCDATA
|
||||
* NSXMLNodePreserveEmptyElements
|
||||
* NSXMLNodePreserveQuotes
|
||||
* NSXMLNodePreserveWhitespace
|
||||
* NSXMLDocumentTidyHTML
|
||||
* NSXMLDocumentTidyXML
|
||||
* NSXMLDocumentValidate
|
||||
*
|
||||
* Output options
|
||||
* NSXMLNodePrettyPrint
|
||||
* NSXMLDocumentIncludeContentTypeDeclaration
|
||||
*/
|
||||
|
||||
enum {
|
||||
NSXMLDocumentXMLKind = 0, /** Default type */
|
||||
NSXMLDocumentXHTMLKind, /** HTML found */
|
||||
NSXMLDocumentHTMLKind, /** Output no close tag for empty elem*/
|
||||
NSXMLDocumentTextKind /** Output string value of doc */
|
||||
};
|
||||
/**
|
||||
* Define what type of document this is.
|
||||
*/
|
||||
typedef NSUInteger NSXMLDocumentContentKind;
|
||||
|
||||
/**
|
||||
* An XMLDocument encapsulates an entire document.
|
||||
* This must contain a single element node.
|
||||
*/
|
||||
@interface NSXMLDocument : NSXMLNode
|
||||
{
|
||||
@protected
|
||||
NSString *_encoding;
|
||||
NSString *_version;
|
||||
NSXMLDTD *_docType;
|
||||
NSArray *_children;
|
||||
BOOL _childrenHaveMutated;
|
||||
BOOL _standalone;
|
||||
uint8_t _unused[sizeof(void*)-2];
|
||||
NSXMLElement *_rootElement;
|
||||
NSString *_URI;
|
||||
NSString *_MIMEType;
|
||||
NSUInteger _fidelityMask;
|
||||
NSXMLDocumentContentKind _contentKind;
|
||||
}
|
||||
|
||||
+ (Class) replacementClassForClass: (Class)cls;
|
||||
|
||||
/**
|
||||
* Returns the IANA character encoding, or nil if none is set.
|
||||
*/
|
||||
- (NSString*) characterEncoding;
|
||||
|
||||
/**
|
||||
* Returns the kind of document.
|
||||
*/
|
||||
- (NSXMLDocumentContentKind) documentContentKind;
|
||||
|
||||
/**
|
||||
* Returns the DTD set for the receiver.
|
||||
*/
|
||||
- (NSXMLDTD*) DTD;
|
||||
|
||||
/**
|
||||
* Initialise using the data downloaded from the spplied url.
|
||||
*/
|
||||
- (id) initWithContentsOfURL: (NSURL*)url
|
||||
options: (NSUInteger)mask
|
||||
error: (NSError**)error;
|
||||
|
||||
/** <init />
|
||||
* Returns a document created from data.<br />
|
||||
* Parse errors are returned in error.
|
||||
*/
|
||||
- (id) initWithData: (NSData*)data
|
||||
options: (NSUInteger)mask
|
||||
error: (NSError**)error;
|
||||
|
||||
/**
|
||||
* Returns a document with a single child, the root element.
|
||||
*/
|
||||
- (id) initWithRootElement: (NSXMLElement*)element;
|
||||
|
||||
/**
|
||||
* Initialises the receiver by creating a document from XML (or HTML
|
||||
* if the HTMLTidy option is set).
|
||||
* Parse errors are returned in the error argument.
|
||||
*/
|
||||
- (id) initWithXMLString: (NSString*)string
|
||||
options: (NSUInteger)mask
|
||||
error: (NSError**)error;
|
||||
|
||||
/**
|
||||
* Returns NO if the receiver depends upon an external DTD, otherwise
|
||||
* returns YES.
|
||||
*/
|
||||
- (BOOL) isStandalone;
|
||||
|
||||
/**
|
||||
* Returns the document MIME type..
|
||||
*/
|
||||
- (NSString*) MIMEType;
|
||||
|
||||
/**
|
||||
* Returns the root object of the receiver.
|
||||
*/
|
||||
- (NSXMLElement*) rootElement;
|
||||
|
||||
/**
|
||||
* Sets the character encoding to an IANA characterset type.
|
||||
*/
|
||||
- (void) setCharacterEncoding: (NSString*)encoding;
|
||||
|
||||
/**
|
||||
* Sets the kind of document.
|
||||
*/
|
||||
- (void) setDocumentContentKind: (NSXMLDocumentContentKind)kind;
|
||||
|
||||
/**
|
||||
* Sets the DTD of the receiver. If this is set then the DTD will be
|
||||
* output when the document is.
|
||||
*/
|
||||
- (void) setDTD: (NSXMLDTD*)documentTypeDeclaration;
|
||||
|
||||
/**
|
||||
* Sets the document MIME type (usually text/xml).
|
||||
*/
|
||||
- (void) setMIMEType: (NSString*)MIMEType;
|
||||
|
||||
/**
|
||||
* Sets the root object of the receiver, removing any children which
|
||||
* were previously set.
|
||||
*/
|
||||
- (void) setRootElement: (NSXMLNode*)root;
|
||||
|
||||
/**
|
||||
* Sets whether the receiver is a document which requires an external DTD.<br />
|
||||
* If this is set then the standalone declaration will appear if the document is
|
||||
* output.
|
||||
*/
|
||||
- (void) setStandalone: (BOOL)standalone;
|
||||
|
||||
/**
|
||||
* Sets the XML version<br />
|
||||
* Permitted values ar '1.0' or '1,1'
|
||||
*/
|
||||
- (void) setVersion: (NSString*)version;
|
||||
|
||||
/**
|
||||
* Returns the XML version or nil if none is set.
|
||||
*/
|
||||
- (NSString*) version;
|
||||
|
||||
|
||||
/**
|
||||
* Inserts child at index.
|
||||
*/
|
||||
- (void) insertChild: (NSXMLNode*)child atIndex: (NSUInteger)index;
|
||||
|
||||
/**
|
||||
* Inserts a number of children at the index.
|
||||
*/
|
||||
- (void) insertChildren: (NSArray*)children atIndex: (NSUInteger)index;
|
||||
|
||||
/**
|
||||
* Removes the child at the index.
|
||||
*/
|
||||
- (void) removeChildAtIndex: (NSUInteger)index;
|
||||
|
||||
/**
|
||||
* Replaces all existing child nodes with the ones in the array.
|
||||
*/
|
||||
- (void) setChildren: (NSArray*)children;
|
||||
|
||||
/**
|
||||
* Adds child after existing children.
|
||||
*/
|
||||
- (void) addChild: (NSXMLNode*)child;
|
||||
|
||||
/**
|
||||
* Replacs the child at the specified index.
|
||||
*/
|
||||
- (void) replaceChildAtIndex: (NSUInteger)index withNode: (NSXMLNode*)node;
|
||||
|
||||
/**
|
||||
* Outputs XML data using -XMLDataWithOptions: with NSXMLNodeOptionsNone.
|
||||
*/
|
||||
- (NSData*) XMLData;
|
||||
|
||||
/**
|
||||
* Outputs the reciever encoded using the specified options.
|
||||
*/
|
||||
- (NSData*) XMLDataWithOptions: (NSUInteger)options;
|
||||
|
||||
/**
|
||||
* Returns a new document created by applying xslt (with a set of
|
||||
* key/value pairs) to the receiver.
|
||||
*/
|
||||
- (id) objectByApplyingXSLT: (NSData*)xslt
|
||||
arguments: (NSDictionary*)arguments
|
||||
error: (NSError**)error;
|
||||
|
||||
/**
|
||||
* Returns a new document created by applying xslt (with a set of
|
||||
* key/value pairs) to the receiver.
|
||||
*/
|
||||
- (id) objectByApplyingXSLTString: (NSString*)xslt
|
||||
arguments: (NSDictionary*)arguments
|
||||
error: (NSError**)error;
|
||||
|
||||
/**
|
||||
* Downloads XSLT from xsltURL, and then returns a new document created
|
||||
* by applying it (with a set of key/value pairs) to the receiver.
|
||||
*/
|
||||
- (id) objectByApplyingXSLTAtURL: (NSURL*)xsltURL
|
||||
arguments: (NSDictionary*)argument
|
||||
error: (NSError**)error;
|
||||
|
||||
/* Validate the receiver according to its DTD.
|
||||
*/
|
||||
- (BOOL) validateAndReturnError: (NSError**)error;
|
||||
|
||||
@end
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*__NSXMLDocument_h_GNUSTEP_BASE_INCLUDE */
|
203
Headers/Foundation/NSXMLElement.h
Normal file
203
Headers/Foundation/NSXMLElement.h
Normal file
|
@ -0,0 +1,203 @@
|
|||
/* Interface for NSXMLElement for GNUStep
|
||||
Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Richard Frith-Macdonald <rfm@gnu.org>
|
||||
Created: September 2008
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#ifndef __NSXMLElement_h_GNUSTEP_BASE_INCLUDE
|
||||
#define __NSXMLElement_h_GNUSTEP_BASE_INCLUDE
|
||||
#import <GNUstepBase/GSVersionMacros.h>
|
||||
|
||||
#import <Foundation/NSXMLNode.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
@class NSDictionary, NSEnumerator, NSMutableArray;
|
||||
|
||||
/**
|
||||
* Represents an XML element.<br />
|
||||
*/
|
||||
@interface NSXMLElement : NSXMLNode
|
||||
{
|
||||
@protected
|
||||
NSString *_name;
|
||||
NSMutableArray *_attributes;
|
||||
NSMutableArray *_namespaces;
|
||||
NSArray *_children;
|
||||
BOOL _childrenHaveMutated;
|
||||
uint8_t _unused[sizeof(void*)- 1];
|
||||
NSString *_URI;
|
||||
NSInteger _prefixIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialises the receiver with the given name.
|
||||
*/
|
||||
- (id) initWithName: (NSString*)name;
|
||||
|
||||
/**
|
||||
* Initialises the receiver with the given name and namespace URI.
|
||||
*/
|
||||
- (id) initWithName: (NSString*)name URI: (NSString*)URI;
|
||||
|
||||
/**
|
||||
* Initialises the receiver as a text node with the given name and content.
|
||||
*/
|
||||
- (id) initWithName: (NSString*)name stringValue: (NSString*)string;
|
||||
|
||||
/**
|
||||
* Initialises the receiver by parsing the XML string supplied.
|
||||
*/
|
||||
- (id) initWithXMLString: (NSString*)string error: (NSError**)error;
|
||||
|
||||
/**
|
||||
* Searches for and returns all child elements which match name.
|
||||
*/
|
||||
- (NSArray*) elementsForName: (NSString*)name;
|
||||
|
||||
/**
|
||||
* Searches for and returns all child elements which match localName
|
||||
* and the specified URI.
|
||||
*/
|
||||
- (NSArray*) elementsForLocalName: (NSString*)localName URI: (NSString*)URI;
|
||||
|
||||
/**
|
||||
* Adds the supplied attribute to the receiver (ignoring if it has a duplicate
|
||||
* name).
|
||||
*/
|
||||
- (void) addAttribute: (NSXMLNode*)attribute;
|
||||
|
||||
/**
|
||||
* Removes the named attribute.
|
||||
*/
|
||||
- (void) removeAttributeForName: (NSString*)name;
|
||||
|
||||
/**
|
||||
* Sets the attributes of the receiver, ignoring all but the first of any
|
||||
* duplicates.
|
||||
*/
|
||||
- (void) setAttributes: (NSArray*)attributes;
|
||||
|
||||
/**
|
||||
* Sets attributes from the supplkied dictionary.
|
||||
*/
|
||||
- (void) setAttributesAsDictionary: (NSDictionary*)attributes;
|
||||
|
||||
/**
|
||||
* Returns the receiver's attributes.
|
||||
*/
|
||||
- (NSArray*) attributes;
|
||||
|
||||
/**
|
||||
* Returns the named attribute.
|
||||
*/
|
||||
- (NSXMLNode*) attributeForName: (NSString*)name;
|
||||
|
||||
/**
|
||||
* Returns the attribute matching localName and URI.
|
||||
*/
|
||||
- (NSXMLNode*) attributeForLocalName: (NSString*)localName
|
||||
URI: (NSString*)URI;
|
||||
|
||||
/**
|
||||
* Adds a namespace unless the name is a duplicate.
|
||||
*/
|
||||
- (void) addNamespace: (NSXMLNode*)aNamespace;
|
||||
|
||||
/**
|
||||
* Removes a named namespace.
|
||||
*/
|
||||
- (void) removeNamespaceForPrefix: (NSString*)name;
|
||||
|
||||
/**
|
||||
* Sets the namespaces for the receiver, ignoring all but the first
|
||||
* of any duplicates.
|
||||
*/
|
||||
- (void) setNamespaces: (NSArray*)namespaces;
|
||||
|
||||
/**
|
||||
* Returns the namespaces of the receiver.
|
||||
*/
|
||||
- (NSArray*) namespaces;
|
||||
|
||||
/**
|
||||
* Returns the namespace for the specified prefix in the receiver.
|
||||
*/
|
||||
- (NSXMLNode*) namespaceForPrefix: (NSString*)name;
|
||||
|
||||
/**
|
||||
* Returns the namespace found by searching the chain of namespaces.
|
||||
*/
|
||||
- (NSXMLNode*) resolveNamespaceForName: (NSString*)name;
|
||||
|
||||
/**
|
||||
* Returns the URI by searching the chain of namespaces.
|
||||
*/
|
||||
- (NSString*) resolvePrefixForNamespaceURI: (NSString*)namespaceURI;
|
||||
|
||||
/**
|
||||
* Inerts a child node.
|
||||
*/
|
||||
- (void) insertChild: (NSXMLNode*)child atIndex: (NSUInteger)index;
|
||||
|
||||
/**
|
||||
* Inserts a number of children.
|
||||
*/
|
||||
- (void) insertChildren: (NSArray*)children atIndex: (NSUInteger)index;
|
||||
|
||||
/**
|
||||
* Removes a child node.
|
||||
*/
|
||||
- (void) removeChildAtIndex: (NSUInteger)index;
|
||||
|
||||
/**
|
||||
* Replaces all existing child nodes with those from the array.
|
||||
*/
|
||||
- (void) setChildren: (NSArray*)children;
|
||||
|
||||
/**
|
||||
* Adds a child after existing children.
|
||||
*/
|
||||
- (void) addChild: (NSXMLNode*)child;
|
||||
|
||||
/**
|
||||
* Replaces the child at the specified index.
|
||||
*/
|
||||
- (void) replaceChildAtIndex: (NSUInteger)index withNode: (NSXMLNode*)node;
|
||||
|
||||
/**
|
||||
* Merges adjacent text nodes. If a node's value is the empty string,
|
||||
* and preserve is NO, it is removed.<br />
|
||||
* This should be called with a value of NO before using
|
||||
* XQuery or XPath.
|
||||
*/
|
||||
- (void) normalizeAdjacentTextNodesPreservingCDATA: (BOOL)preserve;
|
||||
|
||||
@end
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*__NSXMLElement_h_GNUSTEP_BASE_INCLUDE */
|
370
Headers/Foundation/NSXMLNode.h
Normal file
370
Headers/Foundation/NSXMLNode.h
Normal file
|
@ -0,0 +1,370 @@
|
|||
/* Interface for NSXMLNode for GNUStep
|
||||
Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Richard Frith-Macdonald <rfm@gnu.org>
|
||||
Created: September 2008
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#ifndef __NSXMLNode_h_GNUSTEP_BASE_INCLUDE
|
||||
#define __NSXMLNode_h_GNUSTEP_BASE_INCLUDE
|
||||
#import <GNUstepBase/GSVersionMacros.h>
|
||||
|
||||
#import <Foundation/NSObject.h>
|
||||
#import <Foundation/NSXMLNodeOptions.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
@class NSArray;
|
||||
@class NSDictionary;
|
||||
@class NSError;
|
||||
@class NSString;
|
||||
@class NSURL;
|
||||
@class NSXMLDocument;
|
||||
@class NSXMLElement;
|
||||
|
||||
enum {
|
||||
NSXMLInvalidKind = 0,
|
||||
NSXMLDocumentKind,
|
||||
NSXMLElementKind,
|
||||
NSXMLAttributeKind,
|
||||
NSXMLNamespaceKind,
|
||||
NSXMLProcessingInstructionKind,
|
||||
NSXMLCommentKind,
|
||||
NSXMLTextKind,
|
||||
NSXMLDTDKind,
|
||||
NSXMLEntityDeclarationKind,
|
||||
NSXMLAttributeDeclarationKind,
|
||||
NSXMLElementDeclarationKind,
|
||||
NSXMLNotationDeclarationKind
|
||||
};
|
||||
typedef NSUInteger NSXMLNodeKind;
|
||||
|
||||
// initWithKind options
|
||||
// NSXMLNodeOptionsNone
|
||||
// NSXMLNodePreserveAll
|
||||
// NSXMLNodePreserveNamespaceOrder
|
||||
// NSXMLNodePreserveAttributeOrder
|
||||
// NSXMLNodePreserveEntities
|
||||
// NSXMLNodePreservePrefixes
|
||||
// NSXMLNodeIsCDATA
|
||||
// NSXMLNodeExpandEmptyElement
|
||||
// NSXMLNodeCompactEmptyElement
|
||||
// NSXMLNodeUseSingleQuotes
|
||||
// NSXMLNodeUseDoubleQuotes
|
||||
|
||||
// Output options
|
||||
// NSXMLNodePrettyPrint
|
||||
|
||||
/**
|
||||
* The most primitive unit in an XML document.
|
||||
*/
|
||||
@interface NSXMLNode : NSObject <NSCopying>
|
||||
{
|
||||
@protected
|
||||
void *_handle;
|
||||
NSXMLNodeKind _kind;
|
||||
NSXMLNode *_parent;
|
||||
NSUInteger _index;
|
||||
id _objectValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and returns an attribute node with the specified name and value.
|
||||
*/
|
||||
+ (id) attributeWithName: (NSString*)name stringValue: (NSString*)stringValue;
|
||||
|
||||
/**
|
||||
* Creates and returns an attribute node with the specified
|
||||
* (fully qualified) name, namespace URI, and value.
|
||||
*/
|
||||
+ (id) attributeWithName: (NSString*)name
|
||||
URI: (NSString*)URI
|
||||
stringValue: (NSString*)stringValue;
|
||||
|
||||
/**
|
||||
* Creates and returns a comment node with the supplied text.
|
||||
*/
|
||||
+ (id) commentWithStringValue: (NSString*)stringValue;
|
||||
|
||||
/** Creates and returns an empty document ... convenience method.
|
||||
*/
|
||||
+ (id) document;
|
||||
|
||||
/**
|
||||
* Creates and returns a new document intialised with the supplied root
|
||||
* node.
|
||||
*/
|
||||
+ (id) documentWithRootElement: (NSXMLElement*)element;
|
||||
|
||||
/**
|
||||
* Creates and returns a DTD node from the supplied string.
|
||||
* The node might describe element, attribute, entity, or notation.
|
||||
*/
|
||||
+ (id) DTDNodeWithXMLString: (NSString*)string;
|
||||
|
||||
/**
|
||||
* Creates and returns a node node with the specified name.
|
||||
*/
|
||||
+ (id) elementWithName: (NSString*)name;
|
||||
|
||||
/**
|
||||
* Creates and returns a node containing the supplied child nodes and with
|
||||
* the attribute nodes from the supplied array.
|
||||
*/
|
||||
+ (id) elementWithName: (NSString*)name
|
||||
children: (NSArray*)children
|
||||
attributes: (NSArray*)attributes;
|
||||
|
||||
/**
|
||||
* Creates and returns a node with the supplied (fully qualified name)
|
||||
* an namespace URI.
|
||||
*/
|
||||
+ (id) elementWithName: (NSString*)name URI: (NSString*)URI;
|
||||
|
||||
/**
|
||||
* Creates and returns a node with the pecified name and with a single
|
||||
* text node (containing string) as its content.
|
||||
*/
|
||||
+ (id) elementWithName: (NSString*)name stringValue: (NSString*)string;
|
||||
|
||||
/** Strips any leading namespace prefix from name and returns the result.
|
||||
*/
|
||||
+ (NSString*) localNameForName: (NSString*)name;
|
||||
|
||||
/**
|
||||
* Creates and returns a node mapping the supplkied namespace name to
|
||||
* the string value (URI).
|
||||
*/
|
||||
+ (id) namespaceWithName: (NSString*)name stringValue: (NSString*)stringValue;
|
||||
|
||||
/** Returns the namespace node corresponding to a predefined namespace names
|
||||
* (one of xml, xs, or xsi)
|
||||
*/
|
||||
+ (NSXMLNode*) predefinedNamespaceForPrefix: (NSString*)name;
|
||||
|
||||
/** Returns the namespace prefix of name.
|
||||
*/
|
||||
+ (NSString*) prefixForName: (NSString*)name;
|
||||
|
||||
/**
|
||||
* Creates and return a processinc insruction node with th specified name
|
||||
* and textual value.
|
||||
*/
|
||||
+ (id) processingInstructionWithName: (NSString*)name
|
||||
stringValue: (NSString*)stringValue;
|
||||
|
||||
/**
|
||||
* Creates and returns a simple text node.
|
||||
*/
|
||||
+ (id) textWithStringValue: (NSString*)stringValue;
|
||||
|
||||
|
||||
/** Returns the canonical form (see http://www.w3.org/TR/xml-c14n) of the
|
||||
* receiveri as long as the NSXMLNodePreserveWhitespace has been set.
|
||||
* If the option as not been set, return the same without white space
|
||||
* preserved.
|
||||
*/
|
||||
- (NSString*) canonicalXMLStringPreservingComments: (BOOL)comments;
|
||||
|
||||
/** Returns the child node if the receiver at the specified index.
|
||||
*/
|
||||
- (NSXMLNode*) childAtIndex: (NSUInteger)index;
|
||||
|
||||
/** Returns the number of immediate child nodes of the receiver.<br />
|
||||
* This method is more efficient than getting the array of children
|
||||
* and counting it.
|
||||
*/
|
||||
- (NSUInteger) childCount;
|
||||
|
||||
/** Returns n array containing the immediate child nodes of the receiver.
|
||||
*/
|
||||
- (NSArray*) children;
|
||||
|
||||
/** Detaches the receiver from its parent node.
|
||||
*/
|
||||
- (void) detach;
|
||||
|
||||
/** Return the index of the receiver within its parent node.
|
||||
*/
|
||||
- (NSUInteger) index;
|
||||
|
||||
/** Initialises the receiver as a specific kind of node.<br />
|
||||
* Calls -initWithKind:options: using NSXMLNodeOptionsNone and
|
||||
* returns the result.
|
||||
*/
|
||||
- (id) initWithKind: (NSXMLNodeKind)kind;
|
||||
|
||||
/** <init />
|
||||
* Initialises the receiver as the specified kind of node and with the
|
||||
* specified options.
|
||||
*/
|
||||
- (id) initWithKind: (NSXMLNodeKind)kind options: (NSUInteger)options;
|
||||
|
||||
/** Return the level of the receiver within the tree of nodes.<br />
|
||||
* A document or a node which is not inside another is at level 0.
|
||||
*/
|
||||
- (NSUInteger) level;
|
||||
|
||||
/** Returns the name of the receiver without any namespace prefix.
|
||||
*/
|
||||
- (NSString*) localName;
|
||||
|
||||
/**
|
||||
* Returns the kind of node represented by the receiver.
|
||||
*/
|
||||
- (NSXMLNodeKind) kind;
|
||||
|
||||
/** Returns the name of the receiver.
|
||||
*/
|
||||
- (NSString*) name;
|
||||
|
||||
/** Returns the next node in the tree.
|
||||
*/
|
||||
- (NSXMLNode*) nextNode;
|
||||
|
||||
/** Returns the next sibling of the receiver
|
||||
*/
|
||||
- (NSXMLNode*) nextSibling;
|
||||
|
||||
/** Returns the nodes resulting from applying xpath to the receiver.<br />
|
||||
* Before using xpath on a tree, you must call the
|
||||
* -normalizeAdjacentTextNodesPreservingCDATA: with NO as the argument,
|
||||
* in order to avoid problems where the xpath syntax cannot cope with
|
||||
* multiple text nodes.
|
||||
*/
|
||||
- (NSArray*) nodesForXPath: (NSString*)xpath error: (NSError**)error;
|
||||
|
||||
/** Returns the data resulting from calling the query on the receiver.<br />
|
||||
* The same as objectsForXQuery:constants:error: without the constants.
|
||||
*/
|
||||
- (NSArray*) objectsForXQuery: (NSString*)xquery error: (NSError**)error;
|
||||
|
||||
/** Returns the data resulting from calling the query on the receiver.<br />
|
||||
* Before using xpath on a tree, you must call the
|
||||
* -normalizeAdjacentTextNodesPreservingCDATA: with NO as the argument,
|
||||
* in order to avoid problems where the xpath syntax cannot cope with
|
||||
* multiple text nodes.<br />
|
||||
* The value of constants is a dictionary of constants declared
|
||||
* to be "external" in the query.<br />
|
||||
* The resulting array amy contain array, data, date, number, string,
|
||||
* and URL objects as well as nodes.
|
||||
*/
|
||||
- (NSArray*) objectsForXQuery: (NSString*)xquery
|
||||
constants: (NSDictionary*)constants
|
||||
error: (NSError**)error;
|
||||
|
||||
/**
|
||||
* Returns the object value of the receiver (as set using -setObjectValue:)
|
||||
* or nil if there is none.
|
||||
*/
|
||||
- (id) objectValue;
|
||||
|
||||
/**
|
||||
* Returns the parent node of the receiver or nil if the receiver is not
|
||||
* within another node.
|
||||
*/
|
||||
- (NSXMLNode*) parent;
|
||||
|
||||
/** Returns the namepsace prefix for the receiver or nil if there is no
|
||||
* namespace prefix.
|
||||
*/
|
||||
- (NSString*) prefix;
|
||||
|
||||
/** Returns the previous node in the tree ... stepping through the tree
|
||||
* backwards.
|
||||
*/
|
||||
- (NSXMLNode*) previousNode;
|
||||
|
||||
/* Returns the previous sibling of the receiver.
|
||||
*/
|
||||
- (NSXMLNode*) previousSibling;
|
||||
|
||||
/** Returns the document containing the receiver, or nil if the receiver
|
||||
* does not lie within a document.
|
||||
*/
|
||||
- (NSXMLDocument*) rootDocument;
|
||||
|
||||
/** Sets the name of the receiver.
|
||||
*/
|
||||
- (void) setName: (NSString*)name;
|
||||
|
||||
/** Sets the content of the receiver, removing any existing children
|
||||
* (including comments and processing instructions).<br />
|
||||
* For an element node, this sets text contetn within the node.
|
||||
*/
|
||||
- (void) setObjectValue: (id)value;
|
||||
|
||||
/**
|
||||
* Sets the content of the receiver to be the supplied string value ...
|
||||
* which involves removing existing content, comments,
|
||||
* and processing instructions.<br />
|
||||
* If the receiver is an element node, this creates a text node containing
|
||||
* the string value as the sole child of the receiver.
|
||||
*/
|
||||
- (void) setStringValue: (NSString*)string;
|
||||
|
||||
/**
|
||||
* Sets the string content of the receiver.<br />
|
||||
* if the resolve flag is YES then any entities which can be resolved are
|
||||
* replaced by the resolved versions.
|
||||
*/
|
||||
- (void) setStringValue: (NSString*)string resolvingEntities: (BOOL)resolve;
|
||||
|
||||
/** Sets the URI of the receiver.
|
||||
*/
|
||||
- (void) setURI: (NSString*)URI;
|
||||
|
||||
/** Returns the string value of the receiver. For kinds of node which have
|
||||
* direct string content, this simply returns that content. For elements
|
||||
* this recursively traverses the children of the receiver appending the
|
||||
* text of each child to a single string result.
|
||||
*/
|
||||
- (NSString*) stringValue;
|
||||
|
||||
/** Returns the URI of the receiver.
|
||||
*/
|
||||
- (NSString*) URI;
|
||||
|
||||
/** Returns the XPath string to access the receiver with the document.
|
||||
*/
|
||||
- (NSString*) XPath;
|
||||
|
||||
/**
|
||||
* Returns the text of the receiver as XML (ie in the form it would have
|
||||
* in an XML document).
|
||||
*/
|
||||
- (NSString*) XMLString;
|
||||
|
||||
/**
|
||||
* Returns the text of the receiver as XML (ie in the form it would have
|
||||
* in an XML document), with the specified options controlling it.
|
||||
*/
|
||||
- (NSString*) XMLStringWithOptions: (NSUInteger)options;
|
||||
|
||||
@end
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*__NSXMLNode_h_GNUSTEP_BASE_INCLUDE */
|
134
Headers/Foundation/NSXMLNodeOptions.h
Normal file
134
Headers/Foundation/NSXMLNodeOptions.h
Normal file
|
@ -0,0 +1,134 @@
|
|||
/* Interface for NSXMLNodeOptions for GNUStep
|
||||
Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Richard Frith-Macdonald <rfm@gnu.org>
|
||||
Created: September 2008
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#ifndef __NSXMLNodeOptions_h_GNUSTEP_BASE_INCLUDE
|
||||
#define __NSXMLNodeOptions_h_GNUSTEP_BASE_INCLUDE
|
||||
#import <GNUstepBase/GSVersionMacros.h>
|
||||
|
||||
#import <Foundation/NSObjCRuntime.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** This enumeration is a bitmask specifying input and output options
|
||||
* for nnode.
|
||||
* <deflist>
|
||||
* <term>NSXMLNodeIsCDATA</term>
|
||||
* <desc>Indicates that a text node is CDATA</desc>
|
||||
* <term>NSXMLNodeExpandEmptyElement</term>
|
||||
* <desc>The element should be expanded when empty,
|
||||
* eg <elementname></elementname>.
|
||||
* For some reason MacOS-X specifies this as the default setting.</desc>
|
||||
* <term>NSXMLNodeCompactEmptyElement</term>
|
||||
* <desc>This element should be compact when empty,
|
||||
* eg <elementname/></desc>
|
||||
* <term>NSXMLNodeUseSingleQuotes</term>
|
||||
* <desc>Use single quotes on this attribute or namespace</desc>
|
||||
* <term>NSXMLNodeUseDoubleQuotes</term>
|
||||
* <desc>Use double quotes on this attribute or namespace.
|
||||
* MacOS-X specifies this as the default setting.</desc>
|
||||
* <term>NSXMLNodeOptionsNone</term>
|
||||
* <desc>Use the default options for this node</desc>
|
||||
* <term>NSXMLNodePreserveAll</term>
|
||||
* <desc>Turn all preservation options on</desc>
|
||||
* <term>NSXMLNodePreserveNamespaceOrder</term>
|
||||
* <desc>Preserve the order of namespaces</desc>
|
||||
* <term>NSXMLNodePreserveAttributeOrder</term>
|
||||
* <desc>Preserve the order of attributes</desc>
|
||||
* <term>NSXMLNodePreserveEntities</term>
|
||||
* <desc>Entities should not be resolved on output</desc>
|
||||
* <term>NSXMLNodePreservePrefixes</term>
|
||||
* <desc>Prefixes should not be chosen based on closest URI definition</desc>
|
||||
* <term>NSXMLNodePreserveCDATA</term>
|
||||
* <desc>CDATA should be preserved</desc>
|
||||
* <term>NSXMLNodePreserveEmptyElements</term>
|
||||
* <desc>Remember whether an empty element was expanded or compact</desc>
|
||||
* <term>NSXMLNodePreserveQuotes</term>
|
||||
* <desc>Remember whether an attribute used single or double quotes</desc>
|
||||
* <term>NSXMLNodePreserveWhitespace</term>
|
||||
* <desc>Preserve non-content whitespace</desc>
|
||||
* <term>NSXMLNodePreserveDTD</term>
|
||||
* <desc>Preserve the DTD until it is modified</desc>
|
||||
* <term>NSXMLDocumentTidyHTML</term>
|
||||
* <desc>Try to change HTML into valid XHTML</desc>
|
||||
* <term>NSXMLDocumentTidyXML</term>
|
||||
* <desc>Try to change malformed XML into valid XML</desc>
|
||||
* <term>NSXMLDocumentValidate</term>
|
||||
* <desc>Validate this document against its DTD</desc>
|
||||
* <term>NSXMLNodePrettyPrint</term>
|
||||
* <desc>Output this node in a readable format</desc>
|
||||
* <term>NSXMLDocumentIncludeContentTypeDeclaration</term>
|
||||
* <desc>Include a content type declaration for HTML or XHTML</desc>
|
||||
*/
|
||||
|
||||
enum {
|
||||
NSXMLNodeOptionsNone = 0,
|
||||
|
||||
NSXMLNodeIsCDATA = 1 << 0,
|
||||
NSXMLNodeExpandEmptyElement = 1 << 1,
|
||||
NSXMLNodeCompactEmptyElement = 1 << 2,
|
||||
NSXMLNodeUseSingleQuotes = 1 << 3,
|
||||
NSXMLNodeUseDoubleQuotes = 1 << 4,
|
||||
|
||||
NSXMLDocumentTidyHTML = 1 << 9,
|
||||
NSXMLDocumentTidyXML = 1 << 10,
|
||||
|
||||
NSXMLDocumentValidate = 1 << 13,
|
||||
|
||||
NSXMLDocumentXInclude = 1 << 16,
|
||||
|
||||
NSXMLNodePrettyPrint = 1 << 17,
|
||||
NSXMLDocumentIncludeContentTypeDeclaration = 1 << 18,
|
||||
|
||||
NSXMLNodePreserveNamespaceOrder = 1 << 20,
|
||||
NSXMLNodePreserveAttributeOrder = 1 << 21,
|
||||
NSXMLNodePreserveEntities = 1 << 22,
|
||||
NSXMLNodePreservePrefixes = 1 << 23,
|
||||
NSXMLNodePreserveCDATA = 1 << 24,
|
||||
NSXMLNodePreserveWhitespace = 1 << 25,
|
||||
NSXMLNodePreserveDTD = 1 << 26,
|
||||
NSXMLNodePreserveCharacterReferences = 1 << 27,
|
||||
NSXMLNodePreserveEmptyElements = (NSXMLNodeCompactEmptyElement
|
||||
| NSXMLNodeExpandEmptyElement),
|
||||
NSXMLNodePreserveQuotes = (NSXMLNodeUseDoubleQuotes
|
||||
| NSXMLNodeUseSingleQuotes),
|
||||
NSXMLNodePreserveAll = ( NSXMLNodePreserveAttributeOrder
|
||||
| NSXMLNodePreserveCDATA
|
||||
| NSXMLNodePreserveCharacterReferences
|
||||
| NSXMLNodePreserveDTD
|
||||
| NSXMLNodePreserveEmptyElements
|
||||
| NSXMLNodePreserveEntities
|
||||
| NSXMLNodePreserveNamespaceOrder
|
||||
| NSXMLNodePreservePrefixes
|
||||
| NSXMLNodePreserveQuotes
|
||||
| NSXMLNodePreserveWhitespace
|
||||
| 0xFFF00000) // high 12 bits
|
||||
};
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*__NSXMLNodeOptions_h_GNUSTEP_BASE_INCLUDE */
|
|
@ -237,7 +237,7 @@ GSAtomicMallocZone (void);
|
|||
* NB. making a pointer weak does not mean that it is automatically
|
||||
* zeroed when the object it points to is garbage collected. To get that
|
||||
* behavior you must asign values to the pointer using the
|
||||
* GSAssignZeroingWeakPointer() function.<rb />
|
||||
* GSAssignZeroingWeakPointer() function.<br />
|
||||
* This function has no effect if the system is
|
||||
* not built for garbage collection.
|
||||
*/
|
||||
|
|
|
@ -122,6 +122,12 @@ NSURLResponse.h \
|
|||
NSUserDefaults.h \
|
||||
NSValue.h \
|
||||
NSValueTransformer.h \
|
||||
NSXMLDocument.h \
|
||||
NSXMLDTD.h \
|
||||
NSXMLDTDNode.h \
|
||||
NSXMLElement.h \
|
||||
NSXMLNode.h \
|
||||
NSXMLNodeOptions.h \
|
||||
NSXMLParser.h \
|
||||
NSZone.h
|
||||
|
||||
|
|
|
@ -265,6 +265,11 @@ NSURLHandle.m \
|
|||
NSUserDefaults.m \
|
||||
NSValue.m \
|
||||
NSValueTransformer.m \
|
||||
NSXMLDocument.m \
|
||||
NSXMLDTD.m \
|
||||
NSXMLDTDNode.m \
|
||||
NSXMLElement.m \
|
||||
NSXMLNode.m \
|
||||
NSXMLParser.m \
|
||||
NSZone.m \
|
||||
externs.m \
|
||||
|
@ -404,6 +409,12 @@ NSUserDefaults.h \
|
|||
NSUtilities.h \
|
||||
NSValue.h \
|
||||
NSValueTransformer.h \
|
||||
NSXMLDocument.h \
|
||||
NSXMLDTD.h \
|
||||
NSXMLDTDNode.h \
|
||||
NSXMLElement.h \
|
||||
NSXMLNode.h \
|
||||
NSXMLNodeOptions.h \
|
||||
NSXMLParser.h \
|
||||
NSZone.h
|
||||
|
||||
|
|
|
@ -1673,11 +1673,22 @@ compare(id elem1, id elem2, void* context)
|
|||
[self subclassResponsibility: _cmd];
|
||||
}
|
||||
|
||||
/** Not implemented
|
||||
/** Replaces the values in the receiver at the locations given by the
|
||||
* indexes set with values from the objects array.
|
||||
*/
|
||||
- (void) replaceObjectsAtIndexes: (NSIndexSet *)indexes
|
||||
withObjects: (NSArray *)objects
|
||||
{
|
||||
NSUInteger index = [indexes firstIndex];
|
||||
NSEnumerator *enumerator = [objects objectEnumerator];
|
||||
id object = [enumerator nextObject];
|
||||
|
||||
while (object != nil && index != NSNotFound)
|
||||
{
|
||||
[self replaceObjectAtIndex: index withObject: object];
|
||||
object = [enumerator nextObject];
|
||||
index = [indexes indexGreaterThanIndex: index];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1721,10 +1732,23 @@ compare(id elem1, id elem2, void* context)
|
|||
[self subclassResponsibility: _cmd];
|
||||
}
|
||||
|
||||
/** Not implemented
|
||||
/** Inserts the values from the objects array into the receiver at the
|
||||
* locations given by the indexes set.<br />
|
||||
* The values are inserted in the same order that they appear in the
|
||||
* array.
|
||||
*/
|
||||
- (void) insertObjects: (NSArray *)objects atIndexes: (NSIndexSet *)indexes
|
||||
{
|
||||
NSUInteger index = [indexes firstIndex];
|
||||
NSEnumerator *enumerator = [objects objectEnumerator];
|
||||
id object = [enumerator nextObject];
|
||||
|
||||
while (object != nil && index != NSNotFound)
|
||||
{
|
||||
[self insertObject: object atIndex: index];
|
||||
object = [enumerator nextObject];
|
||||
index = [indexes indexGreaterThanIndex: index];
|
||||
}
|
||||
}
|
||||
|
||||
/** <override-subclass />
|
||||
|
|
|
@ -2341,6 +2341,7 @@ static void DNSSD_API
|
|||
|
||||
- (void) publishWithOptions: (NSNetServiceOptions)options
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -159,11 +159,13 @@ static NSURLCache *shared = nil;
|
|||
|
||||
- (void) setDiskCapacity: (unsigned)diskCapacity
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
// FIXME
|
||||
}
|
||||
|
||||
- (void) setMemoryCapacity: (unsigned)memoryCapacity
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
// FIXME
|
||||
}
|
||||
|
||||
|
|
168
Source/NSXMLDTD.m
Normal file
168
Source/NSXMLDTD.m
Normal file
|
@ -0,0 +1,168 @@
|
|||
/* Inmplementation for NSXMLDTD for GNUStep
|
||||
Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Richard Frith-Macdonald <rfm@gnu.org>
|
||||
Created: September 2008
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#include "NSXMLPrivate.h"
|
||||
|
||||
@implementation NSXMLDTD
|
||||
|
||||
+ (NSXMLDTDNode*) predefinedEntityDeclarationForName: (NSString*)name
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[_name release];
|
||||
[_publicID release];
|
||||
[_systemID release];
|
||||
[_children release];
|
||||
[_entities release];
|
||||
[_elements release];
|
||||
[_notations release];
|
||||
[_attributes release];
|
||||
[_original release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void) addChild: (NSXMLNode*)child
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
- (NSXMLDTDNode*) attributeDeclarationForName: (NSString*)name
|
||||
elementName: (NSString*)elementName
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSXMLDTDNode*) elementDeclarationForName: (NSString*)name
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSXMLDTDNode*) entityDeclarationForName: (NSString*)name
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (id) initWithContentsOfURL: (NSURL*)url
|
||||
options: (NSUInteger)mask
|
||||
error: (NSError**)error
|
||||
{
|
||||
NSData *data;
|
||||
NSXMLDTD *doc;
|
||||
|
||||
data = [NSData dataWithContentsOfURL: url];
|
||||
doc = [self initWithData: data options: 0 error: 0];
|
||||
[doc setURI: [url absoluteString]];
|
||||
return doc;
|
||||
}
|
||||
|
||||
- (id) initWithData: (NSData*)data
|
||||
options: (NSUInteger)mask
|
||||
error: (NSError**)error
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void) insertChild: (NSXMLNode*)child atIndex: (NSUInteger)index
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
_childrenHaveMutated = YES;
|
||||
}
|
||||
|
||||
- (void) insertChildren: (NSArray*)children atIndex: (NSUInteger)index
|
||||
{
|
||||
NSEnumerator *enumerator = [children objectEnumerator];
|
||||
NSXMLNode *child;
|
||||
|
||||
while ((child = [enumerator nextObject]) != nil)
|
||||
{
|
||||
[self insertChild: child atIndex: index++];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSXMLDTDNode*) notationDeclarationForName: (NSString*)name
|
||||
{
|
||||
NSXMLDTDNode *notation = [_notations objectForKey: name];
|
||||
|
||||
if (notation == nil)
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
return notation;
|
||||
}
|
||||
|
||||
- (NSString*) publicID
|
||||
{
|
||||
if (_publicID == nil)
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
return _publicID;
|
||||
}
|
||||
|
||||
- (void) removeChildAtIndex: (NSUInteger)index
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
- (void) replaceChildAtIndex: (NSUInteger)index withNode: (NSXMLNode*)node
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
- (void) setChildren: (NSArray*)children
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
- (void) setPublicID: (NSString*)publicID
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
_modified = YES;
|
||||
}
|
||||
|
||||
- (void) setSystemID: (NSString*)systemID
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
_modified = YES;
|
||||
}
|
||||
|
||||
- (NSString*) systemID
|
||||
{
|
||||
if (_systemID == nil)
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
return _systemID;
|
||||
}
|
||||
|
||||
@end
|
||||
|
111
Source/NSXMLDTDNode.m
Normal file
111
Source/NSXMLDTDNode.m
Normal file
|
@ -0,0 +1,111 @@
|
|||
/* Implementation for NSXMLDTDNode for GNUStep
|
||||
Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Richard Frith-Macdonald <rfm@gnu.org>
|
||||
Created: September 2008
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#import "NSXMLPrivate.h"
|
||||
|
||||
@implementation NSXMLDTDNode
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[_name release];
|
||||
[_notationName release];
|
||||
[_publicID release];
|
||||
[_systemID release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (NSXMLDTDNodeKind) DTDKind
|
||||
{
|
||||
return _DTDKind;
|
||||
}
|
||||
|
||||
- (id) initWithXMLString: (NSString*)string
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (BOOL) isExternal
|
||||
{
|
||||
if (_systemID != nil)
|
||||
{
|
||||
// FIXME ... libxml integration?
|
||||
return YES;
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (NSString*) notationName
|
||||
{
|
||||
if (_notationName == nil)
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
return _notationName;
|
||||
}
|
||||
|
||||
- (NSString*) publicID
|
||||
{
|
||||
if (_publicID == nil)
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
return _publicID;
|
||||
}
|
||||
|
||||
- (void) setDTDKind: (NSXMLDTDNodeKind)kind
|
||||
{
|
||||
_DTDKind = kind;
|
||||
// FIXME ... libxml integration?
|
||||
}
|
||||
|
||||
- (void) setNotationName: (NSString*)notationName
|
||||
{
|
||||
ASSIGNCOPY(_notationName, notationName);
|
||||
// FIXME ... libxml integration?
|
||||
}
|
||||
|
||||
- (void) setPublicID: (NSString*)publicID
|
||||
{
|
||||
ASSIGNCOPY(_publicID, publicID);
|
||||
// FIXME ... libxml integration?
|
||||
}
|
||||
|
||||
- (void) setSystemID: (NSString*)systemID
|
||||
{
|
||||
ASSIGNCOPY(_systemID, systemID);
|
||||
// FIXME ... libxml integration?
|
||||
}
|
||||
|
||||
- (NSString*) systemID
|
||||
{
|
||||
if (_systemID == nil)
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
return _systemID;
|
||||
}
|
||||
|
||||
@end
|
||||
|
248
Source/NSXMLDocument.m
Normal file
248
Source/NSXMLDocument.m
Normal file
|
@ -0,0 +1,248 @@
|
|||
/* Implementation for NSXMLDocument for GNUStep
|
||||
Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Richard Frith-Macdonald <rfm@gnu.org>
|
||||
Created: September 2008
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#include "NSXMLPrivate.h"
|
||||
|
||||
@implementation NSXMLDocument
|
||||
|
||||
+ (Class) replacementClassForClass: (Class)cls
|
||||
{
|
||||
return Nil;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[_encoding release];
|
||||
[_version release];
|
||||
[_docType release];
|
||||
[_children release];
|
||||
[_URI release];
|
||||
[_MIMEType release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (NSString*) characterEncoding
|
||||
{
|
||||
return _encoding;
|
||||
}
|
||||
|
||||
- (NSXMLDocumentContentKind) documentContentKind
|
||||
{
|
||||
return _contentKind;
|
||||
}
|
||||
|
||||
- (NSXMLDTD*) DTD
|
||||
{
|
||||
return _docType;
|
||||
}
|
||||
|
||||
- (id) initWithContentsOfURL: (NSURL*)url
|
||||
options: (NSUInteger)mask
|
||||
error: (NSError**)error
|
||||
{
|
||||
NSData *data;
|
||||
NSXMLDocument *doc;
|
||||
|
||||
data = [NSData dataWithContentsOfURL: url];
|
||||
doc = [self initWithData: data options: 0 error: 0];
|
||||
[doc setURI: [url absoluteString]];
|
||||
return doc;
|
||||
}
|
||||
|
||||
|
||||
- (id) initWithData: (NSData*)data
|
||||
options: (NSUInteger)mask
|
||||
error: (NSError**)error
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
_children = [NSMutableArray new];
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (id) initWithRootElement: (NSXMLElement*)element
|
||||
{
|
||||
self = [self initWithData: nil options: 0 error: 0];
|
||||
[self setRootElement: (NSXMLNode*)element];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id) initWithXMLString: (NSString*)string
|
||||
options: (NSUInteger)mask
|
||||
error: (NSError**)error
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (BOOL) isStandalone
|
||||
{
|
||||
return _standalone;
|
||||
}
|
||||
|
||||
- (NSString*) MIMEType
|
||||
{
|
||||
return _MIMEType;
|
||||
}
|
||||
|
||||
- (NSXMLElement*) rootElement
|
||||
{
|
||||
return _rootElement;
|
||||
}
|
||||
|
||||
- (void) setCharacterEncoding: (NSString*)encoding
|
||||
{
|
||||
ASSIGNCOPY(_encoding, encoding);
|
||||
}
|
||||
|
||||
- (void) setDocumentContentKind: (NSXMLDocumentContentKind)kind
|
||||
{
|
||||
_contentKind = kind;
|
||||
}
|
||||
|
||||
- (void) setDTD: (NSXMLDTD*)documentTypeDeclaration
|
||||
{
|
||||
ASSIGNCOPY(_docType, documentTypeDeclaration);
|
||||
}
|
||||
|
||||
- (void) setMIMEType: (NSString*)MIMEType
|
||||
{
|
||||
ASSIGNCOPY(_MIMEType, MIMEType);
|
||||
}
|
||||
|
||||
- (void) setRootElement: (NSXMLNode*)root
|
||||
{
|
||||
NSAssert(_rootElement == nil, NSGenericException);
|
||||
[self insertChild: root atIndex: [_children count]];
|
||||
_rootElement = (NSXMLElement*)root;
|
||||
}
|
||||
|
||||
- (void) setStandalone: (BOOL)standalone
|
||||
{
|
||||
_standalone = standalone;
|
||||
}
|
||||
|
||||
- (void) setVersion: (NSString*)version
|
||||
{
|
||||
if ([version isEqualToString: @"1.0"] || [version isEqualToString: @"1.1"])
|
||||
{
|
||||
ASSIGNCOPY(_version, version);
|
||||
}
|
||||
else
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"Bad XML version (%@)", version];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSString*) version
|
||||
{
|
||||
return _version;
|
||||
}
|
||||
|
||||
- (void) insertChild: (NSXMLNode*)child atIndex: (NSUInteger)index
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
- (void) insertChildren: (NSArray*)children atIndex: (NSUInteger)index
|
||||
{
|
||||
NSEnumerator *enumerator = [children objectEnumerator];
|
||||
NSXMLNode *node;
|
||||
|
||||
while ((node = [enumerator nextObject]) != nil)
|
||||
{
|
||||
[self insertChild: node atIndex: index++];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) removeChildAtIndex: (NSUInteger)index
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
- (void) setChildren: (NSArray*)children
|
||||
{
|
||||
unsigned count;
|
||||
|
||||
while ((count = [_children count]) > 0)
|
||||
{
|
||||
[self removeChildAtIndex: count - 1];
|
||||
}
|
||||
[self insertChildren: children atIndex: 0];
|
||||
}
|
||||
|
||||
- (void) addChild: (NSXMLNode*)child
|
||||
{
|
||||
[self insertChild: child atIndex: [_children count]];
|
||||
}
|
||||
|
||||
- (void) replaceChildAtIndex: (NSUInteger)index withNode: (NSXMLNode*)node
|
||||
{
|
||||
[self removeChildAtIndex: index];
|
||||
[self insertChild: node atIndex: index];
|
||||
}
|
||||
|
||||
- (NSData*) XMLData
|
||||
{
|
||||
return [self XMLDataWithOptions: NSXMLNodeOptionsNone];
|
||||
}
|
||||
|
||||
- (NSData*) XMLDataWithOptions: (NSUInteger)options
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (id) objectByApplyingXSLT: (NSData*)xslt
|
||||
arguments: (NSDictionary*)arguments
|
||||
error: (NSError**)error
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (id) objectByApplyingXSLTString: (NSString*)xslt
|
||||
arguments: (NSDictionary*)arguments
|
||||
error: (NSError**)error
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (id) objectByApplyingXSLTAtURL: (NSURL*)xsltURL
|
||||
arguments: (NSDictionary*)argument
|
||||
error: (NSError**)error
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (BOOL) validateAndReturnError: (NSError**)error
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
return NO;
|
||||
}
|
||||
|
||||
@end
|
||||
|
215
Source/NSXMLElement.m
Normal file
215
Source/NSXMLElement.m
Normal file
|
@ -0,0 +1,215 @@
|
|||
/* Implementation for NSXMLElement for GNUStep
|
||||
Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Richard Frith-Macdonald <rfm@gnu.org>
|
||||
Created: September 2008
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#import "NSXMLPrivate.h"
|
||||
|
||||
@implementation NSXMLElement
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[_name release];
|
||||
[_attributes release];
|
||||
[_namespaces release];
|
||||
[_children release];
|
||||
[_URI release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (id) initWithName: (NSString*)name
|
||||
{
|
||||
return [self initWithName: name URI: nil];
|
||||
}
|
||||
|
||||
- (id) initWithName: (NSString*)name URI: (NSString*)URI
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (id) initWithName: (NSString*)name stringValue: (NSString*)string
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (id) initWithXMLString: (NSString*)string error: (NSError**)error
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSArray*) elementsForName: (NSString*)name
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSArray*) elementsForLocalName: (NSString*)localName URI: (NSString*)URI
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void) addAttribute: (NSXMLNode*)attribute
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
- (void) removeAttributeForName: (NSString*)name
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
- (void) setAttributes: (NSArray*)attributes
|
||||
{
|
||||
NSEnumerator *enumerator = [attributes objectEnumerator];
|
||||
NSXMLNode *attribute;
|
||||
|
||||
while ((attribute = [enumerator nextObject]) != nil)
|
||||
{
|
||||
[self addAttribute: attribute];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) setAttributesAsDictionary: (NSDictionary*)attributes
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
- (NSArray*) attributes
|
||||
{
|
||||
if (_attributes == nil)
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
return _attributes;
|
||||
}
|
||||
|
||||
- (NSXMLNode*) attributeForName: (NSString*)name
|
||||
{
|
||||
NSEnumerator *enumerator = [[self attributes] objectEnumerator];
|
||||
NSXMLNode *attribute;
|
||||
|
||||
while ((attribute = [enumerator nextObject]) != nil)
|
||||
{
|
||||
if ([name isEqualToString: [attribute name]] == YES)
|
||||
{
|
||||
return attribute;
|
||||
}
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSXMLNode*) attributeForLocalName: (NSString*)localName
|
||||
URI: (NSString*)URI
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void) addNamespace: (NSXMLNode*)aNamespace
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
- (void) removeNamespaceForPrefix: (NSString*)name
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
- (void) setNamespaces: (NSArray*)namespaces
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
- (NSArray*) namespaces
|
||||
{
|
||||
if (_namespaces == nil)
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
return _namespaces;
|
||||
}
|
||||
|
||||
- (NSXMLNode*) namespaceForPrefix: (NSString*)name
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSXMLNode*) resolveNamespaceForName: (NSString*)name
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSString*) resolvePrefixForNamespaceURI: (NSString*)namespaceURI
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void) insertChild: (NSXMLNode*)child atIndex: (NSUInteger)index
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
- (void) insertChildren: (NSArray*)children atIndex: (NSUInteger)index
|
||||
{
|
||||
NSEnumerator *enumerator = [children objectEnumerator];
|
||||
NSXMLNode *child;
|
||||
|
||||
while ((child = [enumerator nextObject]) != nil)
|
||||
{
|
||||
[self insertChild: child atIndex: index++];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) removeChildAtIndex: (NSUInteger)index
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
- (void) setChildren: (NSArray*)children
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
- (void) addChild: (NSXMLNode*)child
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
- (void) replaceChildAtIndex: (NSUInteger)index withNode: (NSXMLNode*)node
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
- (void) normalizeAdjacentTextNodesPreservingCDATA: (BOOL)preserve
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
@end
|
||||
|
370
Source/NSXMLNode.m
Normal file
370
Source/NSXMLNode.m
Normal file
|
@ -0,0 +1,370 @@
|
|||
/* Implementation for NSXMLNode for GNUStep
|
||||
Copyright (C) 2008 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Richard Frith-Macdonald <rfm@gnu.org>
|
||||
Created: September 2008
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#include "NSXMLPrivate.h"
|
||||
|
||||
@implementation NSXMLNode
|
||||
|
||||
+ (id) attributeWithName: (NSString*)name
|
||||
stringValue: (NSString*)stringValue
|
||||
{
|
||||
NSXMLNode *n;
|
||||
|
||||
n = [[[self alloc] initWithKind: NSXMLAttributeKind] autorelease];
|
||||
[n setStringValue: stringValue];
|
||||
return n;
|
||||
}
|
||||
|
||||
+ (id) attributeWithName: (NSString*)name
|
||||
URI: (NSString*)URI
|
||||
stringValue: (NSString*)stringValue
|
||||
{
|
||||
NSXMLNode *n;
|
||||
|
||||
n = [[[self alloc] initWithKind: NSXMLAttributeKind] autorelease];
|
||||
[n setURI: URI];
|
||||
[n setStringValue: stringValue];
|
||||
return n;
|
||||
}
|
||||
|
||||
+ (id) commentWithStringValue: (NSString*)stringValue
|
||||
{
|
||||
NSXMLNode *n;
|
||||
|
||||
n = [[[self alloc] initWithKind: NSXMLCommentKind] autorelease];
|
||||
[n setStringValue: stringValue];
|
||||
return n;
|
||||
}
|
||||
|
||||
+ (id) DTDNodeWithXMLString: (NSString*)string
|
||||
{
|
||||
NSXMLNode *n;
|
||||
|
||||
n = [[[self alloc] initWithKind: NSXMLDTDKind] autorelease];
|
||||
[n setStringValue: string];
|
||||
return n;
|
||||
}
|
||||
|
||||
+ (id) document
|
||||
{
|
||||
NSXMLNode *n;
|
||||
|
||||
n = [[[NSXMLDocument alloc] initWithKind:NSXMLDocumentKind] autorelease];
|
||||
return n;
|
||||
}
|
||||
|
||||
+ (id) documentWithRootElement: (NSXMLElement*)element
|
||||
{
|
||||
NSXMLDocument *d;
|
||||
|
||||
d = [NSXMLDocument alloc];
|
||||
d = [[d initWithRootElement: element] autorelease];
|
||||
return d;
|
||||
}
|
||||
|
||||
+ (id) elementWithName: (NSString*)name
|
||||
{
|
||||
NSXMLNode *n;
|
||||
|
||||
n = [[[NSXMLElement alloc] initWithName: name] autorelease];
|
||||
return n;
|
||||
}
|
||||
|
||||
+ (id) elementWithName: (NSString*)name
|
||||
children: (NSArray*)children
|
||||
attributes: (NSArray*)attributes
|
||||
{
|
||||
NSXMLElement *e = [self elementWithName: name];
|
||||
|
||||
[e insertChildren: children atIndex: 0];
|
||||
[e setAttributes: attributes];
|
||||
return e;
|
||||
}
|
||||
|
||||
+ (id) elementWithName: (NSString*)name
|
||||
URI: (NSString*)URI
|
||||
{
|
||||
NSXMLNode *n;
|
||||
|
||||
n = [[[NSXMLElement alloc] initWithName: name URI: URI] autorelease];
|
||||
return n;
|
||||
}
|
||||
|
||||
+ (id) elementWithName: (NSString*)name
|
||||
stringValue: (NSString*)string
|
||||
{
|
||||
NSXMLElement *e;
|
||||
NSXMLNode *t;
|
||||
|
||||
e = [self elementWithName: name];
|
||||
t = [[self alloc] initWithKind: NSXMLTextKind];
|
||||
[t setStringValue: string];
|
||||
[e addChild: t];
|
||||
[t release];
|
||||
return e;
|
||||
}
|
||||
|
||||
+ (NSString*) localNameForName: (NSString*)name
|
||||
{
|
||||
return [self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
+ (id) namespaceWithName: (NSString*)name
|
||||
stringValue: (NSString*)stringValue
|
||||
{
|
||||
NSXMLNode *n;
|
||||
|
||||
n = [[[self alloc] initWithKind: NSXMLNamespaceKind] autorelease];
|
||||
[n setStringValue: stringValue];
|
||||
return n;
|
||||
}
|
||||
|
||||
+ (NSXMLNode*) predefinedNamespaceForPrefix: (NSString*)name
|
||||
{
|
||||
return [self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
+ (NSString*) prefixForName: (NSString*)name
|
||||
{
|
||||
return [self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
+ (id) processingInstructionWithName: (NSString*)name
|
||||
stringValue: (NSString*)stringValue
|
||||
{
|
||||
NSXMLNode *n;
|
||||
|
||||
n = [[[self alloc] initWithKind: NSXMLProcessingInstructionKind] autorelease];
|
||||
[n setStringValue: stringValue];
|
||||
return n;
|
||||
}
|
||||
|
||||
+ (id) textWithStringValue: (NSString*)stringValue
|
||||
{
|
||||
NSXMLNode *n;
|
||||
|
||||
n = [[[self alloc] initWithKind: NSXMLTextKind] autorelease];
|
||||
[n setStringValue: stringValue];
|
||||
return n;
|
||||
}
|
||||
|
||||
- (NSString*) canonicalXMLStringPreservingComments: (BOOL)comments
|
||||
{
|
||||
return [self notImplemented: _cmd]; // FIXME ... generate from libxml
|
||||
}
|
||||
|
||||
- (NSXMLNode*) childAtIndex: (NSUInteger)index
|
||||
{
|
||||
return [self notImplemented: _cmd]; // FIXME ... fetch from libxml
|
||||
}
|
||||
|
||||
- (NSUInteger) childCount
|
||||
{
|
||||
[self notImplemented: _cmd]; // FIXME ... fetch from libxml
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (NSArray*)children
|
||||
{
|
||||
return [self notImplemented: _cmd]; // FIXME ... fetch from libxml
|
||||
}
|
||||
|
||||
- (id) copyWithZone: (NSZone*)zone
|
||||
{
|
||||
return [self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[self detach];
|
||||
[_objectValue release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void) detach
|
||||
{
|
||||
if (_parent != nil)
|
||||
{
|
||||
[self notImplemented: _cmd]; // FIXME ... remove from libxml
|
||||
}
|
||||
}
|
||||
|
||||
- (NSUInteger) index
|
||||
{
|
||||
return _index;
|
||||
}
|
||||
|
||||
- (id) initWithKind:(NSXMLNodeKind) kind
|
||||
{
|
||||
self = [self initWithKind: kind options: 0];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id) initWithKind: (NSXMLNodeKind)kind options: (NSUInteger)options
|
||||
{
|
||||
if ((self = [super init]) != nil)
|
||||
{
|
||||
[self notImplemented: _cmd]; // FIXME ... use libxml
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSXMLNodeKind) kind
|
||||
{
|
||||
return _kind;
|
||||
}
|
||||
|
||||
- (NSUInteger) level
|
||||
{
|
||||
NSUInteger level = 0;
|
||||
NSXMLNode *tmp = _parent;
|
||||
|
||||
while (tmp != nil)
|
||||
{
|
||||
level++;
|
||||
tmp = tmp->_parent;
|
||||
}
|
||||
return level;
|
||||
}
|
||||
|
||||
- (NSString*) localName
|
||||
{
|
||||
return [self notImplemented: _cmd]; // FIXME ... fetch from libxml
|
||||
}
|
||||
|
||||
- (NSString*) name
|
||||
{
|
||||
return [self notImplemented: _cmd]; // FIXME ... fetch from libxml
|
||||
}
|
||||
|
||||
- (NSXMLNode*) nextNode
|
||||
{
|
||||
return [self notImplemented: _cmd]; // FIXME ... fetch from libxml
|
||||
}
|
||||
|
||||
- (NSXMLNode*) nextSibling
|
||||
{
|
||||
return [self notImplemented: _cmd]; // FIXME ... fetch from libxml
|
||||
}
|
||||
|
||||
- (id) objectValue
|
||||
{
|
||||
return _objectValue;
|
||||
}
|
||||
|
||||
- (NSXMLNode*) parent
|
||||
{
|
||||
return _parent;
|
||||
}
|
||||
|
||||
- (NSString*) prefix
|
||||
{
|
||||
return [self notImplemented: _cmd]; // FIXME ... fetch from libxml
|
||||
}
|
||||
|
||||
- (NSXMLNode*) previousNode
|
||||
{
|
||||
return [self notImplemented: _cmd]; // FIXME ... fetch from libxml
|
||||
}
|
||||
|
||||
- (NSXMLNode*) previousSibling
|
||||
{
|
||||
return [self notImplemented: _cmd]; // FIXME ... fetch from libxml
|
||||
}
|
||||
|
||||
- (NSXMLDocument*) rootDocument
|
||||
{
|
||||
return [self notImplemented: _cmd]; // FIXME ... fetch from libxml
|
||||
}
|
||||
|
||||
- (NSString*) stringValue
|
||||
{
|
||||
// FIXME
|
||||
return _objectValue;
|
||||
}
|
||||
|
||||
- (NSString*) URI
|
||||
{
|
||||
return [self notImplemented: _cmd]; // FIXME ... fetch from libxml
|
||||
}
|
||||
|
||||
- (NSString*) XMLString
|
||||
{
|
||||
return [self XMLStringWithOptions: 0];
|
||||
}
|
||||
|
||||
- (NSString*) XMLStringWithOptions: (NSUInteger)options
|
||||
{
|
||||
return [self notImplemented: _cmd]; // FIXME ... generate from libxml
|
||||
}
|
||||
|
||||
- (void) setObjectValue: (id)value
|
||||
{
|
||||
ASSIGN(_objectValue, value);
|
||||
}
|
||||
|
||||
- (void) setName: (NSString*)name
|
||||
{
|
||||
[self notImplemented: _cmd]; // FIXME ... set in libxml
|
||||
}
|
||||
|
||||
- (void) setStringValue: (NSString*)string
|
||||
{
|
||||
[self setStringValue: string resolvingEntities: NO];
|
||||
}
|
||||
|
||||
- (void) setURI: (NSString*)URI
|
||||
{
|
||||
[self notImplemented: _cmd]; // FIXME ... set in libxml
|
||||
}
|
||||
|
||||
- (void) setStringValue: (NSString*)string resolvingEntities: (BOOL)resolve
|
||||
{
|
||||
[self notImplemented: _cmd]; // FIXME ... set in libxml
|
||||
}
|
||||
|
||||
- (NSString*) XPath
|
||||
{
|
||||
return [self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
- (NSArray*) nodesForXPath: (NSString*)xpath error: (NSError**)error
|
||||
{
|
||||
return [self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
- (NSArray*) objectsForXQuery: (NSString*)xquery
|
||||
constants: (NSDictionary*)constants
|
||||
error: (NSError**)error
|
||||
{
|
||||
return [self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
- (NSArray*) objectsForXQuery: (NSString*)xquery error: (NSError**)error
|
||||
{
|
||||
return [self notImplemented: _cmd];
|
||||
}
|
||||
|
||||
@end
|
||||
|
71
Source/NSXMLPrivate.h
Normal file
71
Source/NSXMLPrivate.h
Normal file
|
@ -0,0 +1,71 @@
|
|||
/* Private header for libxml2 wrapping components
|
||||
Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Richard Frith-Macdonald <rfm@gnu.org>
|
||||
Created: Februrary 2009
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDED_NSXMLPRIVATE_H
|
||||
#define _INCLUDED_NSXMLPRIVATE_H
|
||||
|
||||
#include "config.h"
|
||||
#include "GNUstepBase/preface.h"
|
||||
#import "Foundation/NSArray.h"
|
||||
#import "Foundation/NSData.h"
|
||||
#import "Foundation/NSDebug.h"
|
||||
#import "Foundation/NSDictionary.h"
|
||||
#import "Foundation/NSEnumerator.h"
|
||||
#import "Foundation/NSException.h"
|
||||
#import "Foundation/NSString.h"
|
||||
#import "Foundation/NSURL.h"
|
||||
#import "Foundation/NSXMLNode.h"
|
||||
#import "Foundation/NSXMLDocument.h"
|
||||
#import "Foundation/NSXMLDTDNode.h"
|
||||
#import "Foundation/NSXMLDTD.h"
|
||||
#import "Foundation/NSXMLElement.h"
|
||||
|
||||
#ifdef HAVE_LIBXML
|
||||
|
||||
/* Avoid problems on systems where the xml headers use 'id'
|
||||
*/
|
||||
#define id GSXMLID
|
||||
|
||||
/* libxml headers */
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/entities.h>
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/parserInternals.h>
|
||||
#include <libxml/HTMLparser.h>
|
||||
#include <libxml/xmlmemory.h>
|
||||
#include <libxml/xpath.h>
|
||||
#include <libxml/xpathInternals.h>
|
||||
|
||||
#ifdef HAVE_LIBXSLT
|
||||
#include <libxslt/xslt.h>
|
||||
#include <libxslt/xsltInternals.h>
|
||||
#include <libxslt/transform.h>
|
||||
#include <libxslt/xsltutils.h>
|
||||
#endif /* HAVE_LIBXSLT */
|
||||
|
||||
#undef id
|
||||
|
||||
#endif /* HAVE_LIBXML */
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue