com.indexdata.utils
public class XmlUtils extends Object
Modifier and Type | Method and Description |
---|---|
static Node |
appendTextNode(Node parent,
String tagName,
String text) |
static String |
escape(String s)
Escape five, basic XML entities.
|
static NodeList |
getNodeList(Object startingPoint,
String xPathString)
Gets a list of nodes by XPath from given starting point
|
static NodeList |
getNodeListNS(Node startingPoint,
String xPathString)
Gets a list of nodes by XPath from given starting point and resolve namespace
prefixes using the document itself.
|
static Document |
newDoc() |
static Document |
newDoc(String rootNode) |
static Document |
parse(File file) |
static Document |
parse(InputStream source) |
static Document |
parse(String uri) |
static Document |
parse(StringReader reader) |
static void |
read(InputSource is,
ContentHandler ch) |
static void |
read(InputSource is,
ContentHandler ch,
boolean useTagSoup) |
static void |
read(InputSource is,
org.xml.sax.helpers.DefaultHandler dh) |
static void |
serialize(Node doc,
OutputStream dest) |
static void |
serialize(Node doc,
OutputStream dest,
Properties props) |
static void |
serialize(Node doc,
Writer writer) |
static void |
serialize(Node doc,
Writer writer,
Properties props) |
public static Document newDoc()
public static Document parse(InputStream source) throws SAXException, IOException
SAXException
IOException
public static Document parse(String uri) throws SAXException, IOException
SAXException
IOException
public static Document parse(StringReader reader) throws SAXException, IOException
SAXException
IOException
public static Document parse(File file) throws SAXException, IOException
SAXException
IOException
public static void read(InputSource is, org.xml.sax.helpers.DefaultHandler dh) throws SAXException, IOException
SAXException
IOException
public static void read(InputSource is, ContentHandler ch) throws SAXException, IOException
SAXException
IOException
public static void read(InputSource is, ContentHandler ch, boolean useTagSoup) throws SAXException, IOException
SAXException
IOException
public static void serialize(Node doc, OutputStream dest) throws TransformerException
TransformerException
public static void serialize(Node doc, Writer writer) throws TransformerException
TransformerException
public static void serialize(Node doc, OutputStream dest, Properties props) throws TransformerException
TransformerException
public static void serialize(Node doc, Writer writer, Properties props) throws TransformerException
TransformerException
public static String escape(String s)
s
- string to be escapedpublic static NodeList getNodeList(Object startingPoint, String xPathString) throws XPathExpressionException
startingPoint
- The context nodexPathString
- The search stringStandardServiceException
- If XPath evaluation fails.XPathExpressionException
public static NodeList getNodeListNS(Node startingPoint, String xPathString) throws XPathExpressionException
startingPoint
- The context nodexPathString
- The search stringStandardServiceException
- If XPath evaluation fails.XPathExpressionException
Copyright © 2014. All rights reserved.