Tigase XML Tools is a library providing support for fast and efficient parsing and working with XML documents.
It contains of many classes however three of them, described below, are the most important.
This class represent single XML element. Contains element name, namespace, attributes and inner elements if any.
Instances of this class are mutable and not synchronized, so it is required to make sure that only single thread will work on particular instance of the
Methods which name contains
StaticStr require that passed parameters are static strings, which mean that strings needs be static or result of
This requirement is a result of usage
== instead of
.eqauls() for comparison inside this methods which make this comparison faster.
To create new element instance one of a few constructors may be used. Each of them require as a first argument the name of element.
Element attributes are easily accessing using one of following methods:
String getAttributeStaticStr(String attName)
nullif attribute is not set.
Map<String, String> getAttributes()
You may easily modify attribute values by using one of following methods:
void setAttribute(String key, String value)
nullvalue. To remove a value for attribute, you need to use
void setAttributes(Map<String, String> newAttributes)
void removeAttribute(String key)
Each instance of the
Element class may contain elements inside it (inner elements) named here children.
To access them you may call:
Element getChild(String name),
Element getChild(String name, String child_xmlns),
Element getChildStaticStr(String name),
Element getChildStaticStr(String name, String child_xmlns)
Each of this methods may return a null if there is no child matching requirements.
To add elements as a children of the element call
void addChild(XMLNodeIfc child) or
void addChildren(List<Element> children).
To remove elements, you need to retrieve instance of the
Element which you want to removed and call
boolean removeChild(Element child).