|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.adobe.idml.XmlUtils
public abstract class XmlUtils
This class contains static methods for working with XML related technologies such as XML, XSL and XPath.
| Constructor Summary | |
|---|---|
XmlUtils()
|
|
| Method Summary | |
|---|---|
static java.lang.String |
getAttribute(java.util.ArrayList<java.lang.String> files,
java.lang.String expr)
Returns a String containing the result of the xPath expression after it is executed against the XML file. |
static java.lang.String |
getAttribute(org.w3c.dom.NamedNodeMap nm,
java.lang.String attrib)
Returns a String containing the result after searching the element for the attribute name provided. |
static java.lang.String |
getAttribute(java.lang.String xmlFilePath,
java.lang.String expr)
Returns a String containing the result of the xPath expression after it is executed against the XML file. |
static java.util.Hashtable<java.lang.String,java.lang.String> |
getAttributePairsForElement(java.util.ArrayList<java.lang.String> xmlFilePaths,
java.lang.String expr,
java.lang.String keyAttrib,
java.lang.String valueAttrib)
Returns a HashTable of Strings containing the result of the xPath expression after it is executed against the XML files. |
static java.util.Hashtable<java.lang.String,java.lang.String> |
getAttributePairsForElement(java.lang.String file,
java.lang.String expr,
java.lang.String keyAttrib,
java.lang.String valueAttrib)
Returns a HashTable of Strings containing the result of the xPath expression after it is executed against the XML file. |
static java.util.ArrayList<java.lang.String> |
getAttributes(java.util.ArrayList<java.lang.String> files,
java.lang.String expr)
Returns a ArrayList of Strings containing the result of the xPath expression after it is executed against the XML file. |
static java.util.ArrayList<java.lang.String> |
getAttributes(java.lang.String xmlFilePath,
java.lang.String expr)
Returns a ArrayList of Strings containing the result of the xPath expression after it is executed against the XML file. |
static java.util.ArrayList<java.lang.String> |
getElements(java.util.ArrayList<java.lang.String> xmlFilePaths,
java.lang.String expr)
Gets an ArrayList of the text content in a group of elements. |
static java.util.ArrayList<java.lang.String> |
getElements(java.lang.String xmlFilePath,
java.lang.String expr)
Gets an ArrayList of the text content in a group of elements. |
static org.w3c.dom.Document |
getExistingXmlDoc(java.lang.String xmlFilePath)
Get a DOM Document object from an existing file. |
static org.w3c.dom.Document |
getNewDOMDoc()
Get an empty DOM Document. |
static org.w3c.dom.Document |
getNewXslStylesheet()
Get an empty XSL version 1.0 document. |
static int |
getNodeListCount(java.lang.String xmlFilePath,
java.lang.String expr)
Get the number of nodes returned by an expression to an XML file. |
static org.w3c.dom.NodeList |
getXPathValue(java.io.File xmlFile,
java.lang.String expr)
Given an XML file and an XPath expression, this method will return a node set containing the results of the query. |
static org.w3c.dom.NodeList |
getXPathValue(java.lang.String xmlFilePath,
java.lang.String expr)
Given an XML file path and an XPath expression, this method will return a node set containing the results of the query. |
static void |
writeXmlFile(org.w3c.dom.Document doc,
java.io.File xmlFile)
Given a file object and an XML DOM Document, this method will write a formatted XML file to disk. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public XmlUtils()
| Method Detail |
|---|
public static void writeXmlFile(org.w3c.dom.Document doc,
java.io.File xmlFile)
throws java.io.IOException,
javax.xml.parsers.ParserConfigurationException
doc - The Document object to be written to file.xmlFile - The file object the Document Object will be written to.
java.io.IOException
javax.xml.parsers.ParserConfigurationException
public static org.w3c.dom.Document getNewDOMDoc()
throws javax.xml.parsers.ParserConfigurationException
javax.xml.parsers.ParserConfigurationException
public static org.w3c.dom.Document getNewXslStylesheet()
throws javax.xml.parsers.ParserConfigurationException
javax.xml.parsers.ParserConfigurationException
public static org.w3c.dom.Document getExistingXmlDoc(java.lang.String xmlFilePath)
throws javax.xml.parsers.ParserConfigurationException,
java.io.IOException,
org.xml.sax.SAXException
xmlFilePath - A path to the XML file.
javax.xml.parsers.ParserConfigurationException
java.io.IOException
org.xml.sax.SAXException
public static org.w3c.dom.NodeList getXPathValue(java.lang.String xmlFilePath,
java.lang.String expr)
throws PackageException,
java.io.IOException,
javax.xml.xpath.XPathExpressionException
xmlFilePath - The XML file to searched.expr - The xPath expression which will retrieve the required nodes from the XML file.
PackageException
java.io.IOException
javax.xml.xpath.XPathExpressionException
public static org.w3c.dom.NodeList getXPathValue(java.io.File xmlFile,
java.lang.String expr)
throws PackageException,
java.io.IOException,
javax.xml.xpath.XPathExpressionException
xmlFile - The file to be queried.expr - The expression to query the file.
PackageException
java.io.IOException
javax.xml.xpath.XPathExpressionException
public static java.lang.String getAttribute(org.w3c.dom.NamedNodeMap nm,
java.lang.String attrib)
throws PackageException
nm - The NamedNodeMap object for the node element.attrib - The attribute name to search for.
PackageException
public static java.lang.String getAttribute(java.lang.String xmlFilePath,
java.lang.String expr)
throws PackageException,
java.io.IOException,
javax.xml.xpath.XPathExpressionException
xmlFilePath - The single XML file to searched.expr - The xPath expression which will retrieve the required nodes from the XML file. The expression should be written to lookup exactly one attribute.
Otherwise an Exception will be thrown.
PackageException
java.io.IOException
javax.xml.xpath.XPathExpressionException
public static java.lang.String getAttribute(java.util.ArrayList<java.lang.String> files,
java.lang.String expr)
throws PackageException,
java.io.IOException,
javax.xml.xpath.XPathExpressionException
files - The XML files to searched.expr - The xPath expression which will retrieve the required nodes from the XML files. The expression should be written to lookup a specific attribute.
Otherwise an Exception will be thrown.
PackageException
java.io.IOException
javax.xml.xpath.XPathExpressionException
public static int getNodeListCount(java.lang.String xmlFilePath,
java.lang.String expr)
throws PackageException,
java.io.IOException,
javax.xml.xpath.XPathExpressionException
xmlFilePath - The path to the XML file to be queried.expr - The XPath expression to query the file with.
PackageException
java.io.IOException
javax.xml.xpath.XPathExpressionException
public static java.util.ArrayList<java.lang.String> getAttributes(java.lang.String xmlFilePath,
java.lang.String expr)
throws PackageException,
java.io.IOException,
javax.xml.xpath.XPathExpressionException
xmlFilePath - The single XML file to searched.expr - The xPath expression which will retrieve the required nodes from the XML file.
PackageException
java.io.IOException
javax.xml.xpath.XPathExpressionException
public static java.util.ArrayList<java.lang.String> getElements(java.lang.String xmlFilePath,
java.lang.String expr)
throws PackageException,
java.io.IOException,
javax.xml.xpath.XPathExpressionException
xmlFilePath - The path to the XML file to be queried.expr - The XPath Expression to query the XML file with.
PackageException
java.io.IOException
javax.xml.xpath.XPathExpressionException
public static java.util.ArrayList<java.lang.String> getElements(java.util.ArrayList<java.lang.String> xmlFilePaths,
java.lang.String expr)
throws PackageException,
java.io.IOException,
javax.xml.xpath.XPathExpressionException
xmlFilePaths - The paths to the XML files to be queried.expr - The XPath Expression to query the XML file with.
PackageException
java.io.IOException
javax.xml.xpath.XPathExpressionException
public static java.util.ArrayList<java.lang.String> getAttributes(java.util.ArrayList<java.lang.String> files,
java.lang.String expr)
throws PackageException,
java.io.IOException,
javax.xml.xpath.XPathExpressionException
files - The XML files to searched.expr - The xPath expression which will retrieve the required nodes from the XML files.
PackageException
java.io.IOException
javax.xml.xpath.XPathExpressionException
public static java.util.Hashtable<java.lang.String,java.lang.String> getAttributePairsForElement(java.lang.String file,
java.lang.String expr,
java.lang.String keyAttrib,
java.lang.String valueAttrib)
throws PackageException,
java.io.IOException,
javax.xml.xpath.XPathExpressionException
file - The single XML file to searched.expr - The xPath expression which will retrieve the required nodes from the XML files.keyAttrib - The name of the attribute which will be the key in the HashTable returned.valueAttrib - The name of the attribute which will be the value in the HashTable returned.
PackageException
java.io.IOException
javax.xml.xpath.XPathExpressionException
public static java.util.Hashtable<java.lang.String,java.lang.String> getAttributePairsForElement(java.util.ArrayList<java.lang.String> xmlFilePaths,
java.lang.String expr,
java.lang.String keyAttrib,
java.lang.String valueAttrib)
throws PackageException,
java.io.IOException,
javax.xml.xpath.XPathExpressionException
xmlFilePaths - The list of XML files to queried.expr - The xPath expression which will retrieve the required nodes from the XML files.keyAttrib - The name of the attribute which will be the key in the HashTable returned.valueAttrib - The name of the attribute which will be the value in the HashTable returned.
PackageException
java.io.IOException
javax.xml.xpath.XPathExpressionException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||