public final class XmlUtils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_CHARSETNAME |
static String |
ENGLISH |
static String |
GIRR_COMMENT |
static String |
GIRR_NAMESPACE_URI |
static String |
GIRR_SCHEMA_LOCATION |
static String |
HTML_NAMESPACE_ATTRIBUTE_NAME |
static String |
HTML_NAMESPACE_URI |
static String |
IRP_NAMESPACE_URI |
static String |
IRP_SCHEMA_LOCATION |
static String |
SCHEMA_LOCATION_ATTRIBUTE_NAME |
static String |
W3C_SCHEMA_NAMESPACE_ATTRIBUTE_NAME |
static String |
XINCLUDE_NAMESPACE_ATTRIBUTE_NAME |
static String |
XINCLUDE_NAMESPACE_URI |
static String |
XML_LANG_ATTRIBUTE_NAME |
static String |
XML_NAMESPACE_ATTRIBUTE_NAME |
static String |
XML_PRESERVE_NAME |
static String |
XML_SPACE_ATTRIBUTE_NAME |
static String |
XSLT_NAMESPACE_URI |
Modifier and Type | Method and Description |
---|---|
static void |
addBooleanAttributeIfTrue(Element element,
String attName,
boolean value) |
static void |
addDoubleAttributeAsInteger(Element element,
String attName,
double value) |
static Map<String,Element> |
buildIndex(Element element,
String tagName,
String idName) |
static Map<String,Element> |
createIndex(Element root,
String tagName,
String idName) |
static void |
main(String[] args) |
static Document |
newDocument() |
static Document |
newDocument(boolean isNamespaceAware) |
static Document |
openXmlFile(File file) |
static Document |
openXmlFile(File file,
File schemaFile,
boolean isNamespaceAware,
boolean isXIncludeAware) |
static Document |
openXmlFile(File file,
Schema schema,
boolean isNamespaceAware,
boolean isXIncludeAware) |
static Document |
openXmlReader(Reader reader,
Schema schema,
boolean isNamespaceAware,
boolean isXIncludeAware) |
static Document |
openXmlStream(InputStream stream,
Schema schema,
boolean isNamespaceAware,
boolean isXIncludeAware) |
static Document |
parseStringToXmlDocument(String string,
boolean isNamespaceAware,
boolean isXIncludeAware) |
static void |
printDOM(Document doc) |
static void |
printDOM(File file,
Document doc) |
static void |
printDOM(File file,
Document doc,
String encoding,
String cdataElements) |
static void |
printDOM(File file,
Document doc,
String encoding,
String cdataElements,
String doctypeSystemid) |
static void |
printDOM(OutputStream ostr,
Document document,
String encoding,
Document xslt,
Map<String,String> parameters,
boolean binary)
Version with XSLT support.
|
static void |
printDOM(OutputStream ostr,
Document doc,
String encoding,
String cdataElements) |
static void |
printDOM(OutputStream ostr,
Document doc,
String encoding,
String cdataElements,
String doctypeSystemid) |
static void |
printDOM(String xmlFileName,
Document doc,
String encoding,
String cdataElements) |
static void |
printHtmlDOM(OutputStream ostr,
Document doc,
String encoding) |
static void |
setDebug(boolean dbg) |
static DocumentFragment |
stringToDocumentFragment(String str)
Expensive to use many times.
|
static Document |
wrapDocumentFragment(DocumentFragment fragment,
String namespaceURI,
String tagName,
String attName,
String attValue) |
public static final String DEFAULT_CHARSETNAME
public static final String W3C_SCHEMA_NAMESPACE_ATTRIBUTE_NAME
public static final String HTML_NAMESPACE_ATTRIBUTE_NAME
public static final String XML_NAMESPACE_ATTRIBUTE_NAME
public static final String XINCLUDE_NAMESPACE_ATTRIBUTE_NAME
public static final String HTML_NAMESPACE_URI
public static final String XSLT_NAMESPACE_URI
public static final String SCHEMA_LOCATION_ATTRIBUTE_NAME
public static final String XML_LANG_ATTRIBUTE_NAME
public static final String XML_SPACE_ATTRIBUTE_NAME
public static final String XML_PRESERVE_NAME
public static final String ENGLISH
public static final String GIRR_NAMESPACE_URI
public static final String IRP_NAMESPACE_URI
public static final String XINCLUDE_NAMESPACE_URI
public static final String GIRR_COMMENT
public static final String GIRR_SCHEMA_LOCATION
public static final String IRP_SCHEMA_LOCATION
public static void setDebug(boolean dbg)
public static Document parseStringToXmlDocument(String string, boolean isNamespaceAware, boolean isXIncludeAware) throws SAXException
SAXException
public static Document openXmlFile(File file, Schema schema, boolean isNamespaceAware, boolean isXIncludeAware) throws SAXException, IOException
SAXException
IOException
public static Document openXmlFile(File file, File schemaFile, boolean isNamespaceAware, boolean isXIncludeAware) throws SAXException, IOException
SAXException
IOException
public static Document openXmlFile(File file) throws IOException, SAXException
IOException
SAXException
public static Document openXmlReader(Reader reader, Schema schema, boolean isNamespaceAware, boolean isXIncludeAware) throws IOException, SAXException
IOException
SAXException
public static Document openXmlStream(InputStream stream, Schema schema, boolean isNamespaceAware, boolean isXIncludeAware) throws IOException, SAXException
IOException
SAXException
public static Document newDocument(boolean isNamespaceAware)
public static Document newDocument()
public static Map<String,Element> createIndex(Element root, String tagName, String idName)
public static void printHtmlDOM(OutputStream ostr, Document doc, String encoding)
public static void printDOM(OutputStream ostr, Document doc, String encoding, String cdataElements, String doctypeSystemid)
public static void printDOM(OutputStream ostr, Document doc, String encoding, String cdataElements)
public static void printDOM(File file, Document doc, String encoding, String cdataElements, String doctypeSystemid) throws FileNotFoundException
FileNotFoundException
public static void printDOM(File file, Document doc, String encoding, String cdataElements) throws FileNotFoundException
FileNotFoundException
public static void printDOM(String xmlFileName, Document doc, String encoding, String cdataElements) throws FileNotFoundException, UnsupportedEncodingException
public static void printDOM(File file, Document doc) throws FileNotFoundException
FileNotFoundException
public static void printDOM(Document doc)
public static void printDOM(OutputStream ostr, Document document, String encoding, Document xslt, Map<String,String> parameters, boolean binary) throws TransformerException, IOException
ostr
- document
- encoding
- xslt
- Stylesheet transforming the documentparameters
- binary
- TransformerException
IOException
public static Map<String,Element> buildIndex(Element element, String tagName, String idName)
public static void addBooleanAttributeIfTrue(Element element, String attName, boolean value)
public static void addDoubleAttributeAsInteger(Element element, String attName, double value)
public static Document wrapDocumentFragment(DocumentFragment fragment, String namespaceURI, String tagName, String attName, String attValue)
public static DocumentFragment stringToDocumentFragment(String str)
str
- public static void main(String[] args)
Copyright © 2020. All rights reserved.