public class DOMBuilder extends BuilderSupport
Constructor and Description |
---|
DOMBuilder(org.w3c.dom.Document document) |
DOMBuilder(javax.xml.parsers.DocumentBuilder documentBuilder) |
Modifier and Type | Method and Description |
---|---|
protected void |
appendNamespaceAttributes(org.w3c.dom.Element element,
java.util.Map<java.lang.Object,java.lang.Object> attributes) |
protected org.w3c.dom.Document |
createDocument() |
protected java.lang.Object |
createNode(java.lang.Object name) |
protected java.lang.Object |
createNode(java.lang.Object name,
java.util.Map attributes) |
protected java.lang.Object |
createNode(java.lang.Object name,
java.util.Map attributes,
java.lang.Object value) |
protected java.lang.Object |
createNode(java.lang.Object name,
java.lang.Object value) |
static DOMBuilder |
newInstance() |
static DOMBuilder |
newInstance(boolean validating,
boolean namespaceAware) |
static org.w3c.dom.Document |
parse(java.io.Reader reader)
Creates a DocumentBuilder and uses it to parse the XML text read from the given reader.
|
static org.w3c.dom.Document |
parse(java.io.Reader reader,
boolean validating,
boolean namespaceAware)
Creates a DocumentBuilder and uses it to parse the XML text read from the given reader, allowing
parser validation and namespace awareness to be controlled.
|
static org.w3c.dom.Document |
parse(java.io.Reader reader,
boolean validating,
boolean namespaceAware,
boolean allowDocTypeDeclaration)
Creates a DocumentBuilder and uses it to parse the XML text read from the given reader, allowing
parser validation, namespace awareness and permission of DOCTYPE declarations to be controlled.
|
org.w3c.dom.Document |
parseText(java.lang.String text)
A helper method to parse the given text as XML.
|
protected void |
setParent(java.lang.Object parent,
java.lang.Object child) |
doInvokeMethod, getCurrent, getName, invokeMethod, invokeMethod, nodeCompleted, postNodeCompletion, setClosureDelegate, setCurrent
getMetaClass, getProperty, setMetaClass, setProperty
public DOMBuilder(org.w3c.dom.Document document)
public DOMBuilder(javax.xml.parsers.DocumentBuilder documentBuilder)
public static DOMBuilder newInstance() throws javax.xml.parsers.ParserConfigurationException
javax.xml.parsers.ParserConfigurationException
public static DOMBuilder newInstance(boolean validating, boolean namespaceAware) throws javax.xml.parsers.ParserConfigurationException
javax.xml.parsers.ParserConfigurationException
public static org.w3c.dom.Document parse(java.io.Reader reader) throws org.xml.sax.SAXException, java.io.IOException, javax.xml.parsers.ParserConfigurationException
reader
- the reader to read the XML text fromorg.xml.sax.SAXException
- Any SAX exception, possibly wrapping another exception.java.io.IOException
- An IO exception from the parser, possibly from a byte
stream or character stream supplied by the application.javax.xml.parsers.ParserConfigurationException
- if a DocumentBuilder cannot be created which satisfies
the configuration requested.parse(Reader, boolean, boolean)
public static org.w3c.dom.Document parse(java.io.Reader reader, boolean validating, boolean namespaceAware) throws org.xml.sax.SAXException, java.io.IOException, javax.xml.parsers.ParserConfigurationException
reader
- the reader to read the XML text fromvalidating
- whether to validate the XMLnamespaceAware
- whether the parser should be namespace awareorg.xml.sax.SAXException
- Any SAX exception, possibly wrapping another exception.java.io.IOException
- An IO exception from the parser, possibly from a byte
stream or character stream supplied by the application.javax.xml.parsers.ParserConfigurationException
- if a DocumentBuilder cannot be created which satisfies
the configuration requested.public static org.w3c.dom.Document parse(java.io.Reader reader, boolean validating, boolean namespaceAware, boolean allowDocTypeDeclaration) throws org.xml.sax.SAXException, java.io.IOException, javax.xml.parsers.ParserConfigurationException
reader
- the reader to read the XML text fromvalidating
- whether to validate the XMLnamespaceAware
- whether the parser should be namespace awareallowDocTypeDeclaration
- whether the parser should allow DOCTYPE declarationsorg.xml.sax.SAXException
- Any SAX exception, possibly wrapping another exception.java.io.IOException
- An IO exception from the parser, possibly from a byte
stream or character stream supplied by the application.javax.xml.parsers.ParserConfigurationException
- if a DocumentBuilder cannot be created which satisfies
the configuration requested.public org.w3c.dom.Document parseText(java.lang.String text) throws org.xml.sax.SAXException, java.io.IOException, javax.xml.parsers.ParserConfigurationException
text
- the XML text to parseorg.xml.sax.SAXException
- Any SAX exception, possibly wrapping another exception.java.io.IOException
- An IO exception from the parser, possibly from a byte
stream or character stream supplied by the application.javax.xml.parsers.ParserConfigurationException
- if a DocumentBuilder cannot be created which satisfies
the configuration requested.parse(Reader)
protected void setParent(java.lang.Object parent, java.lang.Object child)
setParent
in class BuilderSupport
protected java.lang.Object createNode(java.lang.Object name)
createNode
in class BuilderSupport
protected org.w3c.dom.Document createDocument()
protected java.lang.Object createNode(java.lang.Object name, java.lang.Object value)
createNode
in class BuilderSupport
protected java.lang.Object createNode(java.lang.Object name, java.util.Map attributes, java.lang.Object value)
createNode
in class BuilderSupport
protected java.lang.Object createNode(java.lang.Object name, java.util.Map attributes)
createNode
in class BuilderSupport
protected void appendNamespaceAttributes(org.w3c.dom.Element element, java.util.Map<java.lang.Object,java.lang.Object> attributes)