public class XMLElementImpl extends Object implements IXMLElement
NO_LINE| Constructor and Description |
|---|
XMLElementImpl(Node node)
Constructor saving the passed node
|
XMLElementImpl(String name)
Create a new root element in a new document.
|
XMLElementImpl(String name,
Document inDocument)
Constructor which create a root element in the given document
|
XMLElementImpl(String name,
IXMLElement elementReference)
Create a element in the same document of the given element
|
| Modifier and Type | Method and Description |
|---|---|
void |
addChild(IXMLElement child)
Adds a child element.
|
Enumeration<String> |
enumerateAttributeNames()
Returns an enumeration of all attribute names.
|
boolean |
equals(Object obj) |
String |
getAttribute(String name)
Returns the value of an attribute.
|
String |
getAttribute(String name,
String defaultValue)
Returns the value of an attribute.
|
Properties |
getAttributes()
Returns all attributes as a Properties object.
|
IXMLElement |
getChildAtIndex(int index)
Returns the child at a specific index.
|
List<IXMLElement> |
getChildren()
Returns a list containing all the child elements.
|
int |
getChildrenCount()
Returns the number of children.
|
List<IXMLElement> |
getChildrenNamed(String name)
Returns a list of all child elements named name.
|
String |
getContent()
Return the #PCDATA content of the element.
|
Node |
getElement()
Get the embeded node of the XmlElement
|
IXMLElement |
getFirstChildNamed(String name)
Searches a child element.
|
int |
getLineNr()
Returns the line number in the data where the element started.
|
String |
getName()
Returns the name of the element.
|
boolean |
hasAttribute(String name)
Returns whether an attribute exists.
|
boolean |
hasChildren()
Returns whether the element has children.
|
int |
hashCode() |
void |
removeAttribute(String name)
Removes an attribute.
|
void |
removeChild(IXMLElement child)
Removes a child element.
|
void |
setAttribute(String name,
String value)
Sets an attribute.
|
void |
setContent(String content)
Sets the #PCDATA content.
|
String |
toString() |
public XMLElementImpl(String name)
name - Name of the root elementpublic XMLElementImpl(String name, Document inDocument)
name - Name of the root elementinDocument - The document in which to create the xmlpublic XMLElementImpl(String name, IXMLElement elementReference)
name - Name of the elementelementReference - Reference of an existing xml. It is used to generate an xmlElement on the same document.public XMLElementImpl(Node node)
node - Node to save inside the XMLElementpublic String getName()
IXMLElementgetName in interface IXMLElementpublic void addChild(IXMLElement child)
IXMLElementaddChild in interface IXMLElementchild - the non-null child to add.public void removeChild(IXMLElement child)
IXMLElementremoveChild in interface IXMLElementchild - the non-null child to remove.public boolean hasChildren()
IXMLElementhasChildren in interface IXMLElementpublic int getChildrenCount()
IXMLElementgetChildrenCount in interface IXMLElementpublic List<IXMLElement> getChildren()
IXMLElementgetChildren in interface IXMLElementpublic IXMLElement getChildAtIndex(int index)
IXMLElementgetChildAtIndex in interface IXMLElementindex - Index of the childpublic IXMLElement getFirstChildNamed(String name)
IXMLElementgetFirstChildNamed in interface IXMLElementname - the name of the child to search for.public List<IXMLElement> getChildrenNamed(String name)
IXMLElementgetChildrenNamed in interface IXMLElementname - the name of the children to search for.public String getAttribute(String name)
IXMLElementgetAttribute in interface IXMLElementname - the non-null name of the attribute.public String getAttribute(String name, String defaultValue)
IXMLElementgetAttribute in interface IXMLElementname - the non-null name of the attribute.defaultValue - the default value of the attribute.public void setAttribute(String name, String value)
IXMLElementsetAttribute in interface IXMLElementname - the non-null name of the attribute.value - the non-null value of the attribute.public void removeAttribute(String name)
IXMLElementremoveAttribute in interface IXMLElementname - the non-null name of the attribute.public Enumeration<String> enumerateAttributeNames()
IXMLElementenumerateAttributeNames in interface IXMLElementpublic boolean hasAttribute(String name)
IXMLElementhasAttribute in interface IXMLElementname - The name of the attributepublic Properties getAttributes()
IXMLElementgetAttributes in interface IXMLElementpublic int getLineNr()
IXMLElementgetLineNr in interface IXMLElementIXMLElement.NO_LINEpublic String getContent()
IXMLElementgetContent in interface IXMLElementpublic void setContent(String content)
IXMLElementsetContent in interface IXMLElementcontent - the (possibly null) content.public Node getElement()
IXMLElementgetElement in interface IXMLElementCopyright © 2001–2025. All rights reserved.