## org.biojava.utils.xml
Class XMLPeerBuilder

    java.lang.Object
      org.biojava.utils.xml.XMLPeerBuilder

All Implemented Interfaces:
  org.xml.sax.DocumentHandler

public class XMLPeerBuilder
extends java.lang.Object
implements org.xml.sax.DocumentHandler

SAX DocumentHandler which uses an XMLPeerFactory to construct Java objects reflecting an XML document. The XMLPeerBuilder system takes a depth-first approach to constructing the Object tree. This means that, before attempting to construct an Object to represent a particular element, it first constructs Objects for all child elelments.

Currently, Text nodes are automatically converted to Java strings and treated as normal children. Treatment of Text may be configurable in a future release.

Author:
  Thomas Down

Constructor Summary
`XMLPeerBuilder(XMLPeerFactory f)` Construct a new XMLPeerBuilder, using the specified XMLPeerFactory

Method Summary
`void` `characters(char[] ch, int start, int len)`
`void` `endDocument()`
`void` `endElement(java.lang.String name)`
`java.lang.Object` `getTopLevelObject()` Once the XMLPeerBuilder has been used, return an Object which represents the whole document.
`void` `ignorableWhitespace(char[] ch, int start, int len)`
`void` `processingInstruction(java.lang.String target, java.lang.String data)`
`void` `setDocumentLocator(org.xml.sax.Locator l)`
`void` `startDocument()`
`void` `startElement(java.lang.String name, org.xml.sax.AttributeList al)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### XMLPeerBuilder

    public XMLPeerBuilder(XMLPeerFactory f)

  Construct a new XMLPeerBuilder, using the specified XMLPeerFactory

Method Detail

### getTopLevelObject

    public java.lang.Object getTopLevelObject()

  Once the XMLPeerBuilder has been used, return an Object which represents the whole document.

  Returns:
    an Object reflecting the document, or `null` if none is available.

### characters

    public void characters(char[] ch,
                           int start,
                           int len)

  Specified by:
    `characters` in interface `org.xml.sax.DocumentHandler`

### ignorableWhitespace

    public void ignorableWhitespace(char[] ch,
                                    int start,
                                    int len)

  Specified by:
    `ignorableWhitespace` in interface `org.xml.sax.DocumentHandler`

### startDocument

    public void startDocument()

  Specified by:
    `startDocument` in interface `org.xml.sax.DocumentHandler`

### setDocumentLocator

    public void setDocumentLocator(org.xml.sax.Locator l)

  Specified by:
    `setDocumentLocator` in interface `org.xml.sax.DocumentHandler`

### endDocument

    public void endDocument()

  Specified by:
    `endDocument` in interface `org.xml.sax.DocumentHandler`

### processingInstruction

    public void processingInstruction(java.lang.String target,
                                      java.lang.String data)

  Specified by:
    `processingInstruction` in interface `org.xml.sax.DocumentHandler`

### startElement

    public void startElement(java.lang.String name,
                             org.xml.sax.AttributeList al)

  Specified by:
    `startElement` in interface `org.xml.sax.DocumentHandler`

### endElement

    public void endElement(java.lang.String name)

  Specified by:
    `endElement` in interface `org.xml.sax.DocumentHandler`