net.jxta.impl.document
Class LiteXMLElement
java.lang.Object
|
+--net.jxta.impl.document.TextElementCommon
|
+--net.jxta.impl.document.LiteXMLElement
- Direct Known Subclasses:
- LiteXMLDocument
- public class LiteXMLElement
- extends TextElementCommon
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.
- Since:
- Jxta 0.1
Methods inherited from class java.lang.Object |
clone,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
doc
protected LiteXMLDocument doc
- The document associated with this Element.
parent
protected net.jxta.document.Element parent
loc
protected LiteXMLElement.tagRange loc
- The portion of the source XML associated with this node
LiteXMLElement
protected LiteXMLElement(LiteXMLDocument doc,
java.lang.String name)
- Creates new LiteElement
- Parameters:
doc
- The LiteXMLDocument
which is associated with this element.name
- The name of the element being created.
LiteXMLElement
protected LiteXMLElement(LiteXMLDocument doc,
java.lang.String name,
java.lang.String val)
- Creates new LiteElement
- Parameters:
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.
LiteXMLElement
protected LiteXMLElement(LiteXMLDocument doc,
LiteXMLElement.tagRange loc)
- Creates new LiteXMLElement
- Parameters:
loc
- The location of the element within the document.doc
- The LiteXMLDocument
which is associated with this element.
getName
public java.lang.String getName()
- Returns the name associated with this element.
- Returns:
- the name associated with this Element
getTextValue
public java.lang.String getTextValue()
getParent
public net.jxta.document.Element getParent()
appendChild
public void appendChild(net.jxta.document.TextElement element)
- Parameters:
element
-
getChildren
public java.util.Enumeration getChildren()
getChildren
public java.util.Enumeration getChildren(java.lang.String name)
equals
public boolean equals(java.lang.Object element)
- Tests two elements for equality.
- Overrides:
- equals in class java.lang.Object
- Parameters:
element
- the element to be compared against.- Returns:
- true if the elements are equal (by whatever definition of
equality is appropriate) otherwise false
printNice
protected void printNice(java.io.Writer into,
int indent,
boolean recurse)
getTagRanges
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.
The search consists of 4 phases :
0. If no tag was specified, determine if a tag can be found and
learn its name.
1. Search for the start of the named tag.
2. Search for the end tag. Each time we think we have found a tag
which might be the end tag we make sure it is not the end tag
of another element with the same name as our tag.
3. Calculate the position of the body of the tag given the locations
of the start and end.
- Parameters:
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.
addChildTags
protected void addChildTags(LiteXMLElement.charRange scanRange,
LiteXMLElement addTo)
adjustLocations
protected void adjustLocations(int beginingAt,
int by)
decodeEscaped
protected java.lang.StringBuffer decodeEscaped(java.lang.StringBuffer target)
encodeEscaped
protected void encodeEscaped(java.lang.StringBuffer target)