The XMLDOMDocument object provides two ways to create a node or XMLDOMNode: CreateElement and CreateNode. Choosing which of these methods depends on how much information you need to provide the node. When you use the CreateElement method, simply provide the node name, such as
Set Objxmlroot = objXMLDoc _
. CreateElement ("Order_status")
When using the CreateNode method, you specify the node type, node name, and correlation Name field. (An XML Name field lets you create multiple XML elements with the same name in the same document) For example, if you want to use the CreateNode method, you can write the following code:
Set Objxmlroot = objXMLDoc _
. CreateNode ("element", _
"Order_status", "Space1")
Once you have created the endpoint, you must add it to the XML document. This is going to take the AppendChild method, for example, to continue with the above example, you can write:
Objxmldoc.appendchild (Objxmlroot)
This statement creates an XML root node, see Figure A in Internet Explorer 5.0.
Figure A: Creating the root node of an XML document with an XML DOM
In addition to the AppendChild method, the XMLDOMNode object also has three other methods for controlling XML nodes: ReplaceChild, RemoveChild, and InsertBefore
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.