public class XMLElement extends Object implements IXMLUtilsConstants
DOCTYPE, NEW_LINE, TOKEN_TYPE_BOUNDED, TOKEN_TYPE_COMMENT, TOKEN_TYPE_DOCTYPE, TOKEN_TYPE_META, TOKEN_TYPE_UNBOUNDED, TOKEN_TYPE_WHITESPACE
Modifier and Type | Method and Description |
---|---|
void |
addChildElement(XMLElement child)
Appends the given child element to the end of the list of existing child
elements.
|
void |
addChildElement(XMLElement child,
boolean addAfterNewLine)
Appends the given child element to the end of the list of existing child
elements.
|
void |
addChildElementAt(XMLElement child,
int index)
Adds the given child element at the given index.
|
void |
addChildElementAt(XMLElement child,
int index,
boolean addAfterNewLine)
Adds the given child element at the specified index.
|
void |
delete()
Deletes this element from the master document.
|
String |
getAttributeValue(String name)
Returns the value of the attribute with the given name as present in the
current element.
|
ArrayList |
getChildElements()
Returns an ordered collection of child elements of this element
|
String |
getName()
Returns the name of this element
|
ArrayList |
getNamedChildElements(String name)
Returns a list of named chiled elements of this element.
|
String |
getPath()
Returns a string representing the path of this XMLElement in the current
document.
|
String |
getValue()
Returns the value stored in this element.
|
int |
removeAttribute(String name)
Removes any attribute with the given name from this element.
|
String |
toString()
Returns an indented string representation of this element and any
contained child elements.
|
String |
toXMLString()
Returns an xml fragment that represents this element and any contained
child elements.
|
void |
updateAttribute(String name,
String value)
Updates the value of the an attribute identified by the given name.
|
void |
updateValue(String value)
Updates the value of this element.
|
public void delete() throws Exception
Exception
- if the delete operation failspublic String getAttributeValue(String name)
name
- the name of the attribute whoes value must be returned.public void addChildElementAt(XMLElement child, int index) throws Exception
child
- index
- Exception
public void addChildElementAt(XMLElement child, int index, boolean addAfterNewLine) throws Exception
child
- the element to be added as a child of this elementindex
- the index at which the child element has to be addedException
- if the addition operation failspublic void addChildElement(XMLElement child, boolean addAfterNewLine) throws Exception
child
- addAfterNewLine
- Exception
public void addChildElement(XMLElement child) throws Exception
child
- the child element to appendException
- if the addition operation fails.public ArrayList getNamedChildElements(String name)
name
- the name of the child elements which must be returnedpublic void updateValue(String value) throws Exception
value
- to be updatedException
- if the update operation failspublic void updateAttribute(String name, String value)
name
- the name of the attribute to be updated or addedvalue
- the value of the attirbuteException
- if the update was not successfulpublic int removeAttribute(String name)
0
.name
- the name of the attribute that must be removed.public String toString()
public String toXMLString()
public String getValue()
public String getName()
public ArrayList getChildElements()
public String getPath()
Copyright © 2010–2025 Open Identity Platform Community. All rights reserved.