We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
Simple XML parsing and XPath library in Java
There was an error while loading.Please reload this page.
This is a simple library for parsing and outputing XML strings. It alsoprovides a simple XPath 1.0 processor.
Download the source code or clone the repository. If you have Ant, youcan compile by simply typing:
$ ant
at the command prompt. This will create thexml-lif.jar library,which you can then include in your projects.
xml-lif.jar
Stringmy_string ="some XML...":try {XmlElementelem =XmlElement.parse(my_string);}catch (XmlParseExceptione) {// Do something}
XmlElementmy_element =newXmlElement("foo");XmlElementinside =newXmlElement("bar");inside.addChild(newTextElement("Hello"));my_element.addChild(inside);
XPathExpressionexp =XPathExpression.parse("foo/bar/text()");try {Collection<XmlElement>result =XP.get(my_map,"b[0]");}catch (XPathParseExceptione) {// Do something}
With the elementmy_element created above, this would return theTextElement with value "Hello".
my_element
TextElement