|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.softcorporation.xmllight.Element
XML Light Element. Represents any element in XML document,
including the root element. An element is a pair of identically
named start and end tags. (<text> and </text>).
It may have a content. Here is a sample of element "text",
with content "Text goes here." and attribute "language"
with value "English".
<text language="English">
Text goes here.
</text>
A slash (/) in the end of start tag means that this element does not
have a content and it is closed: <text language="English"/>.
| Field Summary | |
int |
errorCode
Error Code. |
boolean |
validate
Validation flag. |
| Constructor Summary | |
Element()
Constructor. |
|
Element(Element elem)
Constructor. |
|
Element(java.lang.String name)
Constructor. |
|
| Method Summary | |
void |
addCData(java.lang.String cdata)
Adds a CDATA section to the end of the existing content of the Element. |
void |
addComment(java.lang.String comment)
Adds a comment to the end of the existing content of the Element. |
void |
addCont(Element elem)
Adds a string representation of the Element elem to the end of the content of the Element. |
void |
addCont(java.lang.String cont)
Adds a content to the end of the existing content of the Element. |
void |
addElem(Element elem)
Adds a string representation of the Element elem to the end of the content of the Element. |
void |
addText(java.lang.String text)
Adds a text to the end of the existing content of the Element. |
java.lang.String |
getAttr(java.lang.String attr)
Gets the attribute of the Element by it's name. |
java.lang.String |
getAttr(java.lang.String attr,
java.lang.String defValue)
Gets the attribute of the Element by it's name. |
java.util.Properties |
getAttributes()
Returns Properties class containing all attributes of the Element. |
Element |
getChildElem(java.lang.String elemName)
Searches the Element with elemName in the content only among direct children of the Element. |
java.lang.String |
getChildText()
Returns the text presented in whole content of the Element. |
java.lang.String |
getChildText(boolean decode)
Returns the text presented in whole content of the Element. |
java.lang.String |
getCont()
Returns the content of the Element as a String. |
Element |
getElem()
Returns the XMLLight Element from the content. |
Element |
getElem(java.lang.String elemName)
Searches the Element with elemName in the content of the Element. |
Element |
getFirstElem(java.lang.String elemName)
Searches the element in the content starting from the beginning of the content and returns the Element. |
java.lang.String |
getName()
Gets the name of the Element. |
int |
getPosition()
Gets current position in the content of the Element. |
int |
getPosition(int id)
Gets working positions in the content of the Element. Working positions 0 is current position (same like getPosition()). Working positions 1 is a beginning of found Element in the content. |
java.lang.String |
getText()
Returns the text presented in the content of the Element from current position (see getPosition() for more) till the next child Element. |
java.lang.String |
getText(boolean decode)
Returns the text presented in the content of the Element from current position (see getPosition() for more) till the next child Element. |
void |
insCont(Element elem)
Inserts a string representation of the Element elem in the beginning of the content of the Element. |
void |
insCont(Element elem,
int position)
Inserts a string representation of the Element elem at the requested position in the content of the Element. |
void |
insCont(java.lang.String cont)
Inserts a string in the beginning of the content of the Element. |
void |
insCont(java.lang.String cont,
int position)
Inserts a string at the requested position in the content of the Element. |
boolean |
isNull()
Checks if the Element was just created and has not been set up yet. |
void |
remAttr(java.lang.String attr)
Removes the attribute from the Element. |
void |
resetPosition()
Sets current position to the beginning of the content. |
void |
setAttr(java.lang.String attr,
int value)
Sets the attribute of the Element as int. |
void |
setAttr(java.lang.String attr,
java.lang.String value)
Sets the attribute of the Element. |
void |
setAttributes(java.util.Properties attributes)
Sets Properties class containing all attributes for the Element. |
void |
setCont(java.lang.String cont)
Sets the content of the Element. |
void |
setElem(java.lang.String doc)
Sets Element from input string representing XML Element. |
void |
setElem(java.lang.String doc,
int start)
Creates XMLLight Element from XML document starting from position defined in pos[0]. |
void |
setElem(java.lang.String doc,
java.lang.String tag)
Sets Element from input string representing XML Element with shift to the beginning of the element in the string. |
void |
setElem(java.lang.String doc,
java.lang.String tag,
int start)
Sets Element from input string representing XML Element with shift to the beginning of the element in the string. |
void |
setName(java.lang.String name)
Sets the name of the Element. |
void |
setPosition(int position)
Sets current position in the content of the Element. |
java.lang.String |
toString()
Creates String representation of the Element. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public boolean validate
public int errorCode
| Constructor Detail |
public Element()
public Element(java.lang.String name)
name - represents the name of the Element.public Element(Element elem)
elem - parent Element.| Method Detail |
public void setElem(java.lang.String doc)
throws XMLLightException
XMLLightException
public void setElem(java.lang.String doc,
int start)
throws XMLLightException
doc - the XML document as a string
XMLLightException
public void setElem(java.lang.String doc,
java.lang.String tag)
throws XMLLightException
tag - tag name
XMLLightException
public void setElem(java.lang.String doc,
java.lang.String tag,
int start)
throws XMLLightException
tag - tag name
XMLLightExceptionpublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String getName()
public void setName(java.lang.String name)
name - XML Element namepublic java.lang.String getAttr(java.lang.String attr)
attr - Attribute name
public java.lang.String getAttr(java.lang.String attr,
java.lang.String defValue)
attr - Attribute name
public void setAttr(java.lang.String attr,
java.lang.String value)
attr - attribute namevalue - attribute value
public void setAttr(java.lang.String attr,
int value)
attr - attribute namevalue - attribute valuepublic void remAttr(java.lang.String attr)
attr - attribute namepublic java.util.Properties getAttributes()
public void setAttributes(java.util.Properties attributes)
public java.lang.String getCont()
public void setCont(java.lang.String cont)
cont - XML Content as a stringpublic void addCont(java.lang.String cont)
cont - XML Content as a stringpublic void addCont(Element elem)
elem - XMLLight Elementpublic void insCont(java.lang.String cont)
public void insCont(java.lang.String cont,
int position)
position - requested position in the content of the Elementpublic void insCont(Element elem)
elem - XMLLight Element
public void insCont(Element elem,
int position)
elem - XMLLight Elementposition - requested position in the content of the Elementpublic void addElem(Element elem)
elem - XMLLight Elementpublic void addComment(java.lang.String comment)
public void addCData(java.lang.String cdata)
public void addText(java.lang.String text)
text - text as a stringpublic java.lang.String getText()
public java.lang.String getText(boolean decode)
decode - defines to decode the text or not
public java.lang.String getChildText()
public java.lang.String getChildText(boolean decode)
decode - defines to decode the text or not
public Element getElem()
throws XMLLightException
XMLLightException
public Element getElem(java.lang.String elemName)
throws XMLLightException
elemName - the name of searched element
XMLLightException
public Element getFirstElem(java.lang.String elemName)
throws XMLLightException
elemName - the name of searched element
XMLLightException
public Element getChildElem(java.lang.String elemName)
throws XMLLightException
elemName - the name of searched element
XMLLightExceptionpublic void resetPosition()
public void setPosition(int position)
position - the current positionpublic int getPosition()
public int getPosition(int id)
id - the id of working position
public boolean isNull()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||