public class DOMBuilder extends BuilderSupport
A helper class for creating a W3C DOM tree
Constructor and description |
---|
DOMBuilder
(Document document) |
DOMBuilder
(DocumentBuilder documentBuilder) |
Type Params | Return Type | Name and description |
---|---|---|
|
protected void |
appendNamespaceAttributes(Element element, Map<Object, Object> attributes) |
|
protected Document |
createDocument() |
|
protected Object |
createNode(Object name) |
|
protected Object |
createNode(Object name, Object value) |
|
protected Object |
createNode(Object name, Map attributes, Object value) |
|
protected Object |
createNode(Object name, Map attributes) |
|
public static DOMBuilder |
newInstance() |
|
public static DOMBuilder |
newInstance(boolean validating, boolean namespaceAware) |
|
public static Document |
parse(Reader reader) Creates a DocumentBuilder and uses it to parse the XML text read from the given reader. |
|
public 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. |
|
public static Document |
parse(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. |
|
public Document |
parseText(String text) A helper method to parse the given text as XML. |
|
protected void |
setParent(Object parent, Object child) |
Methods inherited from class | Name |
---|---|
class BuilderSupport |
createNode, createNode, createNode, createNode, doInvokeMethod, getCurrent, getName, invokeMethod, invokeMethod, nodeCompleted, postNodeCompletion, setClosureDelegate, setCurrent, setParent |
class GroovyObjectSupport |
getMetaClass, setMetaClass |
Creates a DocumentBuilder and uses it to parse the XML text read from the given reader. A non-validating, namespace aware parser which does not allow DOCTYPE declarations is used.
reader
- the reader to read the XML text fromCreates a DocumentBuilder and uses it to parse the XML text read from the given reader, allowing parser validation and namespace awareness to be controlled. Documents are not allowed to contain DOCYTYPE declarations.
reader
- the reader to read the XML text fromvalidating
- whether to validate the XMLnamespaceAware
- whether the parser should be namespace awareCreates 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.
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 declarationsA helper method to parse the given text as XML.
text
- the XML text to parseCopyright © 2003-2020 The Apache Software Foundation. All rights reserved.