org.progeeks.util.xml
Class SimpleXmlReader

java.lang.Object
  extended by org.progeeks.util.xml.XmlReader
      extended by org.progeeks.util.xml.SimpleXmlReader

public class SimpleXmlReader
extends XmlReader

Reads any XML document into a simple Collections based set of data structures. No attempt as made at interpretation except to consolidate structures by name. All read data is left as strings.

Version:
$Revision: 1.2 $
Author:
Paul Speed

Nested Class Summary
protected  class SimpleXmlReader.SimpleTagReader
          Handler that will dynamically deal with all of the different tags.
 
Nested classes/interfaces inherited from class org.progeeks.util.xml.XmlReader
XmlReader.XmlHandler
 
Constructor Summary
SimpleXmlReader()
          Creates a SimpleXmlReader that will read an object from an XML file and load it into Maps and Lists.
 
Method Summary
 boolean isIgnoreAttributes()
           
static void main(java.lang.String[] args)
           
static void printValue(java.lang.String indent, java.lang.String name, java.lang.Object value)
           
 java.lang.Object readObject(org.w3c.dom.Document in)
          Reads the XML from a DOM tree as an object and returns it.
 java.lang.Object readObject(org.w3c.dom.Document in, javax.xml.transform.Transformer transformer)
          Reads the XML from a DOM tree as object, applying the given transformation.
 java.lang.Object readObject(java.io.Reader in)
          Reads the XML as an object and returns it.
protected  void reset()
          Resets the internal data structures before reading another object.
 void setIgnoreAttributes(boolean ignoreAttributes)
           
 
Methods inherited from class org.progeeks.util.xml.XmlReader
addTagText, createXmlException, createXmlException, endTag, getAttributesAsMap, getCurrentObject, getDocumentLocator, getIgnoreTagCase, getLocation, getPreviousObject, getRootObject, getStackSize, getTagReader, readXml, readXml, readXml, registerHandler, replaceCurrentObject, resolveEntity, setDefaultHandler, setIgnoreTagCase, startTag
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleXmlReader

public SimpleXmlReader()
Creates a SimpleXmlReader that will read an object from an XML file and load it into Maps and Lists.

Method Detail

readObject

public java.lang.Object readObject(java.io.Reader in)
                            throws java.io.IOException
Reads the XML as an object and returns it.

Overrides:
readObject in class XmlReader
Throws:
java.io.IOException

readObject

public java.lang.Object readObject(org.w3c.dom.Document in)
                            throws XmlException
Reads the XML from a DOM tree as an object and returns it.

Throws:
XmlException

readObject

public java.lang.Object readObject(org.w3c.dom.Document in,
                                   javax.xml.transform.Transformer transformer)
                            throws XmlException
Reads the XML from a DOM tree as object, applying the given transformation.

Throws:
XmlException

isIgnoreAttributes

public boolean isIgnoreAttributes()

setIgnoreAttributes

public void setIgnoreAttributes(boolean ignoreAttributes)

reset

protected void reset()
Resets the internal data structures before reading another object. This is called by readObject().

Overrides:
reset in class XmlReader

printValue

public static void printValue(java.lang.String indent,
                              java.lang.String name,
                              java.lang.Object value)

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception


Copyright © 2002-2003 Paul Speed. All Rights Reserved.