Constructor and Description |
---|
XML(Document doc)
Creates an XML object for an existing document.
|
XML(File file)
Parses XML from the given file.
|
XML(InputStream in)
Parses XML from the given input stream.
|
XML(String s)
Parses XML from the given string.
|
XML(String path,
Document doc)
Creates an XML object for an existing document.
|
XML(URL url)
Parses XML from the given URL.
|
Modifier and Type | Method and Description |
---|---|
static String |
cdata(Element el,
String child)
Gets the CData beneath the given element's specified child.
|
static String |
cdata(Node item)
Gets the CData beneath the given node.
|
String |
cdata(String expression)
Obtains the CDATA identified by the given XPath expression.
|
static ArrayList<Element> |
elements(Element el,
String child)
Gets the given element's specified child elements.
|
static ArrayList<Element> |
elements(NodeList nodes)
Gets the element nodes from the given node list.
|
ArrayList<Element> |
elements(String expression)
Obtains the elements identified by the given XPath expression.
|
Document |
getDocument()
Gets the XML's DOM representation.
|
String |
getPath()
Gets the path to the XML document, or null if none.
|
protected static Document |
loadXML(InputStream in)
Loads an XML document from the given input stream.
|
protected static Document |
loadXML(String s)
Loads an XML document from the given input stream.
|
String |
toString() |
NodeList |
xpath(String expression)
Obtains the nodes identified by the given XPath expression.
|
public XML(File file) throws ParserConfigurationException, SAXException, IOException
public XML(URL url) throws ParserConfigurationException, SAXException, IOException
public XML(InputStream in) throws ParserConfigurationException, SAXException, IOException
public XML(String s) throws ParserConfigurationException, SAXException, IOException
public XML(Document doc)
public String getPath()
public Document getDocument()
public String cdata(String expression)
public ArrayList<Element> elements(String expression)
public NodeList xpath(String expression)
public static String cdata(Element el, String child)
public static ArrayList<Element> elements(NodeList nodes)
public static ArrayList<Element> elements(Element el, String child)
protected static Document loadXML(InputStream in) throws ParserConfigurationException, SAXException, IOException
protected static Document loadXML(String s) throws ParserConfigurationException, SAXException, IOException
Copyright © 2015–2022 SciJava. All rights reserved.