## groovy.util
Class XmlSlurper

author:
  John Wilson

Field Summary
`StringBuffer` | `charBuffer`
`Node` | `currentNode`
`boolean` | `keepWhitespace`
`Map` | `namespaceTagHints`
`XMLReader` | `reader`
`Stack` | `stack`

Constructor Summary
`XmlSlurper()`
`XmlSlurper(boolean validating, boolean namespaceAware)`
`XmlSlurper(XMLReader reader)`
`XmlSlurper(SAXParser parser)`

Method Summary
`void` | `addCdata()`
`void` | `characters(def ch, int start, int length)`
`void` | `endDocument()`
`void` | `endElement(String namespaceURI, String localName, String qName)`
`DTDHandler` | `getDTDHandler()`
`GPathResult` | `getDocument()` Note if one of the parse methods has been called then this returns null Note if this is called more than once all calls after the first will return null
`EntityResolver` | `getEntityResolver()`
`ErrorHandler` | `getErrorHandler()`
`boolean` | `getFeature(String uri)`
`Object` | `getProperty(String uri)`
`GPathResult` | `parse(InputSource input)` Parse the content of the specified input source into a GPathResult object
`GPathResult` | `parse(File file)` Parses the content of the given file as XML turning it into a GPathResult object
`GPathResult` | `parse(InputStream input)` Parse the content of the specified input stream into an GPathResult Object.
`GPathResult` | `parse(Reader in)` Parse the content of the specified reader into a GPathResult Object.
`GPathResult` | `parse(String uri)` Parse the content of the specified URI into a GPathResult Object
`GPathResult` | `parseText(String text)` A helper method to parse the given text as XML
`void` | `setDTDHandler(DTDHandler dtdHandler)`
`void` | `setEntityBaseUrl(URL base)` Resolves entities against using the suppied URL as the base for relative URLs The URL used to resolve relative URLs
`void` | `setEntityResolver(EntityResolver entityResolver)`
`void` | `setErrorHandler(ErrorHandler errorHandler)`
`void` | `setFeature(String uri, boolean value)`
`void` | `setKeepWhitespace(boolean keepWhitespace)` If true then whitespace before elements is kept.
`void` | `setProperty(String uri, Object value)`
`void` | `startDocument()`
`void` | `startElement(String namespaceURI, String localName, String qName, Attributes atts)`
`void` | `startPrefixMapping(String tag, String uri)`

Constructor Detail

### XmlSlurper

    public XmlSlurper()

### XmlSlurper

    public XmlSlurper(boolean validating, boolean namespaceAware)

### XmlSlurper

    public XmlSlurper(XMLReader reader)

### XmlSlurper

    public XmlSlurper(SAXParser parser)

Method Detail

### addCdata

    void addCdata()

### characters

    public void characters(def ch, int start, int length)

### endDocument

    public void endDocument()

### endElement

    public void endElement(String namespaceURI, String localName, String qName)

### getDTDHandler

    public DTDHandler getDTDHandler()

### getDocument

    public GPathResult getDocument()

  return:
    The GPathResult instance created by consuming a stream of SAX events
  Note if one of the parse methods has been called then this returns null Note if this is called more than once all calls after the first will return null

### getEntityResolver

    public EntityResolver getEntityResolver()

### getErrorHandler

    public ErrorHandler getErrorHandler()

### getFeature

    public boolean getFeature(String uri)

### getProperty

    public Object getProperty(String uri)

### parse

    public GPathResult parse(InputSource input)

  Parse the content of the specified input source into a GPathResult object
  param:
    input
  return:
    An object which supports GPath expressions
  throws:
    IOException
  throws:
    SAXException

### parse

    public GPathResult parse(File file)

  Parses the content of the given file as XML turning it into a GPathResult object
  param:
    file
  return:
    An object which supports GPath expressions
  throws:
    IOException
  throws:
    SAXException

### parse

    public GPathResult parse(InputStream input)

  Parse the content of the specified input stream into an GPathResult Object. Note that using this method will not provide the parser with any URI for which to find DTDs etc
  param:
    input
  return:
    An object which supports GPath expressions
  throws:
    IOException
  throws:
    SAXException

### parse

    public GPathResult parse(Reader in)

  Parse the content of the specified reader into a GPathResult Object. Note that using this method will not provide the parser with any URI for which to find DTDs etc
  param:
    in
  return:
    An object which supports GPath expressions
  throws:
    IOException
  throws:
    SAXException

### parse

    public GPathResult parse(String uri)

  Parse the content of the specified URI into a GPathResult Object
  param:
    uri
  return:
    An object which supports GPath expressions
  throws:
    IOException
  throws:
    SAXException

### parseText

    public GPathResult parseText(String text)

  A helper method to parse the given text as XML
  param:
    text
  return:
    An object which supports GPath expressions

### setDTDHandler

    public void setDTDHandler(DTDHandler dtdHandler)

### setEntityBaseUrl

    public void setEntityBaseUrl(URL base)

  Resolves entities against using the suppied URL as the base for relative URLs
  param:
    base
  The URL used to resolve relative URLs

### setEntityResolver

    public void setEntityResolver(EntityResolver entityResolver)

### setErrorHandler

    public void setErrorHandler(ErrorHandler errorHandler)

### setFeature

    public void setFeature(String uri, boolean value)

### setKeepWhitespace

    public void setKeepWhitespace(boolean keepWhitespace)

  param:
    keepWhitespace
  If true then whitespace before elements is kept. The deafult is to discard the whitespace.

### setProperty

    public void setProperty(String uri, Object value)

### startDocument

    public void startDocument()

### startElement

    public void startElement(String namespaceURI, String localName, String qName, Attributes atts)

### startPrefixMapping

    public void startPrefixMapping(String tag, String uri)