|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.simonstl.fragment.DocComponent | +--com.simonstl.fragment.Element
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 more support for attributes, and also for wildcard matching on nsURI and/or localName.
Version 0.11 fixed a bug in addComponent()
that kept attribute rules from functioning.
Version 0.10 adds improved printing support.
Version 0.09 supports the cleanDuplicate() method to avoid shallow copying issues.
Version 0.08 allows Elements to store parent and child information for the recording phase.
Version 0.07 adds additional support for attributes through the attColl AttributeCollection, replacing the AttributesImpl I'd used before. It's more overhead, but it gives me much finer-grained control over attributes.
Version 0.06 extends DocComponent rather than trying to handle all cases itself.
Version 0.05 adds support for beforeInside
and afterInside
attributes,
allowing rules to add content inside of the element they create.
Version 0.04 changed support for skipping, allowing for the chars
element to operate when character output is desired. It also now calls the startChars()
and endChars() methods of FragmentFilter
to
give these characters their own place in the stack. Finally, it now supports
before
and after
content.
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.)
Fields inherited from class com.simonstl.fragment.DocComponent |
after, before, content, localName, nsURI, parentElement, prefix, type |
Constructor Summary | |
protected |
Element()
|
|
Element(Element oldElement)
|
|
Element(java.lang.String _nsURI,
java.lang.String _localName)
|
|
Element(java.lang.String _nsURI,
java.lang.String _localName,
java.lang.String _prefix)
|
|
Element(java.lang.String _nsURI,
java.lang.String _localName,
java.lang.String _prefix,
org.xml.sax.Attributes _atts)
|
|
Element(java.lang.String _nsURI,
java.lang.String _localName,
java.lang.String _prefix,
java.lang.String _content)
|
Method Summary | |
void |
addAtt(Attribute newAtt)
|
void |
addContent(DocComponent newComponent)
Adds content to this component. |
DocComponent |
cleanDuplicate()
Returns a clean copy of the component and its contents. |
void |
clearContent()
Clears the content for this component. |
void |
eventComponent(FragmentFilter handler)
Describes the content for this component as a series of SAX events. |
java.lang.String |
getAfterInside()
|
org.xml.sax.Attributes |
getAtts()
|
java.lang.String |
getBeforeInside()
|
java.lang.String |
getContent()
Returns the content for this component. |
java.lang.String |
getKey()
Returns a key which can be used as a unique identifier for this component. |
boolean |
matchComponent(DocComponent compare)
|
boolean |
matchComponent(java.lang.String match)
Takes a string representing a component description and returns true or false to indicate whether or not it matches this component. |
void |
print()
Prints a representation of the component to STDOUT |
void |
processComponentContent(FragmentRules rules)
Supports processing of content, if any. |
void |
setAfterInside(java.lang.String newAfterInside)
|
void |
setAtts(org.xml.sax.Attributes newAtts)
|
void |
setBeforeInside(java.lang.String newBeforeInside)
|
void |
setContent(java.lang.String _content)
Sets the content for this component. |
java.lang.String |
toString()
Returns a representation of the component as a String. |
Methods inherited from class com.simonstl.fragment.DocComponent |
getAfter, getBefore, getLocalName, getNsURI, getParentElement, getPrefix, getType, matchAll, matchComponent, matchElement, matchSingleton, setAfter, setBefore, setLocalName, setNsURI, setParentElement, setPrefix, setType |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Element(java.lang.String _nsURI, java.lang.String _localName)
public Element(java.lang.String _nsURI, java.lang.String _localName, java.lang.String _prefix)
public Element(java.lang.String _nsURI, java.lang.String _localName, java.lang.String _prefix, org.xml.sax.Attributes _atts)
public Element(java.lang.String _nsURI, java.lang.String _localName, java.lang.String _prefix, java.lang.String _content)
protected Element()
public Element(Element oldElement)
Method Detail |
public DocComponent cleanDuplicate()
DocComponent
cleanDuplicate
in class DocComponent
public boolean matchComponent(DocComponent compare)
public boolean matchComponent(java.lang.String match)
DocComponent
matchComponent
in class DocComponent
public java.lang.String getKey()
DocComponent
getKey
in class DocComponent
public void setAtts(org.xml.sax.Attributes newAtts)
public void addAtt(Attribute newAtt)
public org.xml.sax.Attributes getAtts()
public void setBeforeInside(java.lang.String newBeforeInside)
public java.lang.String getBeforeInside()
public void setAfterInside(java.lang.String newAfterInside)
public java.lang.String getAfterInside()
public void setContent(java.lang.String _content)
setContent
in class DocComponent
public java.lang.String getContent()
getContent
in class DocComponent
public void clearContent()
clearContent
in class DocComponent
public void addContent(DocComponent newComponent)
addContent
in class DocComponent
public void eventComponent(FragmentFilter handler) throws org.xml.sax.SAXException
DocComponent
FragmentFilter
supports some events (startChars and endChars) which
are extensions to the existing SAX models and which serve to keep the stacks under control.eventComponent
in class DocComponent
public void processComponentContent(FragmentRules rules)
DocComponent
processComponentContent
in class DocComponent
public void print()
DocComponent
print
in class DocComponent
public java.lang.String toString()
DocComponent
toString
in class DocComponent
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |