Modifier and Type | Field and Description |
---|---|
static String |
NON_VALIDATING_DTD_EXTERNAL |
static String |
NON_VALIDATING_DTD_GRAMMAR |
static short |
UNDEFINED_NODE |
static String |
VALIDATION_SCHEMA |
static String |
VALIDATION_SCHEMA_FULL_CHECKING |
Constructor and Description |
---|
XMLUtilImpl() |
Modifier and Type | Method and Description |
---|---|
Document |
createDocument(InputStream is,
boolean isHTML)
creates and returns a xml Document instance
|
Document |
createDocument(Resource res,
boolean isHTML)
creates and returns a xml Document instance
|
Document |
createDocument(String xml,
boolean isHTML)
creates and returns a xml Document instance
|
XMLReader |
createXMLReader(String oprionalDefaultSaxParser) |
String |
escapeXMLString(String xmlStr) |
Element[] |
getChildElementsAsArray(Node node)
return all Element Children of a node
|
Node |
getChildNode(Node node,
short type,
String filter,
int index) |
ArrayList<Node> |
getChildNodes(Node node,
short type,
String filter)
return all Children of a node by a defined type as Node List
|
Node[] |
getChildNodesAsArray(Node node,
short type)
return all Children of a node by a defined type as Node Array
|
Node[] |
getChildNodesAsArray(Node node,
short type,
String filter) |
List<Node> |
getChildNodesAsList(Node node,
short type,
String filter) |
Element |
getChildWithName(String name,
Element el) |
Document |
getDocument(Node node) |
Document |
getDocument(NodeList nodeList)
return the Owner Document of a Node List
|
Element |
getRootElement(Node node)
return the root Element from a node
|
TransformerFactory |
getTransformerFactory() |
String |
getTypeAsString(Node node,
boolean cftype)
returns the Node Type As String
|
boolean |
nameEqual(Node node,
String name)
check if given name is equal to name of the element (with and without
namespace)
|
Document |
newDocument()
returns a new Empty XMl Document
|
Document |
parse(InputSource xml,
InputSource validator,
boolean isHtml)
parse XML/HTML String to a XML DOM representation
|
void |
prependChild(Element parent,
Element child) |
void |
replaceChild(Node newChild,
Node oldChild) |
void |
setFirst(Node parent,
Node node) |
InputSource |
toInputSource(Object value) |
InputSource |
toInputSource(PageContext pc,
Object value) |
InputSource |
toInputSource(PageContext pc,
String xml) |
InputSource |
toInputSource(PageContext pc,
String xml,
boolean canBePath) |
InputSource |
toInputSource(Resource res,
Charset cs) |
Node |
toNode(Object value) |
String |
toString(Node node,
boolean omitXMLDecl,
boolean indent,
String publicId,
String systemId,
String encoding) |
String |
toString(NodeList nodes,
boolean omitXMLDecl,
boolean indent) |
String |
toString(Node node,
String defaultValue) |
String |
transform(Document doc,
InputSource xsl,
Map<String,Object> parameters)
transform a XML Document to a other format, with help of a XSL Stylesheet
|
String |
transform(InputSource xml,
InputSource xsl,
Map<String,Object> parameters)
transform a XML Object to a other format, with help of a XSL Stylesheet
|
String |
unescapeXMLString(String str) |
Struct |
validate(InputSource xml,
InputSource schema,
String strSchema) |
void |
writeTo(Node node,
Resource file)
write a xml Dom to a file
|
void |
writeTo(Node node,
Result res,
boolean omitXMLDecl,
boolean indent,
String publicId,
String systemId,
String encoding) |
public static final String NON_VALIDATING_DTD_GRAMMAR
public static final String NON_VALIDATING_DTD_EXTERNAL
public static final String VALIDATION_SCHEMA
public static final String VALIDATION_SCHEMA_FULL_CHECKING
public static final short UNDEFINED_NODE
public String unescapeXMLString(String str)
unescapeXMLString
in interface XMLUtil
public String escapeXMLString(String xmlStr)
escapeXMLString
in interface XMLUtil
public TransformerFactory getTransformerFactory()
getTransformerFactory
in interface XMLUtil
public final Document parse(InputSource xml, InputSource validator, boolean isHtml) throws SAXException, IOException
parse
in interface XMLUtil
xml
- XML InputSourceisHtml
- is a HTML or XML ObjectSAXException
IOException
public void replaceChild(Node newChild, Node oldChild)
replaceChild
in interface XMLUtil
public boolean nameEqual(Node node, String name)
XMLUtil
public Element getRootElement(Node node)
XMLUtil
getRootElement
in interface XMLUtil
node
- node to get root element frompublic Document newDocument() throws ParserConfigurationException, FactoryConfigurationError
XMLUtil
newDocument
in interface XMLUtil
ParserConfigurationException
FactoryConfigurationError
public Document getDocument(NodeList nodeList) throws PageException
XMLUtil
getDocument
in interface XMLUtil
PageException
public Document getDocument(Node node)
getDocument
in interface XMLUtil
public ArrayList<Node> getChildNodes(Node node, short type, String filter)
XMLUtil
getChildNodes
in interface XMLUtil
node
- node to get children fromtype
- type of returned nodefilter
- filter to usepublic Node getChildNode(Node node, short type, String filter, int index)
getChildNode
in interface XMLUtil
public Node[] getChildNodesAsArray(Node node, short type)
node
- node to get children fromtype
- type of returned nodepublic Element[] getChildElementsAsArray(Node node)
node
- node to get children frompublic String transform(InputSource xml, InputSource xsl, Map<String,Object> parameters) throws TransformerException, SAXException, IOException
XMLUtil
transform
in interface XMLUtil
xml
- xml to convertxsl
- xsl used to convertparameters
- parameters used to convertTransformerException
SAXException
IOException
public String transform(Document doc, InputSource xsl, Map<String,Object> parameters) throws TransformerException
XMLUtil
transform
in interface XMLUtil
doc
- xml to convertxsl
- xsl used to convertparameters
- parameters used to convertTransformerException
public String getTypeAsString(Node node, boolean cftype)
node
- cftype
- public Element getChildWithName(String name, Element el)
getChildWithName
in interface XMLUtil
public InputSource toInputSource(Resource res, Charset cs) throws IOException
toInputSource
in interface XMLUtil
IOException
public InputSource toInputSource(PageContext pc, Object value) throws IOException, PageException
IOException
PageException
public InputSource toInputSource(PageContext pc, String xml) throws IOException, PageException
IOException
PageException
public InputSource toInputSource(PageContext pc, String xml, boolean canBePath) throws IOException, PageException
IOException
PageException
public Struct validate(InputSource xml, InputSource schema, String strSchema) throws PageException
validate
in interface XMLUtil
PageException
public void prependChild(Element parent, Element child)
prependChild
in interface XMLUtil
public XMLReader createXMLReader(String oprionalDefaultSaxParser) throws SAXException
SAXException
public InputSource toInputSource(Object value) throws IOException, PageException
toInputSource
in interface XMLUtil
IOException
PageException
public void writeTo(Node node, Resource file) throws PageException
XMLUtil
writeTo
in interface XMLUtil
PageException
public void writeTo(Node node, Result res, boolean omitXMLDecl, boolean indent, String publicId, String systemId, String encoding) throws PageException
writeTo
in interface XMLUtil
PageException
public String toString(Node node, boolean omitXMLDecl, boolean indent, String publicId, String systemId, String encoding) throws PageException
toString
in interface XMLUtil
PageException
public String toString(NodeList nodes, boolean omitXMLDecl, boolean indent) throws PageException
toString
in interface XMLUtil
PageException
public Node toNode(Object value) throws PageException
toNode
in interface XMLUtil
PageException
public Document createDocument(Resource res, boolean isHTML) throws PageException
XMLUtil
createDocument
in interface XMLUtil
PageException
public Document createDocument(String xml, boolean isHTML) throws PageException
XMLUtil
createDocument
in interface XMLUtil
PageException
public Document createDocument(InputStream is, boolean isHTML) throws PageException
XMLUtil
createDocument
in interface XMLUtil
PageException
Copyright © 2016. All rights reserved.