Package sk.iway.iwcm
Class XmlUtils
java.lang.Object
sk.iway.iwcm.XmlUtils
XmlUtils.java - pomocne metody pre pracu s XML
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidAdds an attribute with the specified name to the given element only if thevalueparameter is notnull.static voidstatic Elementstatic Elementstatic Textstatic voidrecursively copies the source node to the destinationstatic voidrecursively copies the source node to the destinationstatic NodecreateSimpleElement(Document doc, String name, boolean value) static NodecreateSimpleElement(Document doc, String name, double value) static NodecreateSimpleElement(Document doc, String name, int value) static NodecreateSimpleElement(Document doc, String name, String value) static StringgetAttribute(Node node, String attrname) static StringgetAttribute(Node node, String attribute, String defaultValue) static StringgetAttributeUp(Node node, String attribute) static booleangetBooleanAttribute(Node node, String attribname, boolean defaultValue) protected static booleangetBooleanAttributeFromValue(Node node, String value, boolean defaultValue) static booleangetBooleanAttributeUp(Node node, String attribname, boolean defaultValue) static Stringstatic NodegetChildNodeByPath(Node source, String path) getChildNodes(Node parent, short type) getChildNodes(Node parent, String tagName) getChildNodesByPath(Node source, String path) static intgetChildPos(Node parent, Node child) static doublegetElementsWithValue(Node parent, String tagName, String value) static NodegetFirstChild(Node parent, String tagName) static StringgetFirstChildValue(Node node, String tagName) static intstatic intgetIntAttribute(Node node, String attribname, int defaultValue) protected static intgetIntAttributeFromValue(Node node, String value, int defaultValue) static intgetIntAttributeUp(Node node, String attribname, int defaultValue) getNodesWithAttribute(NodeList nl, String attributeName, String attributeValue) getNodesWithAttribute(Node node, String attributeName, String attributeValue) getSameNameSiblings(Node node) static Stringstatic Stringstatic Stringstatic Stringstatic StringgetTextFromNode(String tagName, Element el) Funkcia, ktora ziska text z xml tagu tagName v elemente el.static booleanhasElementWithValue(Node parent, String tagName, String value) static booleanhasNonTextChild(Node node) static booleannodeToBoolean(Node node) Returns the value of the given node as a booleanprotected static voidnormalizeAndPrint(PrintWriter fOut, char c, boolean fCanonical) Normalizes and print the given character.static Stringstatic DocumentreadDocument(String url) Vrati objekt typu Document zo zadaneho URL (lokalne)static voidremoveAllChildren(Node node) static voidremoveChildNodes(Node node, short type) removeChildNodes(Node node, String name) static booleansaveDocument(Document doc, String url, String encoding) Ulozi objekt typu Document na zadane URL (lokalne)static voidstatic Textstatic void
-
Constructor Details
-
XmlUtils
protected XmlUtils()
-
-
Method Details
-
getAttribute
-
getText
-
getText
-
getText
-
getText
-
getCDATA
-
addText
-
addCDATA
-
setText
-
setCDATA
-
getDouble
-
getInt
-
getChildNodes
-
removeChildNodes
-
removeAllChildren
-
getChildNodes
-
removeChildNodes
-
getNodesWithAttribute
-
getNodesWithAttribute
-
swapNodes
-
getSameNameSiblings
-
addNode
-
addNode
-
getFirstChild
-
getFirstChildValue
-
hasNonTextChild
-
createSimpleElement
-
createSimpleElement
-
createSimpleElement
-
createSimpleElement
-
nodeToBoolean
Returns the value of the given node as a boolean -
addAttr
Adds an attribute with the specified name to the given element only if thevalueparameter is notnull. -
getAttribute
-
getAttributeUp
-
hasElementWithValue
-
getElementsWithValue
-
getIntAttributeFromValue
-
getIntAttributeUp
-
getIntAttribute
-
getBooleanAttributeFromValue
-
getBooleanAttributeUp
-
getBooleanAttribute
-
getChildPos
-
copyNode
recursively copies the source node to the destination -
copyNode
recursively copies the source node to the destination -
getChildNodeByPath
-
getChildNodesByPath
-
normalizeAndPrint
-
normalizeAndPrint
Normalizes and print the given character. -
readDocument
Vrati objekt typu Document zo zadaneho URL (lokalne)- Parameters:
url-- Returns:
- Throws:
Exception
-
saveDocument
Ulozi objekt typu Document na zadane URL (lokalne)- Parameters:
doc-url-encoding-- Returns:
- Throws:
Exception
-
getTextFromNode
Funkcia, ktora ziska text z xml tagu tagName v elemente el.- Parameters:
tagName- Nazov tagu, z ktoreho chceme vytiahnut textel- Element, v ktorom sa nachadza dany tag- Returns:
- Vrati text, ktory sa nachadza v danom retazci. Ak nastane hocijaka chyba, vrati prazdny retazec.
-