com.simonstl.fragment
Class Element

java.lang.Object
  |
  +--com.simonstl.fragment.Element

public class Element
extends java.lang.Object

The Element class stores information about elements (and perhaps someday attributes) in a format that supports namespaces, allows the preservation of prefix information, and supports matching on namespace URIs and localNames.

I may eventually add support for attributes, and also for wildcard matching on nsURI and/or localName.

Version 0.03 added properties for content and attributes. It also added the eventElement() method, which allows Element objects to write out their own SAX events. This should make it easier to manage configuration in the future.

version 0.02 added the getKey() method, so that Elements could define their own keys. This should permit future versions to support more complex matching than just nsURI>localName. (Making that work will involve revisions to matchElement (String match) as well.)


Field Summary
 org.xml.sax.helpers.AttributesImpl atts
           
 java.lang.String content
           
 java.lang.String localName
           
 java.lang.String nsURI
           
 java.lang.String prefix
           
 
Constructor Summary
Element(Element oldElement)
           
Element(java.lang.String newNsURI, java.lang.String newLocalName)
           
Element(java.lang.String newNsURI, java.lang.String newLocalName, java.lang.String newPrefix)
           
Element(java.lang.String newNsURI, java.lang.String newLocalName, java.lang.String newPrefix, java.lang.String newContent)
           
 
Method Summary
 void eventElement(org.xml.sax.helpers.XMLFilterImpl handler)
           
 org.xml.sax.helpers.AttributesImpl getAtts()
           
 java.lang.String getContent()
           
 java.lang.String getKey()
           
 boolean matchElement(java.lang.String match)
           
 void print()
           
 void setAtts(org.xml.sax.helpers.AttributesImpl newAtts)
           
 void setContent(java.lang.String newContent)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

nsURI

public java.lang.String nsURI

localName

public java.lang.String localName

prefix

public java.lang.String prefix

atts

public org.xml.sax.helpers.AttributesImpl atts

content

public java.lang.String content
Constructor Detail

Element

public Element(java.lang.String newNsURI,
               java.lang.String newLocalName)

Element

public Element(java.lang.String newNsURI,
               java.lang.String newLocalName,
               java.lang.String newPrefix)

Element

public Element(java.lang.String newNsURI,
               java.lang.String newLocalName,
               java.lang.String newPrefix,
               java.lang.String newContent)

Element

public Element(Element oldElement)
Method Detail

matchElement

public boolean matchElement(java.lang.String match)

getKey

public java.lang.String getKey()

setAtts

public void setAtts(org.xml.sax.helpers.AttributesImpl newAtts)

getAtts

public org.xml.sax.helpers.AttributesImpl getAtts()

setContent

public void setContent(java.lang.String newContent)

getContent

public java.lang.String getContent()

eventElement

public void eventElement(org.xml.sax.helpers.XMLFilterImpl handler)
                  throws org.xml.sax.SAXException

print

public void print()

toString

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