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 ElementcreateLastPathComponent(Document doc, String[] path) Creates (only if necessary) and returns the element which is at the end of the specified path.static StringgetAttributeByName(Node node, String name) Get the attribute with given name's valuestatic ElementgetChildElementByChain(Element element, String[] chain, boolean create) Returns the element which is at the end of the specified chain... static ElementgetChildElementByTagName(Element parent, String tagName) Returns the child element with the specified tagName for the specified parent elementstatic ElementgetChildElementByTagNameNS(Element parent, String tagName, String nsName) getChildElementsByTagName(Element parent, String tagName) getChildElementsByTagNameNS(Element parent, String tagName, String nsName) private static NodegetChildNodeByType(Element element, short nodeType) static CDATASectiongetElementCDataNode(Element element) Returns element's CDATA Nodestatic StringGets CDATA value of an elementstatic TextgetElementTextNode(Element element) Returns element's TEXT Nodestatic StringgetElementTextValueDeprecated(Element parentNode) Get the data of the element , no matter whether it is TXT ot CDATAstatic voidprintChildElements(Element parent, PrintStream out, boolean deep, String prefix) Used for debugingstatic voidsetElementCDataValue(Element e, String data) Sets element CDATA datastatic voidsetElementTextValue(Element e, String data) Sets element TEXT datastatic voidstatic voidwriteXML(OutputStream outStream, Node node) static voidwriteXML(OutputStream outStream, Node node, boolean indent) static voidstatic voidWrites 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
-