com.caucho.xml2
Class DOMBuilder

java.lang.Object
  extended by com.caucho.xml2.DOMBuilder
All Implemented Interfaces:
XMLWriter, org.xml.sax.ContentHandler, org.xml.sax.ErrorHandler

public class DOMBuilder
extends java.lang.Object
implements XMLWriter, org.xml.sax.ContentHandler, org.xml.sax.ErrorHandler

XMLWriter to create a DOM document.


Constructor Summary
DOMBuilder()
           
 
Method Summary
 void attribute(java.lang.String uri, java.lang.String localName, java.lang.String qName, java.lang.String value)
           
 void cdata(char[] buffer, int offset, int length)
           
 void cdata(java.lang.String text)
           
 void characters(char[] buffer, int offset, int length)
          Adds text characters to the current document.
 void comment(char[] buf, int offset, int length)
          Handles the callback for a comment.
 void comment(java.lang.String data)
          Handles the callback for a comment.
 org.xml.sax.SAXException createError(java.lang.Exception e)
          Throws an appropriate error.
 void dtd(QDocumentType dtd)
           
 void endDocument()
           
 void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)
           
 void endPrefixMapping(java.lang.String prefix)
           
 void entityReference(java.lang.String name)
           
 void error(org.xml.sax.SAXParseException e)
           
 void fatalError(org.xml.sax.SAXParseException e)
           
 boolean getEscapeText()
           
 org.w3c.dom.Node getNode()
           
 java.lang.String getSystemId()
           
 void ignorableWhitespace(char[] buffer, int offset, int length)
          Handles the callback for ignorable whitespace.
 void init(org.w3c.dom.Node top)
           
 void processingInstruction(java.lang.String name, java.lang.String data)
           
 void setCoalescing(boolean isCoalescing)
          Set true if text and cdata nodes should be combined.
 void setDocumentLocator(org.xml.sax.Locator loc)
           
 void setEscapeText(boolean isEscaped)
           
 void setFilename(java.lang.String filename)
           
 void setLocation(java.lang.String filename, int line, int column)
           
 void setSkipWhitespace(boolean skipWhitespace)
          Set true if ignorable whitespace should be skipped.
 void setStrictXML(boolean isStrictXml)
          Set true if we're only handling strict xml.
 void setSystemId(java.lang.String systemId)
           
 void skippedEntity(java.lang.String s)
           
 void startDocument()
           
 void startElement(javax.xml.namespace.QName name, com.caucho.xml2.QAttributes attributes)
           
 void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)
           
 void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes)
           
 void startPrefixMapping(java.lang.String prefix, java.lang.String url)
           
 void text(char[] buffer, int offset, int length)
           
 void text(java.lang.String text)
           
 void warning(org.xml.sax.SAXParseException e)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DOMBuilder

public DOMBuilder()
Method Detail

init

public void init(org.w3c.dom.Node top)

setSystemId

public void setSystemId(java.lang.String systemId)

getSystemId

public java.lang.String getSystemId()

setFilename

public void setFilename(java.lang.String filename)

setStrictXML

public void setStrictXML(boolean isStrictXml)
Set true if we're only handling strict xml.


setCoalescing

public void setCoalescing(boolean isCoalescing)
Set true if text and cdata nodes should be combined.


setSkipWhitespace

public void setSkipWhitespace(boolean skipWhitespace)
Set true if ignorable whitespace should be skipped.


setDocumentLocator

public void setDocumentLocator(org.xml.sax.Locator loc)
Specified by:
setDocumentLocator in interface XMLWriter
Specified by:
setDocumentLocator in interface org.xml.sax.ContentHandler

startPrefixMapping

public void startPrefixMapping(java.lang.String prefix,
                               java.lang.String url)
Specified by:
startPrefixMapping in interface XMLWriter
Specified by:
startPrefixMapping in interface org.xml.sax.ContentHandler

endPrefixMapping

public void endPrefixMapping(java.lang.String prefix)
Specified by:
endPrefixMapping in interface XMLWriter
Specified by:
endPrefixMapping in interface org.xml.sax.ContentHandler

getNode

public org.w3c.dom.Node getNode()

startDocument

public void startDocument()
Specified by:
startDocument in interface XMLWriter
Specified by:
startDocument in interface org.xml.sax.ContentHandler

endDocument

public void endDocument()
                 throws org.xml.sax.SAXException
Specified by:
endDocument in interface XMLWriter
Specified by:
endDocument in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

setLocation

public void setLocation(java.lang.String filename,
                        int line,
                        int column)

startElement

public void startElement(java.lang.String uri,
                         java.lang.String localName,
                         java.lang.String qName)
                  throws java.io.IOException
Specified by:
startElement in interface XMLWriter
Throws:
java.io.IOException

startElement

public void startElement(javax.xml.namespace.QName name,
                         com.caucho.xml2.QAttributes attributes)
                  throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

startElement

public void startElement(java.lang.String uri,
                         java.lang.String localName,
                         java.lang.String qName,
                         org.xml.sax.Attributes attributes)
                  throws org.xml.sax.SAXException
Specified by:
startElement in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

dtd

public void dtd(QDocumentType dtd)

attribute

public void attribute(java.lang.String uri,
                      java.lang.String localName,
                      java.lang.String qName,
                      java.lang.String value)
               throws java.io.IOException
Specified by:
attribute in interface XMLWriter
Throws:
java.io.IOException

endElement

public void endElement(java.lang.String uri,
                       java.lang.String localName,
                       java.lang.String qName)
Specified by:
endElement in interface XMLWriter
Specified by:
endElement in interface org.xml.sax.ContentHandler

processingInstruction

public void processingInstruction(java.lang.String name,
                                  java.lang.String data)
Specified by:
processingInstruction in interface XMLWriter
Specified by:
processingInstruction in interface org.xml.sax.ContentHandler

comment

public void comment(char[] buf,
                    int offset,
                    int length)
             throws org.xml.sax.SAXException
Handles the callback for a comment.

Parameters:
data - the content of the comment.
Throws:
org.xml.sax.SAXException

comment

public void comment(java.lang.String data)
             throws java.io.IOException
Handles the callback for a comment.

Specified by:
comment in interface XMLWriter
Parameters:
data - the content of the comment.
Throws:
java.io.IOException

getEscapeText

public boolean getEscapeText()
Specified by:
getEscapeText in interface XMLWriter

setEscapeText

public void setEscapeText(boolean isEscaped)
Specified by:
setEscapeText in interface XMLWriter

text

public void text(java.lang.String text)
          throws java.io.IOException
Specified by:
text in interface XMLWriter
Throws:
java.io.IOException

text

public void text(char[] buffer,
                 int offset,
                 int length)
          throws java.io.IOException
Specified by:
text in interface XMLWriter
Throws:
java.io.IOException

characters

public void characters(char[] buffer,
                       int offset,
                       int length)
                throws org.xml.sax.SAXException
Adds text characters to the current document.

Specified by:
characters in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

ignorableWhitespace

public void ignorableWhitespace(char[] buffer,
                                int offset,
                                int length)
                         throws org.xml.sax.SAXException
Handles the callback for ignorable whitespace.

Specified by:
ignorableWhitespace in interface org.xml.sax.ContentHandler
Parameters:
buffer - the character buffer containing the whitespace.
offset - starting offset into the character buffer.
length - number of characters in the buffer.
Throws:
org.xml.sax.SAXException

entityReference

public void entityReference(java.lang.String name)

skippedEntity

public void skippedEntity(java.lang.String s)
Specified by:
skippedEntity in interface org.xml.sax.ContentHandler

cdata

public void cdata(java.lang.String text)
           throws java.io.IOException
Specified by:
cdata in interface XMLWriter
Throws:
java.io.IOException

cdata

public void cdata(char[] buffer,
                  int offset,
                  int length)
           throws java.io.IOException
Specified by:
cdata in interface XMLWriter
Throws:
java.io.IOException

fatalError

public void fatalError(org.xml.sax.SAXParseException e)
                throws org.xml.sax.SAXException
Specified by:
fatalError in interface org.xml.sax.ErrorHandler
Throws:
org.xml.sax.SAXException

error

public void error(org.xml.sax.SAXParseException e)
           throws org.xml.sax.SAXException
Specified by:
error in interface org.xml.sax.ErrorHandler
Throws:
org.xml.sax.SAXException

warning

public void warning(org.xml.sax.SAXParseException e)
             throws org.xml.sax.SAXException
Specified by:
warning in interface org.xml.sax.ErrorHandler
Throws:
org.xml.sax.SAXException

createError

public org.xml.sax.SAXException createError(java.lang.Exception e)
Throws an appropriate error.