Up

# NSXMLDocument class documentation

### Authors

Generated by root

# Software documentation for the NSXMLDocument class

## NSXMLDocument : NSXMLNode

> Declared in:
>   Foundation/NSXMLDocument.h

Availability: OpenStep
An XMLDocument encapsulates an entire document. This must contain a single element node.
Method summary

- +replacementClassForClass:
- -DTD
- -MIMEType
- -XMLData
- -XMLDataWithOptions:
- -addChild:
- -characterEncoding
- -documentContentKind
- -initWithContentsOfURL:options:error:
- -initWithData:options:error:
- -initWithRootElement:
- -initWithXMLString:options:error:
- -insertChild:atIndex:
- -insertChildren:atIndex:
- -isStandalone
- -objectByApplyingXSLT:arguments:error:
- -objectByApplyingXSLTAtURL:arguments:error:
- -objectByApplyingXSLTString:arguments:error:
- -removeChildAtIndex:
- -replaceChildAtIndex:withNode:
- -rootElement
- -setCharacterEncoding:
- -setChildren:
- -setDTD:
- -setDocumentContentKind:
- -setMIMEType:
- -setRootElement:
- -setStandalone:
- -setVersion:
- -validateAndReturnError:
- -version

### replacementClassForClass:

+ (Class) replacementClassForClass: (Class)cls;
Availability: OpenStep
Description forthcoming.

### DTD

- (NSXMLDTD*) DTD;
Availability: OpenStep
Returns the DTD set for the receiver.

### MIMEType

- (NSString*) MIMEType;
Availability: OpenStep
Returns the document MIME type..

### XMLData

- (NSData*) XMLData;
Availability: OpenStep
Outputs XML data using -XMLDataWithOptions: with NSXMLNodeOptionsNone.

### XMLDataWithOptions:

- (NSData*) XMLDataWithOptions: (NSUInteger)theOptions;
Availability: OpenStep
Outputs the reciever encoded using the specified options.

### addChild:

- (void) addChild: (NSXMLNode*)child;
Availability: OpenStep
Adds child after existing children.

### characterEncoding

- (NSString*) characterEncoding;
Availability: OpenStep
Returns the IANA character encoding, or `nil` if none is set.

### documentContentKind

- (NSXMLDocumentContentKind) documentContentKind;
Availability: OpenStep
Returns the kind of document.

### initWithContentsOfURL: options: error:

- (id) initWithContentsOfURL: (NSURL*)url options: (NSUInteger)mask error: (NSError**)error;
Availability: OpenStep
Initialise using the data downloaded from the spplied url.

### initWithData: options: error:

- (id) initWithData: (NSData*)data options: (NSUInteger)mask error: (NSError**)error;
Availability: OpenStep
This is a designated initialiser for the class.
Returns a document created from data.
Parse errors are returned in error .

### initWithRootElement:

- (id) initWithRootElement: (NSXMLElement*)element;
Availability: OpenStep
Returns a document with a single child, the root element.

### initWithXMLString: options: error:

- (id) initWithXMLString: (NSString*)string options: (NSUInteger)mask error: (NSError**)error;
Availability: OpenStep
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.

### insertChild: atIndex:

- (void) insertChild: (NSXMLNode*)child atIndex: (NSUInteger)index;
Availability: OpenStep
Inserts child at index.

### insertChildren: atIndex:

- (void) insertChildren: (NSArray*)children atIndex: (NSUInteger)index;
Availability: OpenStep
Inserts a number of children at the index.

### isStandalone

- (BOOL) isStandalone;
Availability: OpenStep
Returns `NO` if the receiver depends upon an external DTD, otherwise returns `YES`.

### objectByApplyingXSLT: arguments: error:

- (id) objectByApplyingXSLT: (NSData*)xslt arguments: (NSDictionary*)arguments error: (NSError**)error;
Availability: OpenStep
Returns a new document created by applying xslt (with a set of key/value pairs) to the receiver.

### objectByApplyingXSLTAtURL: arguments: error:

- (id) objectByApplyingXSLTAtURL: (NSURL*)xsltURL arguments: (NSDictionary*)arguments error: (NSError**)error;
Availability: OpenStep
Downloads XSLT from xsltURL, and then returns a new document created by applying it (with a set of key/value pairs) to the receiver.

### objectByApplyingXSLTString: arguments: error:

- (id) objectByApplyingXSLTString: (NSString*)xslt arguments: (NSDictionary*)arguments error: (NSError**)error;
Availability: OpenStep
Returns a new document created by applying xslt (with a set of key/value pairs) to the receiver.

### removeChildAtIndex:

- (void) removeChildAtIndex: (NSUInteger)index;
Availability: OpenStep
Removes the child at the index.

### replaceChildAtIndex: withNode:

- (void) replaceChildAtIndex: (NSUInteger)index withNode: (NSXMLNode*)theNode;
Availability: OpenStep
Replacs the child at the specified index .

### rootElement

- (NSXMLElement*) rootElement;
Availability: OpenStep
Returns the root object of the receiver.

### setCharacterEncoding:

- (void) setCharacterEncoding: (NSString*)encoding;
Availability: OpenStep
Sets the character encoding to an IANA characterset type.

### setChildren:

- (void) setChildren: (NSArray*)children;
Availability: OpenStep
Replaces all existing child nodes with the ones in the array.

### setDTD:

- (void) setDTD: (NSXMLDTD*)documentTypeDeclaration;
Availability: OpenStep
Sets the DTD of the receiver. If this is set then the DTD will be output when the document is.

### setDocumentContentKind:

- (void) setDocumentContentKind: (NSXMLDocumentContentKind)theContentKind;
Availability: OpenStep
Sets the kind of document.

### setMIMEType:

- (void) setMIMEType: (NSString*)theMIMEType;
Availability: OpenStep
Sets the document MIME type (usually text/xml).

### setRootElement:

- (void) setRootElement: (NSXMLNode*)root;
Availability: OpenStep
Sets the root object of the receiver, removing any children which were previously set.

### setStandalone:

- (void) setStandalone: (BOOL)standalone;
Availability: OpenStep
Sets whether the receiver is a document which requires an external DTD.
If this is set then the standalone declaration will appear if the document is output.

### setVersion:

- (void) setVersion: (NSString*)version;
Availability: OpenStep
Sets the XML version
Permitted values ar '1.0' or '1,1'

### validateAndReturnError:

- (BOOL) validateAndReturnError: (NSError**)error;
Availability: OpenStep
Description forthcoming.

### version

- (NSString*) version;
Availability: OpenStep
Returns the XML version or `nil` if none is set.

Up