Save This Page
Home » groovy-src-1.6.3 » groovy » util » [javadoc | source]
groovy.util
public class: XmlParser [javadoc | source]
java.lang.Object
   groovy.util.XmlParser

All Implemented Interfaces:
    ContentHandler

A helper class for parsing XML into a tree of Node instances for a simple way of processing XML. This parser does not preserve the XML InfoSet - if that's what you need try using W3C DOM, dom4j, JDOM, XOM etc. This parser ignores comments and processing instructions and converts the XML into a Node for each element in the XML with attributes and child Nodes and Strings. This simple model is sufficient for most simple use cases of processing XML.
Constructor:
 public XmlParser() throws SAXException, ParserConfigurationException 
 public XmlParser(XMLReader reader) 
 public XmlParser(SAXParser parser) throws SAXException 
 public XmlParser(boolean validating,
    boolean namespaceAware) throws SAXException, ParserConfigurationException 
Method from groovy.util.XmlParser Summary:
addTextToNode,   characters,   createNode,   endDocument,   endElement,   endPrefixMapping,   getDTDHandler,   getDocumentLocator,   getElementName,   getEntityResolver,   getErrorHandler,   getFeature,   getProperty,   getXMLReader,   ignorableWhitespace,   isNamespaceAware,   isTrimWhitespace,   parse,   parse,   parse,   parse,   parse,   parseText,   processingInstruction,   setDTDHandler,   setDocumentLocator,   setEntityResolver,   setErrorHandler,   setFeature,   setNamespaceAware,   setProperty,   setTrimWhitespace,   skippedEntity,   startDocument,   startElement,   startPrefixMapping
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from groovy.util.XmlParser Detail:
 protected  void addTextToNode() 
 public  void characters(char[] buffer,
    int start,
    int length) throws SAXException 
 protected Node createNode(Node parent,
    Object name,
    Map attributes) 
    Creates a new node with the given parent, name, and attributes. The default implementation returns an instance of groovy.util.Node.
 public  void endDocument() throws SAXException 
 public  void endElement(String namespaceURI,
    String localName,
    String qName) throws SAXException 
 public  void endPrefixMapping(String prefix) throws SAXException 
 public DTDHandler getDTDHandler() 
 public Locator getDocumentLocator() 
 protected Object getElementName(String namespaceURI,
    String localName,
    String qName) 
    Return a name given the namespaceURI, localName and qName.
 public EntityResolver getEntityResolver() 
 public ErrorHandler getErrorHandler() 
 public boolean getFeature(String uri) throws SAXNotSupportedException, SAXNotRecognizedException 
 public Object getProperty(String uri) throws SAXNotSupportedException, SAXNotRecognizedException 
 protected XMLReader getXMLReader() 
 public  void ignorableWhitespace(char[] buffer,
    int start,
    int len) throws SAXException 
 public boolean isNamespaceAware() 
    Determine if namspace handling is enabled.
 public boolean isTrimWhitespace() 
    Returns the current trim whitespace setting.
 public Node parse(File file) throws IOException, SAXException 
    Parses the content of the given file as XML turning it into a tree of Nodes.
 public Node parse(InputSource input) throws IOException, SAXException 
    Parse the content of the specified input source into a tree of Nodes.
 public Node parse(InputStream input) throws IOException, SAXException 
    Parse the content of the specified input stream into a tree of Nodes.

    Note that using this method will not provide the parser with any URI for which to find DTDs etc

 public Node parse(Reader in) throws IOException, SAXException 
    Parse the content of the specified reader into a tree of Nodes.

    Note that using this method will not provide the parser with any URI for which to find DTDs etc

 public Node parse(String uri) throws IOException, SAXException 
    Parse the content of the specified URI into a tree of Nodes.
 public Node parseText(String text) throws IOException, SAXException 
    A helper method to parse the given text as XML.
 public  void processingInstruction(String target,
    String data) throws SAXException 
 public  void setDTDHandler(DTDHandler dtdHandler) 
 public  void setDocumentLocator(Locator locator) 
 public  void setEntityResolver(EntityResolver entityResolver) 
 public  void setErrorHandler(ErrorHandler errorHandler) 
 public  void setFeature(String uri,
    boolean value) throws SAXNotSupportedException, SAXNotRecognizedException 
 public  void setNamespaceAware(boolean namespaceAware) 
    Enable and/or disable namspace handling.
 public  void setProperty(String uri,
    Object value) throws SAXNotSupportedException, SAXNotRecognizedException 
 public  void setTrimWhitespace(boolean trimWhitespace) 
    Sets the trim whitespace setting value.
 public  void skippedEntity(String name) throws SAXException 
 public  void startDocument() throws SAXException 
 public  void startElement(String namespaceURI,
    String localName,
    String qName,
    Attributes list) throws SAXException 
 public  void startPrefixMapping(String prefix,
    String namespaceURI) throws SAXException