|
Project JXTA | ||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.jxta.impl.document.TextElementCommon | +--net.jxta.impl.document.LiteXMLElement
An element of a StructuredDocument
. StructuredDocument
s
are made up of hierarchies of elements. LiteXMLElement is part of an implementation
while makes use of XML-style document conventions, but without the overhead of a
full parser.
Inner Class Summary | |
protected static class |
LiteXMLElement.charRange
A charRange defines a range of characters, probably within a string. |
protected static class |
LiteXMLElement.tagRange
A tagRange is a collection of char ranges useful for describing XML structures. |
Field Summary | |
protected LiteXMLDocument |
doc
The document associated with this Element. |
protected LiteXMLElement.tagRange |
loc
The portion of the source XML associated with this node |
protected net.jxta.document.Element |
parent
Identifies the element which is the parent of this element. |
Constructor Summary | |
protected |
LiteXMLElement(LiteXMLDocument doc,
LiteXMLElement.tagRange loc)
Creates new LiteXMLElement |
protected |
LiteXMLElement(LiteXMLDocument doc,
java.lang.String name)
Creates new LiteElement |
protected |
LiteXMLElement(LiteXMLDocument doc,
java.lang.String name,
java.lang.String val)
Creates new LiteElement |
Method Summary | |
java.lang.String |
addAttribute(net.jxta.document.Attribute newAttrib)
Adds an attribute with the given name and value. |
java.lang.String |
addAttribute(java.lang.String name,
java.lang.String value)
Adds an attribute with the given name and value. |
protected void |
addChildTags(LiteXMLElement.charRange scanRange,
LiteXMLElement addTo)
Parse a charRange and add any tags found as content as children of a specified element. |
protected void |
adjustLocations(int beginningAt,
int by)
For this element and all its children adjust the location of its ranges by the amount specified. |
void |
appendChild(net.jxta.document.TextElement element)
Add a child element to this element |
protected java.lang.StringBuffer |
decodeEscaped(java.lang.StringBuffer target)
Given a StringBuffer find all occurances of escaped characters which must be decoded and convert them back to their non-escaped equivalents. |
protected void |
encodeEscaped(java.lang.StringBuffer target)
Given a StringBuffer find all occurances of characters which must be escaped and convert them to their escaped equivalents. |
boolean |
equals(java.lang.Object element)
Tests two elements for equality. |
protected void |
finalize()
|
net.jxta.document.Attribute |
getAttribute(java.lang.String name)
Returns a single attribute which matches the name provided. |
java.util.Enumeration |
getAttributes()
Returns an enumerations of the attributes assosicated with this object. |
java.util.Enumeration |
getChildren()
Returns an enumeration of the immediate children of this element |
java.util.Enumeration |
getChildren(java.lang.String name)
Returns an enumeration of the immediate children of this element whose name match the specified string. |
java.lang.String |
getName()
Returns the name associated with this element. |
net.jxta.document.Element |
getParent()
Get the parent of this element. |
net.jxta.document.StructuredDocument |
getRoot()
Get the root element of the hierarchy this element belongs to. |
protected LiteXMLElement.tagRange |
getTagRanges(java.lang.String source,
java.lang.String tag,
LiteXMLElement.charRange range)
Given a source string, an optional tag and a range with in the source find either the tag specified or the next tag. |
java.lang.String |
getTextValue()
Get the value (if any) associated with an element. |
protected java.lang.String |
getTextValue(boolean getEncoded)
Get the value (if any) associated with an element. |
protected void |
printNice(java.io.Writer into,
int indent,
boolean recurse)
Write the contents of this element and optionally its children. |
Methods inherited from class net.jxta.impl.document.TextElementCommon |
appendChild,
getChildren,
getKey,
getValue |
Methods inherited from class java.lang.Object |
clone,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected LiteXMLDocument doc
protected net.jxta.document.Element parent
this.parent == this
then this element is the root of the document.
If null == parent
then this element has not yet been
inserted into the document.protected LiteXMLElement.tagRange loc
Constructor Detail |
protected LiteXMLElement(LiteXMLDocument doc, java.lang.String name)
doc
- The LiteXMLDocument
which is associated with this element.name
- The name of the element being created.protected LiteXMLElement(LiteXMLDocument doc, java.lang.String name, java.lang.String val)
doc
- The LiteXMLDocument
which is associated with this element.name
- The name of the element being created.val
- The value of the element being created.protected LiteXMLElement(LiteXMLDocument doc, LiteXMLElement.tagRange loc)
loc
- The location of the element within the document.doc
- The LiteXMLDocument
which is associated with this element.Method Detail |
public boolean equals(java.lang.Object element)
element
- the element to be compared against.protected void finalize() throws java.lang.Throwable
public net.jxta.document.StructuredDocument getRoot()
public net.jxta.document.Element getParent()
public java.util.Enumeration getChildren()
public java.lang.String getName()
public java.lang.String getTextValue()
public void appendChild(net.jxta.document.TextElement element)
element
- the element to be added as a childpublic java.util.Enumeration getChildren(java.lang.String name)
name
- The name which will be matched against.protected java.lang.String getTextValue(boolean getEncoded)
getEncoded
- if true then the contents will be encoded such that
the contents will not be interpreted as XML. see
ie. < -> < & -> &protected void printNice(java.io.Writer into, int indent, boolean recurse)
into
- The java.io.Writer that the output will be sent to.indent
- the number of tabs which will be inserted before each
line.recurse
- if true then also print the children of this element.protected LiteXMLElement.tagRange getTagRanges(java.lang.String source, java.lang.String tag, LiteXMLElement.charRange range)
source
- the string to searchtag
- the tag to search for in the source string. If this tag is
empty or null then we will search for the next tag.range
- describes the range of character locations in the source
string to which the search will be limited.protected void addChildTags(LiteXMLElement.charRange scanRange, LiteXMLElement addTo)
scanRange
- the range to be parsed for sub-tagsaddTo
- the element to add any discovered children to.protected void adjustLocations(int beginningAt, int by)
beginningAt
- adjust all locations which are at or past this
location.by
- amount to adjust all matching locations.protected java.lang.StringBuffer decodeEscaped(java.lang.StringBuffer target)
target
- The stringbuffer which will be decoded.protected void encodeEscaped(java.lang.StringBuffer target)
target
- The stringbuffer which will be encoded in place.public java.util.Enumeration getAttributes()
public java.lang.String addAttribute(java.lang.String name, java.lang.String value)
name
- name of the attribute.value
- value for the attribute.public java.lang.String addAttribute(net.jxta.document.Attribute newAttrib)
newAttrib
- new attribute.public net.jxta.document.Attribute getAttribute(java.lang.String name)
|
Project JXTA | ||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |