eXchaNGeR

org.xngr
Interface XFactory


public interface XFactory

Factory methods that allow for document and element creation.

Version:
$Revision: 1.3 $, $Date: 2002/08/19 20:06:36 $
Author:
Edwin Dankert

Method Summary
 XDocument createDocument(URL url, XElement root)
          Creates a document for the Url supplied.
 XElement createElement(Reader reader)
          Creates an element tree for the character stream Reader supplied.
 XElement createElement(String name)
          Creates an empty element for the name supplied.
 XElement createElement(XElementType type)
          Creates an empty element for the element type supplied.
 XDocument openDocument(URL url)
          Opens a document for the Url supplied.
 

Method Detail

createElement

public XElement createElement(String name)
Creates an empty element for the name supplied.
Parameters:
name - the name of the element.
Returns:
the newly created element.

createElement

public XElement createElement(XElementType type)
Creates an empty element for the element type supplied.
Parameters:
type - the type of element.
Returns:
the newly created element.

createElement

public XElement createElement(Reader reader)
                       throws org.xml.sax.SAXParseException
Creates an element tree for the character stream Reader supplied.
Parameters:
reader - the reader for the XML information.
Returns:
the newly created element tree.
Throws:
org.xml.sax.SAXParseException - if the information in the reader cannot be parsed.

openDocument

public XDocument openDocument(URL url)
                       throws IOException,
                              org.xml.sax.SAXParseException
Opens a document for the Url supplied. This method returns null if there is no document for the url. This method does not give a reference to a document in the browser, use XManager.getDocument() for this.
Parameters:
url - the URL for the document.
Returns:
the newly opened document.
Throws:
IOException - if the document cannot be opened.
org.xml.sax.SAXParseException - if the information in the document cannot be parsed.

createDocument

public XDocument createDocument(URL url,
                                XElement root)
Creates a document for the Url supplied. Returns null if the document could not be created.
Parameters:
url - the URL for the document.
root - the root element for the document.
Returns:
the newly created document.

eXchaNGeR

Copyright © 2002, Cladonia Ltd., All Rights Reserved