org.codehaus.groovy.sandbox.util
Class XmlSlurper

java.lang.Object
  extended byorg.xml.sax.helpers.DefaultHandler
      extended byorg.codehaus.groovy.sandbox.util.XmlSlurper
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class XmlSlurper
extends org.xml.sax.helpers.DefaultHandler


Field Summary
private  java.util.List body
           
private  java.lang.StringBuffer charBuffer
           
private  org.xml.sax.XMLReader reader
           
private  java.util.List result
           
 
Constructor Summary
XmlSlurper()
           
XmlSlurper(boolean validating, boolean namespaceAware)
           
XmlSlurper(javax.xml.parsers.SAXParser parser)
           
XmlSlurper(org.xml.sax.XMLReader reader)
           
 
Method Summary
private  void addNonWhitespaceCdata()
           
 void characters(char[] ch, int start, int length)
           
 void endDocument()
           
 void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)
           
 XmlList parse(java.io.File file)
          Parses the content of the given file as XML turning it into a List
 XmlList parse(org.xml.sax.InputSource input)
          Parse the content of the specified input source into a List
 XmlList parse(java.io.InputStream input)
          Parse the content of the specified input stream into a List.
 XmlList parse(java.io.Reader in)
          Parse the content of the specified reader into a List.
 XmlList parse(java.lang.String uri)
          Parse the content of the specified URI into a List
 XmlList parseText(java.lang.String text)
          A helper method to parse the given text as XML
 void startDocument()
           
 void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)
           
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

reader

private final org.xml.sax.XMLReader reader

result

private java.util.List result

body

private java.util.List body

charBuffer

private final java.lang.StringBuffer charBuffer
Constructor Detail

XmlSlurper

public XmlSlurper()
           throws javax.xml.parsers.ParserConfigurationException,
                  org.xml.sax.SAXException

XmlSlurper

public XmlSlurper(boolean validating,
                  boolean namespaceAware)
           throws javax.xml.parsers.ParserConfigurationException,
                  org.xml.sax.SAXException

XmlSlurper

public XmlSlurper(org.xml.sax.XMLReader reader)

XmlSlurper

public XmlSlurper(javax.xml.parsers.SAXParser parser)
           throws org.xml.sax.SAXException
Method Detail

parse

public XmlList parse(org.xml.sax.InputSource input)
              throws java.io.IOException,
                     org.xml.sax.SAXException
Parse the content of the specified input source into a List

Throws:
java.io.IOException
org.xml.sax.SAXException

parse

public XmlList parse(java.io.File file)
              throws java.io.IOException,
                     org.xml.sax.SAXException
Parses the content of the given file as XML turning it into a List

Throws:
java.io.IOException
org.xml.sax.SAXException

parse

public XmlList parse(java.io.InputStream input)
              throws java.io.IOException,
                     org.xml.sax.SAXException
Parse the content of the specified input stream into a List. Note that using this method will not provide the parser with any URI for which to find DTDs etc

Throws:
java.io.IOException
org.xml.sax.SAXException

parse

public XmlList parse(java.io.Reader in)
              throws java.io.IOException,
                     org.xml.sax.SAXException
Parse the content of the specified reader into a List. Note that using this method will not provide the parser with any URI for which to find DTDs etc

Throws:
java.io.IOException
org.xml.sax.SAXException

parse

public XmlList parse(java.lang.String uri)
              throws java.io.IOException,
                     org.xml.sax.SAXException
Parse the content of the specified URI into a List

Throws:
java.io.IOException
org.xml.sax.SAXException

parseText

public XmlList parseText(java.lang.String text)
                  throws java.io.IOException,
                         org.xml.sax.SAXException
A helper method to parse the given text as XML

Parameters:
text -
Returns:
Throws:
java.io.IOException
org.xml.sax.SAXException

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

startElement

public void startElement(java.lang.String namespaceURI,
                         java.lang.String localName,
                         java.lang.String qName,
                         org.xml.sax.Attributes atts)
                  throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

endElement

public void endElement(java.lang.String namespaceURI,
                       java.lang.String localName,
                       java.lang.String qName)
                throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

endDocument

public void endDocument()
                 throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

addNonWhitespaceCdata

private void addNonWhitespaceCdata()


Copyright © 2003-2005 The Codehaus. All Rights Reserved.