Package es.uji.crypto.xades.jxades.util
Class XMLUtils
java.lang.Object
es.uji.crypto.xades.jxades.util.XMLUtils
Common XML Tasks
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Element
createLastPathComponent
(Document doc, String[] path) Creates (only if necessary) and returns the element which is at the end of the specified path.static String
getAttributeByName
(Node node, String name) Get the attribute with given name's valuestatic Element
getChildElementByChain
(Element element, String[] chain, boolean create) Returns the element which is at the end of the specified chain... static Element
getChildElementByTagName
(Element parent, String tagName) Returns the child element with the specified tagName for the specified parent elementstatic Element
getChildElementByTagNameNS
(Element parent, String tagName, String nsName) getChildElementsByTagName
(Element parent, String tagName) getChildElementsByTagNameNS
(Element parent, String tagName, String nsName) private static Node
getChildNodeByType
(Element element, short nodeType) static CDATASection
getElementCDataNode
(Element element) Returns element's CDATA Nodestatic String
Gets CDATA value of an elementstatic Text
getElementTextNode
(Element element) Returns element's TEXT Nodestatic String
getElementTextValueDeprecated
(Element parentNode) Get the data of the element , no matter whether it is TXT ot CDATAstatic void
printChildElements
(Element parent, PrintStream out, boolean deep, String prefix) Used for debugingstatic void
setElementCDataValue
(Element e, String data) Sets element CDATA datastatic void
setElementTextValue
(Element e, String data) Sets element TEXT datastatic void
static void
writeXML
(OutputStream outStream, Node node) static void
writeXML
(OutputStream outStream, Node node, boolean indent) static void
static void
Writes the specified document to the given file.
-
Field Details
-
charset
-
-
Constructor Details
-
XMLUtils
public XMLUtils()
-
-
Method Details
-
getAttributeByName
Get the attribute with given name's value- Parameters:
node
- the node which attribute's value is returnedname
- name of the attribute- Returns:
- the value af the attribute
-
getElementTextValueDeprecated
Get the data of the element , no matter whether it is TXT ot CDATA- Parameters:
parentNode
- the node which data is returned- Returns:
- the TEXT or CDATA of the parentNode
-
setElementTextValue
Sets element TEXT data- Parameters:
e
- the elementdata
- the new data
-
setElementCDataValue
Sets element CDATA data- Parameters:
e
- the lementdata
- the new data
-
getElementCDataValue
Gets CDATA value of an element- Parameters:
e
- the element- Returns:
- CDATA value of element e
-
getElementCDataNode
Returns element's CDATA Node- Parameters:
element
- the element which CDATA node is returned- Returns:
- CDATA node
-
getElementTextNode
Returns element's TEXT Node- Parameters:
element
- the element which TEXT node is returned- Returns:
- TEXT node
-
getChildNodeByType
-
writeXML
- Throws:
FileNotFoundException
-
writeXML
-
writeXML
-
writeXML
Writes the specified document to the given file. The default encoding is UTF-8.- Parameters:
out
- the output Filedocument
- the document to be writen
-
writeXML
-
getChildElementByChain
Returns the element which is at the end of the specified chain... - Parameters:
element
-chain
-- Returns:
-
createLastPathComponent
Creates (only if necessary) and returns the element which is at the end of the specified path.- Parameters:
doc
- the target document where the specified path should be createdpath
- a dot separated string indicating the path to be created- Returns:
- the component at the end of the newly created path.
-
getChildElementByTagNameNS
-
getChildElementByTagName
Returns the child element with the specified tagName for the specified parent element- Parameters:
parent
-tagName
-- Returns:
-
getChildElementsByTagNameNS
-
getChildElementsByTagName
-
printChildElements
Used for debuging- Parameters:
parent
- Elementout
- PrintStreamdeep
- booleanprefix
- String
-