DOMBuilder Class Reference

List of all members.

Detailed Description

An abstract class for building documents.

Subclasses of this class can build DOM-structures, this abstract implementation cannot build anything.

Concrete subclasses can be aquired by using the methods in the BuilderFactory-category.

To build a document use the default builder (aquired by calling defaultBuilder, or by using documentFromFile:, which calls the default builder internally.

The builder can use an alternative implementation of the core node classes to construct the document. You can set the implementation to use with the useImplementation: method. This feature decouples the builder API from any specific implementation, and means that any builder could be used to build any document. There is no need to write a separate builder for each implementation.

Some builders may, however, choose to support only one implementation, if there is parser-specific issued that would make it inconvenient to do otherwise.

Note:
All the build*-methods and documentFromFile may raise either an DOMMalformedDocumentException or a DOMNoDataException.
Exceptions:
DOMMalformedDocumentException raised if the parser encountered an error. Additional information (line and row number, document name and so on) should be provided in the exception's message, if that information is available from the parser.
DOMNoDataException raised if the data sent to the parser or the data from the URL sent was empty.


Public Member Functions

(id< DOMDocument >)  buildFromFile:
(id< DOMDocument >)  buildFromData:
(id< DOMDocument >)  buildFromURL:
(id< DOMDocument >)  buildFromData:sourceURL:

Static Public Member Functions

(id< DOMDocument >)  documentFromFile:

Protected Attributes

DOMImplementation implementation

Member Function Documentation

- (id <DOMDocument>) buildFromData: (NSData *)  data  
 

buildFromData: Build a document from a blob of data and returns it May be implemented in a subclass, otherwise calls buildFromData:sourceURL: with NULL as the source URL.

Unless overridden by a subclass, calls buildFromData:sourceURL: (with nil as second argument).

Exceptions:
DOMMalformedDocumentException see class documentation for more info
DOMNoDataException see class documentation for more info

- (id <DOMDocument>) buildFromData: (NSData *)  data
sourceURL: (NSURL *)  url
 
 

Build a document from a blob of data.

The source URL is used to resolve any relative references contained in the document (if any). Pass nil if no URL is available.

To be implemented by a subclass, this version raises an exception. Unless any of the other build*-methods are overridden, they all call this method.

Exceptions:
DOMMalformedDocumentException see class documentation for more info
DOMNoDataException see class documentation for more info

- (id <DOMDocument>) buildFromFile: (NSString *)  path  
 

Builds a document from a file at path, returns the document May be implemented in a subclass, otherwise reads the data at the path and calls buildFromData:sourceURL:.

Unless overridden by a subclass, calls buildFromData:sourceURL:

Exceptions:
DOMMalformedDocumentException see class documentation for more info
DOMNoDataException see class documentation for more info

- (id <DOMDocument>) buildFromURL: (NSURL *)  url  
 

Build a document from data located at an URL May be implemented in a subclass, otherwise fetches the data at the URL and calls buildFromData:sourceURL:.

Unless overridden by a subclass, calls buildFromData:sourceURL:

Exceptions:
DOMMalformedDocumentException see class documentation for more info
DOMNoDataException see class documentation for more info

+ (id <DOMDocument>) documentFromFile: (NSString *)  path  
 

Convienience method for quickly building a document from a file, uses the default builder.

Exceptions:
DOMMalformedDocumentException see class documentation for more info
DOMNoDataException see class documentation for more info

Member Data Documentation

- (DOMImplementation*) implementation [protected]