|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuxparser.XContent
uxparser.XElem
public class XElem
XElem models a XML Element construct.
Constructor Summary | |
---|---|
XElem()
Convenience for XElem(null, "unnamed") . |
|
XElem(java.lang.String name)
Convenience for XElem(null, name) . |
|
XElem(java.lang.String nsPrefix,
java.lang.String nsUri,
java.lang.String name)
Create a new element and define a new namespace attribute for the element using the specified prefix and uri. |
|
XElem(XNs ns,
java.lang.String name)
Create a new element with the specified namespace and local name. |
Method Summary | |
---|---|
XElem |
addAttr(java.lang.String name,
java.lang.String value)
Add the specified attribute name value pair using the null namespace. |
XElem |
addAttr(XNs ns,
java.lang.String name,
java.lang.String value)
Add the specified attribute name value pair. |
XElem |
addContent(int index,
XContent child)
Insert the content instance as a child of this element at the specified index. |
XElem |
addContent(XContent child)
Add the specified content to the end of the content list. |
XElem |
addText(java.lang.String txt)
Creates and adds a text descendent. |
int |
attrIndex(java.lang.String name)
Get the index of the first attribute with the specified name not in an explicit namespace. |
int |
attrIndex(XNs ns,
java.lang.String name)
Get the index of the first attribute with the specified namespace and local name or return -1 if no match. |
java.lang.String |
attrName(int index)
Get the attribute name for the specified index. |
XNs |
attrNs(int index)
Get the attribute namespace for the specified index. |
int |
attrSize()
Get the number of attributes in this element. |
java.lang.String |
attrValue(int index)
Get the attribute value for the specified index. |
void |
clearAttr()
Clear the attribute list to a count of 0. |
void |
clearContent()
Get the content children and set content count to 0. |
XContent[] |
content()
Get the array of XContent children for this element. |
XContent |
content(int index)
Get the XContent child at the specified index. |
int |
contentIndex(XContent child)
Get the index of the specified content instance (using == operator) or return -1 if the specified content is not a child of this element. |
int |
contentSize()
Get the number of XContent children of this element. |
XElem |
copy()
Make a new cloned copy of this XElem instance. |
XNs |
defineDefaultNs(java.lang.String uri)
Define the default namespace for this element and add the "xmlns" attribute. |
XNs |
defineNs(java.lang.String prefix,
java.lang.String uri)
Define the a new namespace for this element and add the "xmlns: |
XNs |
defineNs(XNs ns)
Define a namespace for this element by adding the "xmlns: |
void |
dump()
Dump to standard out. |
XElem |
elem(int index)
Get the XContent at the specified index cast to a XElem. |
XElem |
elem(java.lang.String name)
Get the first child element the specified local name regardless of namespace. |
XElem |
elem(XNs ns,
java.lang.String name)
Get the first child element in the specified namespace and with the specified local name. |
XElem[] |
elems()
Get the array of XElem children for this element. |
XElem[] |
elems(java.lang.String name)
Get all the children elements with the specified local name regardless of namespace. |
XElem[] |
elems(XNs ns)
Get all the children elements in the specified namespace. |
XElem[] |
elems(XNs ns,
java.lang.String name)
Get all the children elements in the specified namespace and with the specified local name. |
XNs |
findNs(java.lang.String uri)
Check is this element defines a namespace for the specified uri. |
java.lang.String |
get(java.lang.String name)
Get an attribute by the specified name not in an explicit namespace. |
java.lang.String |
get(java.lang.String name,
java.lang.String def)
Get an attribute by the specified name. |
java.lang.String |
get(XNs ns,
java.lang.String name)
Get an attribute by the specified namespace and local name. |
java.lang.String |
get(XNs ns,
java.lang.String name,
java.lang.String def)
Get an attribute by the specified namespace and local name. |
boolean |
getb(java.lang.String name)
Get a boolean attribute by the specified name. |
boolean |
getb(java.lang.String name,
boolean def)
Get a boolean attribute by the specified name. |
double |
getd(java.lang.String name)
Get a double attribute by the specified name. |
double |
getd(java.lang.String name,
double def)
Get a double attribute by the specified name. |
float |
getf(java.lang.String name)
Get a float attribute by the specified name. |
float |
getf(java.lang.String name,
float def)
Get a float attribute by the specified name. |
int |
geti(java.lang.String name)
Get an int attribute by the specified name. |
int |
geti(java.lang.String name,
int def)
Get an int attribute by the specified name. |
long |
getl(java.lang.String name)
Get a long attribute by the specified name. |
long |
getl(java.lang.String name,
long def)
Get a long attribute by the specified name. |
int |
line()
Get the line number of this element in the document or 0 if unknown. |
java.lang.String |
name()
Get the local name of the element (without prefix). |
XNs |
ns()
Get the namespace for this element. |
java.lang.String |
prefix()
Return ns().prefix() or null if no
namespace is defined for this element. |
java.lang.String |
qname()
Get the qualified name of the element. |
void |
removeAttr(int index)
Remove the attribute at the specified index. |
void |
removeAttr(java.lang.String name)
Remove the first attribute with the specified name in the null namespace. |
void |
removeAttr(XNs ns,
java.lang.String name)
Remove the first attribute with the specified namespace and local name. |
void |
removeContent(int index)
Remove the content child at the specified index. |
void |
removeContent(XContent child)
Remove the specified content instance (using == operator). |
void |
replaceContent(int index,
XContent child)
Replace the content instance at the specified index with the new content child. |
void |
setAttr(int index,
java.lang.String value)
Set the attribute value at the specified index. |
void |
setAttr(java.lang.String name,
java.lang.String value)
Set the attribute value for the first attribute found with the specified name. |
void |
setAttr(XNs ns,
java.lang.String name,
java.lang.String value)
Set the attribute value for the first attribute found with the specified namespace and local name. |
void |
setName(java.lang.String name)
Set this element's local name. |
XNs |
setNs(XNs ns)
Set this element's namespace. |
java.lang.String |
string()
If the first content child is a XText instance, then return the result of calling XText.string(). |
XText |
text()
If the first content child is a XText instance, then return it. |
XText |
text(int index)
Get the XContent at the specified index cast to a XText. |
java.lang.String |
toString()
To string returns the start tag. |
java.lang.String |
uri()
Return ns().uri() or null if no
namespace is defined for this element. |
void |
write(java.io.File file)
Write to the specified File. |
void |
write(XWriter out)
Write to the specified XWriter stream with indent of 0. |
void |
write(XWriter out,
int indent)
Write to the specified XWriter stream. |
Methods inherited from class uxparser.XContent |
---|
equals, parent |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public XElem(java.lang.String nsPrefix, java.lang.String nsUri, java.lang.String name)
public XElem(XNs ns, java.lang.String name)
public XElem(java.lang.String name)
XElem(null, name)
.
public XElem()
XElem(null, "unnamed")
.
Method Detail |
---|
public final XNs ns()
public final java.lang.String prefix()
ns().prefix()
or null if no
namespace is defined for this element.
public final java.lang.String uri()
ns().uri()
or null if no
namespace is defined for this element.
public final java.lang.String name()
public final java.lang.String qname()
public final XNs findNs(java.lang.String uri)
public final XNs setNs(XNs ns)
public final void setName(java.lang.String name)
public XNs defineDefaultNs(java.lang.String uri)
public XNs defineNs(java.lang.String prefix, java.lang.String uri)
public XNs defineNs(XNs ns)
public final int attrSize()
public final XNs attrNs(int index)
java.lang.ArrayIndexOutOfBoundsException
- if index >= attrSize()public final java.lang.String attrName(int index)
java.lang.ArrayIndexOutOfBoundsException
- if index >= attrSize()public final java.lang.String attrValue(int index)
java.lang.ArrayIndexOutOfBoundsException
- if index >= attrSize()public final int attrIndex(XNs ns, java.lang.String name)
public final int attrIndex(java.lang.String name)
public final java.lang.String get(XNs ns, java.lang.String name)
public final java.lang.String get(java.lang.String name)
public final java.lang.String get(XNs ns, java.lang.String name, java.lang.String def)
public final java.lang.String get(java.lang.String name, java.lang.String def)
public final boolean getb(java.lang.String name)
public final boolean getb(java.lang.String name, boolean def)
public final int geti(java.lang.String name)
public final int geti(java.lang.String name, int def)
public final long getl(java.lang.String name)
public final long getl(java.lang.String name, long def)
public final float getf(java.lang.String name)
public final float getf(java.lang.String name, float def)
public final double getd(java.lang.String name)
public final double getd(java.lang.String name, double def)
public final void setAttr(XNs ns, java.lang.String name, java.lang.String value)
public final void setAttr(java.lang.String name, java.lang.String value)
public final void setAttr(int index, java.lang.String value)
public final XElem addAttr(java.lang.String name, java.lang.String value)
public final XElem addAttr(XNs ns, java.lang.String name, java.lang.String value)
public final void removeAttr(XNs ns, java.lang.String name)
public final void removeAttr(java.lang.String name)
public final void removeAttr(int index)
public final void clearAttr()
public final int contentSize()
public final XContent content(int index)
java.lang.ArrayIndexOutOfBoundsException
- if index >= contentSize()public final XContent[] content()
public int contentIndex(XContent child)
public final XElem elem(int index)
java.lang.ArrayIndexOutOfBoundsException
- if index >= contentSize()public final XElem[] elems()
public final XElem[] elems(XNs ns, java.lang.String name)
public final XElem[] elems(XNs ns)
public final XElem[] elems(java.lang.String name)
public final XElem elem(XNs ns, java.lang.String name)
public final XElem elem(java.lang.String name)
public final XElem addText(java.lang.String txt)
public XText text()
public final XText text(int index)
java.lang.ArrayIndexOutOfBoundsException
- if index >= contentSize()public java.lang.String string()
public final XElem addContent(XContent child)
public final XElem addContent(int index, XContent child)
java.lang.ArrayIndexOutOfBoundsException
- if index > contentSize()public final void replaceContent(int index, XContent child)
java.lang.ArrayIndexOutOfBoundsException
- if index >= contentSize()public final void removeContent(XContent child)
public final void removeContent(int index)
java.lang.ArrayIndexOutOfBoundsException
- if index >= contentSize()public final void clearContent()
public void dump()
public void write(java.io.File file) throws java.lang.Exception
java.lang.Exception
public void write(XWriter out)
write
in class XContent
public void write(XWriter out, int indent)
public final int line()
public final XElem copy()
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |