|
Project JXTA | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.jxta.impl.document.TextElementCommon
net.jxta.impl.document.XMLElementCommon
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.
Nested Class Summary | |
protected static class |
LiteXMLElement.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 static boolean |
paranoidConsistencyChecking
If true then every operation which modifies the state of the document will perform a consistency check. |
protected Element |
parent
Identifies the element which is the parent of this element. |
protected static boolean |
verboseLogging
Causes additional logging while parsing. |
Constructor Summary | |
protected |
LiteXMLElement(LiteXMLDocument doc,
LiteXMLElement.tagRange loc)
Creates new LiteXMLElement |
|
LiteXMLElement(LiteXMLDocument doc,
String name,
String val)
Creates new LiteElement |
Method Summary | |
String |
addAttribute(Attribute newAttrib)
|
String |
addAttribute(String name,
String 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(TextElement element)
|
protected boolean |
checkConsistency()
|
protected StringBuffer |
decodeEscaped(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(StringBuffer target)
Given a StringBuffer find all occurances of characters which must be escaped and convert them to their escaped equivalents. |
boolean |
equals(Object element)
|
Attribute |
getAttribute(String name)
|
protected LiteXMLElement.tagRange |
getAttributeLoc(String name,
LiteXMLElement.charRange inRange)
Returns the tagRange of the next attribute contained in the range provided. |
Enumeration |
getAttributes()
Returns an enumerations of the attributes assosicated with this object. |
Enumeration |
getChildren()
|
Enumeration |
getChildren(String name)
|
(package private) LiteXMLDocument |
getDocument()
The document we are a part of. |
String |
getName()
|
Element |
getParent()
|
StructuredDocument |
getRoot()
|
protected LiteXMLElement.tagRange |
getTagRanges(StringBuffer source,
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. |
String |
getTextValue()
|
protected String |
getTextValue(boolean getEncoded,
boolean trim)
Get the value (if any) associated with an element. |
protected void |
printNice(Writer into,
int indent,
boolean recurse)
Write the contents of this element and optionally its children. |
String |
toString()
A toString implementation for debugging purposes. |
Methods inherited from class net.jxta.impl.document.TextElementCommon |
appendChild, getChildren, getKey, getValue |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface net.jxta.document.Element |
appendChild, getChildren, getKey, getValue |
Field Detail |
protected static final transient boolean paranoidConsistencyChecking
protected static final transient boolean verboseLogging
protected final transient LiteXMLDocument doc
protected transient 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 transient LiteXMLElement.tagRange loc
Constructor Detail |
protected LiteXMLElement(LiteXMLDocument doc, LiteXMLElement.tagRange loc)
loc
- The location of the element within the document.doc
- The LiteXMLDocument
which is the root of the document.public LiteXMLElement(LiteXMLDocument doc, String name, String val)
doc
- The LiteXMLDocument
which is the root of the document.name
- The name of the element being created.val
- The value of the element being created or null if there is no
content to the element.Method Detail |
public boolean equals(Object element)
public String toString()
public StructuredDocument getRoot()
public Element getParent()
public Enumeration getChildren()
public String getName()
public void appendChild(TextElement element)
public Enumeration getChildren(String name)
public String getTextValue()
protected String getTextValue(boolean getEncoded, boolean trim)
getEncoded
- if true then the contents will be encoded such that
the contents will not be interpreted as XML. see
W3C XML 1.0 Specification
ie. < -> < & -> &
protected void printNice(Writer into, int indent, boolean recurse) throws IOException
java.io.Writer
. The writing
can optionally be indented.
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.
IOException
protected LiteXMLElement.tagRange getTagRanges(StringBuffer source, 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 StringBuffer decodeEscaped(StringBuffer target)
target
- The stringbuffer which will be decoded.
protected void encodeEscaped(StringBuffer target)
target
- The stringbuffer which will be encoded in place.public Enumeration getAttributes()
protected LiteXMLElement.tagRange getAttributeLoc(String name, LiteXMLElement.charRange inRange)
name
- Name to match. null means match any name.inRange
- the limits of the locations to scan.
public String addAttribute(String name, String value)
public String addAttribute(Attribute newAttrib)
public Attribute getAttribute(String name)
protected boolean checkConsistency()
LiteXMLDocument getDocument()
|
JXTA J2SE | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |