com.supermap.services
Class XMLWriter
- java.lang.Object
-
- com.supermap.services.XMLWriter
-
-
Constructor Summary
Constructors Constructor and Description XMLWriter()
-
Method Summary
Methods Modifier and Type Method and Description static NodecreateDocument(java.lang.String version, java.lang.String encoding)Create XML document root node according to XML version and XML document encoding.static voidwriteAttributes(Node node, java.lang.String[] attributeNames, java.lang.String[] attributeValues)Add properties to the node.static NodewriteChildNode(Node node, java.lang.String nodeName)Add child nodes which have the specific name to the specific node.static NodewriteChildNode(Node node, java.lang.String nodeName, java.lang.String nodeValue)Add a child node with the specified name and the specified value to the node.static NodewriteChildNode(Node node, java.lang.String nodeName, java.lang.String[] attributeNames, java.lang.String[] attributeValues)Add child nodes which have the specific name, properties and property values to the specific node.static voidwriteChildNodes(Node node, java.lang.String nodeName, java.lang.String[] nodeValues)Add several child nodes which have the same name and different values to the specific node.
-
-
-
Method Detail
-
writeChildNode
public static Node writeChildNode(Node node, java.lang.String nodeName, java.lang.String nodeValue)
Add a child node with the specified name and the specified value to the node.- Parameters:
node- the parent node to add child node.nodeName- the name of the child node.nodeValue- the value of the child node.- Returns:
- the added child node.
-
writeAttributes
public static void writeAttributes(Node node, java.lang.String[] attributeNames, java.lang.String[] attributeValues)
Add properties to the node.- Parameters:
node- the node to add properties.attributeNames- attribute name array, which correspond to the attributeValues parameter.attributeValues- attribute value array, which correspond to the attributeNames parameter.
-
writeChildNodes
public static void writeChildNodes(Node node, java.lang.String nodeName, java.lang.String[] nodeValues)
Add several child nodes which have the same name and different values to the specific node.- Parameters:
node- the parent node to add child node.nodeName- the name of the added child node.nodeValues- the string array of the values of the added child nodes.
-
writeChildNode
public static Node writeChildNode(Node node, java.lang.String nodeName, java.lang.String[] attributeNames, java.lang.String[] attributeValues)
Add child nodes which have the specific name, properties and property values to the specific node.- Parameters:
node- the parent node to add child node.nodeName- the name of the added child node.attributeNames- attribute name array of the child node, which correspond to the attributeValues parameter.attributeValues- attribute value array of the child node, which correspond to the attributeNames parameter.- Returns:
- the added child node.
-
writeChildNode
public static Node writeChildNode(Node node, java.lang.String nodeName)
Add child nodes which have the specific name to the specific node.- Parameters:
node- the parent node to add child node.nodeName- the name of the added child node.- Returns:
- the added child node.
-
createDocument
public static Node createDocument(java.lang.String version, java.lang.String encoding)
Create XML document root node according to XML version and XML document encoding.
XML document node is like “<?xml version="version" encoding="encoding"?>”.
- Parameters:
version- XML version.encoding- XML document encoding.- Returns:
- XML document node.
-
-