Purple Code

com.purpletech.xml
Class XMLEntryList

java.lang.Object
  |
  +--java.util.AbstractCollection
        |
        +--java.util.AbstractList
              |
              +--java.util.ArrayList
                    |
                    +--com.purpletech.util.EntryList
                          |
                          +--com.purpletech.xml.XMLEntryList
All Implemented Interfaces:
java.lang.Cloneable, java.util.Collection, org.xbeans.DOMListener, org.xbeans.DOMSource, java.util.EventListener, java.util.List, java.util.RandomAccess, java.io.Serializable, XMLPrinter

public class XMLEntryList
extends EntryList
implements org.xbeans.DOMListener, org.xbeans.DOMSource, XMLPrinter

An EntryList that can parse a DOM node to set its values.

Contiguous text nodes in the tree get concatenated, and stored as an entry named "#text". It has complicated rules for parsing text nodes, but they do what you'd expect them to do in most cases.

Supports XBeans events.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class com.purpletech.util.EntryList
EntryList.Entry
 
Field Summary
protected  java.util.List attributes
           
protected static XMLEntryListFactory defaultfactory
           
protected  org.xbeans.DOMListener DOMListener
           
protected  XMLEntryListFactory factory
           
protected  java.lang.String listName
           
protected  org.w3c.dom.Node node
           
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
XMLEntryList()
           
XMLEntryList(org.w3c.dom.Node node)
           
XMLEntryList(java.lang.String listName, XMLEntryListFactory factory)
           
XMLEntryList(java.lang.String listName, XMLEntryListFactory factory, org.w3c.dom.Node node)
           
 
Method Summary
 void documentReady(org.xbeans.DOMEvent evt)
           
 java.lang.String flatten()
          return a single string representing all sub-elements, including tags
 java.lang.Object get(java.lang.Object key)
          Get the first value corresponding to the given key
 org.xbeans.DOMListener getDOMListener()
           
protected  XMLEntryListFactory getFactory()
           
 java.lang.String getListName()
           
 org.w3c.dom.Node getNode()
           
static void main(java.lang.String[] args)
           
protected  void parseNode()
           
 XMLEntryList parseNode(org.w3c.dom.Node node)
          returns this, so you can say "new XMLEntryList().parseNode(node)"
protected  void printCloseTag(java.io.PrintWriter out, java.lang.String tag)
           
protected  void printElement(java.io.PrintWriter out, int indent, java.util.Map.Entry entry)
           
 void printElements(java.io.PrintWriter out, int indent)
           
protected  void printOpenTag(java.io.PrintWriter out, java.lang.String tag, java.util.List attributes)
           
 void printXml(java.io.PrintStream out)
           
 void printXML(java.io.PrintStream out)
           
 void printXml(java.io.PrintWriter out, int indent)
           
 void printXML(java.io.PrintWriter out, int indent)
          If it has a name, then it'll print itself as an XML element, including tag name and attributes.
 void setAttribute(java.lang.String attname)
           
 void setDOMListener(org.xbeans.DOMListener newDomListener)
           
 void setFactory(XMLEntryListFactory factory)
           
 void setListName(java.lang.String listName)
           
 void setNode(org.w3c.dom.Node node)
          does NOT parse -- must call parseNode() immediately
 void squoosh()
          Squoosh all text children.
 java.lang.String toString()
           
 
Methods inherited from class com.purpletech.util.EntryList
add, addAll, addPropertyChangeListener, fix, getAll, getAllEntries, getDate, getEntry, getEntry, printXml, put, remove, removeEntries, removePropertyChangeListener, set, set
 
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, removeRange, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, remove, removeAll, retainAll
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, remove, removeAll, retainAll, subList
 

Field Detail

defaultfactory

protected static XMLEntryListFactory defaultfactory

attributes

protected java.util.List attributes

listName

protected java.lang.String listName

factory

protected XMLEntryListFactory factory

node

protected org.w3c.dom.Node node

DOMListener

protected org.xbeans.DOMListener DOMListener
Constructor Detail

XMLEntryList

public XMLEntryList()

XMLEntryList

public XMLEntryList(org.w3c.dom.Node node)
             throws XMLException

XMLEntryList

public XMLEntryList(java.lang.String listName,
                    XMLEntryListFactory factory)

XMLEntryList

public XMLEntryList(java.lang.String listName,
                    XMLEntryListFactory factory,
                    org.w3c.dom.Node node)
             throws XMLException
Method Detail

get

public java.lang.Object get(java.lang.Object key)
Description copied from class: EntryList
Get the first value corresponding to the given key

Overrides:
get in class EntryList

parseNode

protected void parseNode()
                  throws XMLException
XMLException

setFactory

public void setFactory(XMLEntryListFactory factory)

getFactory

protected XMLEntryListFactory getFactory()

setAttribute

public void setAttribute(java.lang.String attname)

setListName

public void setListName(java.lang.String listName)

getListName

public java.lang.String getListName()

setNode

public void setNode(org.w3c.dom.Node node)
does NOT parse -- must call parseNode() immediately


parseNode

public XMLEntryList parseNode(org.w3c.dom.Node node)
                       throws XMLException
returns this, so you can say "new XMLEntryList().parseNode(node)"

XMLException

getNode

public org.w3c.dom.Node getNode()

printXml

public void printXml(java.io.PrintStream out)

printXML

public void printXML(java.io.PrintStream out)

printXml

public void printXml(java.io.PrintWriter out,
                     int indent)
Overrides:
printXml in class EntryList

printXML

public void printXML(java.io.PrintWriter out,
                     int indent)
If it has a name, then it'll print itself as an XML element, including tag name and attributes. If its name is null, then it just prints its elements.

Specified by:
printXML in interface XMLPrinter

printElements

public void printElements(java.io.PrintWriter out,
                          int indent)

printElement

protected void printElement(java.io.PrintWriter out,
                            int indent,
                            java.util.Map.Entry entry)

printOpenTag

protected void printOpenTag(java.io.PrintWriter out,
                            java.lang.String tag,
                            java.util.List attributes)

printCloseTag

protected void printCloseTag(java.io.PrintWriter out,
                             java.lang.String tag)

flatten

public java.lang.String flatten()
return a single string representing all sub-elements, including tags


squoosh

public void squoosh()
Squoosh all text children. Turns strings of all-whitespace nodes into nothing. That is,
 "#text" = ""
 "b" = [some other object]
 "#text" = ""
 "#text" = "yo mama"
 "#text" = ""
 
turns into
 "b" = [some other object]
 "#text" = "yo mama"
 


setDOMListener

public void setDOMListener(org.xbeans.DOMListener newDomListener)
Specified by:
setDOMListener in interface org.xbeans.DOMSource

getDOMListener

public org.xbeans.DOMListener getDOMListener()
Specified by:
getDOMListener in interface org.xbeans.DOMSource

documentReady

public void documentReady(org.xbeans.DOMEvent evt)
                   throws org.xbeans.XbeansException
Specified by:
documentReady in interface org.xbeans.DOMListener
org.xbeans.XbeansException

toString

public java.lang.String toString()
Overrides:
toString in class EntryList

main

public static void main(java.lang.String[] args)

Documentation generated March 5 2003