public class DOMBuilder extends BuilderSupport
Constructor and Description |
---|
DOMBuilder(Document document) |
DOMBuilder(DocumentBuilder documentBuilder) |
Modifier and Type | Method and Description |
---|---|
protected void |
appendNamespaceAttributes(Element element,
Map<Object,Object> attributes) |
protected Document |
createDocument() |
protected Object |
createNode(Object name) |
protected Object |
createNode(Object name,
Map attributes) |
protected Object |
createNode(Object name,
Map attributes,
Object value) |
protected Object |
createNode(Object name,
Object value) |
static DOMBuilder |
newInstance() |
static DOMBuilder |
newInstance(boolean validating,
boolean namespaceAware) |
static Document |
parse(Reader reader)
Creates a DocumentBuilder and uses it to parse the XML text read from the given reader.
|
static Document |
parse(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.
|
Document |
parseText(String text)
A helper method to parse the given text as XML.
|
protected void |
setParent(Object parent,
Object child) |
doInvokeMethod, getCurrent, getName, invokeMethod, invokeMethod, nodeCompleted, postNodeCompletion, setClosureDelegate, setCurrent
getMetaClass, getProperty, setMetaClass, setProperty
public DOMBuilder(Document document)
public DOMBuilder(DocumentBuilder documentBuilder)
public static DOMBuilder newInstance() throws ParserConfigurationException
ParserConfigurationException
public static DOMBuilder newInstance(boolean validating, boolean namespaceAware) throws ParserConfigurationException
ParserConfigurationException
public static Document parse(Reader reader) throws SAXException, IOException, ParserConfigurationException
reader
- the reader to read the XML text fromSAXException
- Any SAX exception, possibly wrapping another exception.IOException
- An IO exception from the parser, possibly from a byte
stream or character stream supplied by the application.ParserConfigurationException
- if a DocumentBuilder cannot be created which satisfies
the configuration requested.parse(Reader, boolean, boolean)
public static Document parse(Reader reader, boolean validating, boolean namespaceAware) throws SAXException, IOException, ParserConfigurationException
reader
- the reader to read the XML text fromvalidating
- whether to validate the XMLnamespaceAware
- whether the parser should be namespace awareSAXException
- Any SAX exception, possibly wrapping another exception.IOException
- An IO exception from the parser, possibly from a byte
stream or character stream supplied by the application.ParserConfigurationException
- if a DocumentBuilder cannot be created which satisfies
the configuration requested.public Document parseText(String text) throws SAXException, IOException, ParserConfigurationException
text
- the XML text to parseSAXException
- Any SAX exception, possibly wrapping another exception.IOException
- An IO exception from the parser, possibly from a byte
stream or character stream supplied by the application.ParserConfigurationException
- if a DocumentBuilder cannot be created which satisfies
the configuration requested.parse(Reader)
protected void setParent(Object parent, Object child)
setParent
in class BuilderSupport
protected Object createNode(Object name)
createNode
in class BuilderSupport
protected Document createDocument()
protected Object createNode(Object name, Object value)
createNode
in class BuilderSupport
protected Object createNode(Object name, Map attributes, Object value)
createNode
in class BuilderSupport
protected Object createNode(Object name, Map attributes)
createNode
in class BuilderSupport