Xmldom Object method: Object Properties _xml Base

Source: Internet
Author: User
Tags numeric value processing instruction tagname xml attribute xpath xsl
Async Property

functionThe Async property indicates whether asynchronous downloads are allowed.
Basic SyntaxBoolvalue = Xmldocument.async; Xmldocument.async = Boolvalue;
DescriptionBoolean values are Erasable (read/write), true if asynchronous downloads are allowed, or false on the contrary.
Example

Xmldoc.async = "false";
alert (Xmldoc.async);

=================================================

attribute Attributes

functionReturns a list of properties for the current node.
Basic SyntaxObjattributelist = xmlnode.attributes;
DescriptionReturns an object. If this node cannot contain a property, the go home value is passed.
Example

Objattlist = xmlDoc.documentElement.attributes;
alert (objattlist);

=================================================

ChildNodes Property

functionReturns a list of nodes that contain all the available child nodes of the node.
Basic SyntaxObjnodelist=node.childnodes;
DescriptionReturns an object. If the node does not have a child node, returns NULL.
Example

objNodeList = Xmldoc.childnodes;
alert (objnodelist);

=================================================

DOCTYPE Property

functionReturns the file type node containing the DTD for the current file. This node is a general file type declaration, for example, a node that is called an email node object is returned.
Basic SyntaxObjdoctype=xmldocument.doctype;
DescriptionReturns an object, which is read-only. If the file does not contain a DTD, it returns NULL.
Example

Objdoctype = Xmldoc.doctype;
alert (objdoctype.nodename);

=================================================

DocumentElement Property

functionConfirms the root node of the XML file.
Basic SyntaxObjdoc=xmldocument.documentelement;
DescriptionReturns an object that contains data in a single root file element. This property is readable/writable, and NULL is returned if the file does not contain a root node.
Example

Objdocroot = xmldoc.documentelement;
alert (objdocroot);

=================================================

FirstChild Property

functionConfirms the first child element in the current node.
Basic SyntaxObjfirstchild = Xmldocnode.firstchild;
DescriptionThis property is read-only and returns an object, which returns null if the node does not contain the first child element.
Example

Objfirstchild = XmlDoc.documentElement.firstChild;
alert (objfirstchild);

=================================================

Implementation Property

functionDOM applications can use objects in other implementation. The implementation property confirms the Domimplementation object for the current XML file.
Basic SyntaxObjimplementation = xmldocument.implementation;
DescriptionThis property is read-only and returns an object.
Example

Objimp = xmldoc.implementation;
alert (OBJIMP);

=================================================

LastChild Property

functionConfirms the last child element in the current node.
Basic SyntaxObjlastchild = Xmldocnode.lastchild;
DescriptionThis property is read-only and returns an object. If the node does not contain the last child element, NULL is returned.
Example

Objlastchild = XmlDoc.documentElement.lastChild;
alert (objlastchild);

=================================================

NextSibling Property

functionReturns the next sibling node in the list of child nodes of the current file node.
Basic Syntaxobjnextsibling = xmldocnode.nextsibling;
DescriptionThis property is read-only and returns an object. Null is returned if the node does not contain other related nodes.
Example

objsibling = XmlDoc.documentElement.childNodes.item (1). nextSibling;
alert (objsibling);

=================================================

NodeName Property

functionReturns a string representing the current node name.
Basic SyntaxStrnodename = Xmldocnode.nodename;
DescriptionReturns a string. This property is read-only and returns the element name, attribute, or entity reference.
Example

Strnodename = XmlDoc.documentElement.nodeName;
alert (strnodename);

=================================================

NodeType Property

functionIdentifies the DOM type of the node.
Basic SyntaxNumnodetype = Xmldocnode.nodetype;
DescriptionThis property is read-only and returns a numeric value.

Valid values correspond to the following types:
1-element
2-attribute
3-text
4-cdata
5-entity REFERENCE
6-entity
7-PI (processing instruction)
8-comment
9-document
10-document TYPE
11-document FRAGMENT
12-notation
 
Example

Numnodetype = XmlDoc.documentElement.nodeType;
alert (Numnodetype);

=================================================

NodeValue Property

functionReturns the text associated with the specified node. This is not the value of the data in an element, but rather the unresolved text associated with a node, like a property or a processing instruction.
Basic SyntaxVarnodevalue = Xmldocnode.nodevalue;
DescriptionThe text that is returned represents a type value that is based on the NodeType property of the node. (Refer to the NodeType property in the appendix.) Because the node type may be one of several data types, the return value is therefore different. The node types that return null are: Document, ELEMENT, document TYPE, document FRAGMENT, ENTITY, ENTITY REFERENCE, and notation. This property can be erased.
Example

Varnodevalue = XmlDoc.documentElement.nodeValue;
alert (Varnodevalue);

=================================================

ondataavailable Property

functionSpecify an event to handle the ondataavailable event.
Basic Syntaxxmldocnode.ondataavailable = value;
DescriptionThis property is write-only, allowing file authors to work with data as quickly as possible once the data is available.
Example

xmldoc.ondataavailable = Alert ("Data is now available.");

=================================================

onReadyStateChange Property

functionSpecify an event to handle the onReadyStateChange event. This event can identify changes in readystate properties.
Basic SyntaxXmldocnode.onreadystatechange = value;
DescriptionThis property is write-only, allowing the file author to specify a call event when the ReadyState property changes.
Example

Xmldoc.onreadystatechange = Alert ("The ReadyState property has changed.");

=================================================

Ownerdocument Property

functionReturns the root node of the file, containing the current node.
Basic SyntaxObjownerdoc = xmldocument.ownerdocument;
DescriptionThis property is read-only and returns an object containing the root node of the file, containing a specific node.
Example

Objownerdoc = XmlDoc.childNodes.item (2). Ownerdocument;
alert (Objownerdoc);

=================================================

ParentNode Property

functionReturns the parent node of the current node. Can only be applied to nodes that have parent nodes.
Basic SyntaxObjparentnode = Xmldocumentnode.parentnode;
DescriptionThis property is read-only and returns the parent node object that contains the specified node. If this node does not exist in the file tree, NULL is returned.
Example

Objparentnode = XmlDoc.childNodes.item (1). parentnode;
alert (Objparentnode);

=================================================

ParseError Property

functionReturns a DOM parsing Error object that describes the last message parsing the error.
Basic SyntaxObjparseerr = Xmldocument.parseerror;
DescriptionThis property is read-only. If no error occurs, 0 is returned.
Example

Objparseerr = Xmldoc.parseerror;
alert (OBJPARSEERR);

=================================================

PreviousSibling Property

functionReturns the sibling node before the current node.
Basic Syntaxobjprevsibling = xmldocument.previoussibling;
DescriptionReturns an object, which is read-only. If the node does not contain the preceding sibling node, it returns NULL.
Example

objprevsibling = XmlDoc.documentElement.childNodes.item (3). previoussibling;
alert (objprevsibling);

=================================================

ReadyState Property

functionReturns the current status of the XML file data.
Basic SyntaxIntstate = xmldocument.readystate;
DescriptionThis property is read-only, and the return value has the following potential:
The 0-uninitialized:xml object is generated, but no files are loaded.
1-loading: Loader is in progress, but file has not started parsing.
2-loaded: Part of the file has been loaded and parsed, but the object model has not yet taken effect.
3-interactive: Only the partially loaded files are valid, in which case the object model is valid but read-only.
4-completed: The file is fully loaded and represents a successful load.
Example

Alert ("The ReadyState property is" + Xmldoc.readystate);

=================================================

URL Property

functionReturns the URL that last loaded the XML file.
Basic SyntaxStrdocurl = Xmldocument.url;
DescriptionThis property is read-only, returns the URL to the last loaded success file, and returns null if the file exists only in main storage (which means that the file is not loaded by an external file).
Example

alert (Xmldoc.url);

=================================================

Validateonparse Property

functionTells the parser whether the file is valid.
Basic SyntaxBoolvalidate = Xmldocument.validateonparse; Xmldocument.validateonparse = boolvalidate;
DescriptionThis property is erasable. If the return value is true, it is validated that the file is resolved. If returned false, the file is invalid and is considered to be a standard format (well-formed) file.
Example

Xmldoc.validateonparse = true;
alert (xmldoc.validateonparse);

=================================================

XML attribute

functionReturns the XML description and all child nodes of the specified node.
Basic SyntaxXmlvalue = Xmldocumentnode.xml;
DescriptionThis property is read-only.
Example

Xmlvalue = XmlDoc.documentElement.xml;
alert (Xmlvalue);
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd" > <ptml> &L t;head> <meta http-equiv= "Content-type" content= "text/html"; Charset=utf-8 "> <title>methods and properties of microsoft.xmldom</title> <style type=" Text/css " > <!--body {margin-left:0px; margin-right:0px; margin-top:0px; Font-family:verdana, Helvetica, Sans-serif; font-size:12px; } h1 {color: #4274c2; font-size:22px; margin-left:0px; margin-top:25px; Font-family:monospace; } h2 {color: #4274c2; font-size:18px; margin-left:0px; Font-family:monospace; margin-bottom:5px; } h3 {color: #4274c2; font-size:16px; margin-left:10px; Font-family:monospace; margin-bottom:2px; } h4 {color: #4274c2; font-size:12px; margin-left:20px; Font-family:monospace; margin-bottom:2px; } A {color: #553333; } div.header A {color: #eeeecc; }Div.header {color: #eeeecc; } div.footer {margin-left:6px; } pre.code B {color: #000000; } pre.out B {color: #000000; } pre.code {background-color: #f6f9e3; Color: #10205f; padding-left:10px; padding-right:10px; padding-top:5px; padding-bottom:5px; margin-top:2px; border:1px solid #004080; margin-left:20px; } pre.out {background-color: #ebf6f9; Color: #000000; padding-left:10px; padding-right:10px; padding-top:5px; padding-bottom:2px; margin-top:2px; margin-left:20px; border:1px solid #b09040; } pre.syn {background-color: #efe9cf; Color: #000000; padding-left:10px; padding-right:10px; padding-top:5px; padding-bottom:2px; margin-top:2px; margin-left:20px; border:1px solid #4090b0; } Pre.syn B {color: #000000; Pre {padding:0px; margin-top:6px; margin-bottom:14px; margin-left:20px; } div.quote {margin-left:40px; margin-right:40px;border:1px dotted #e0e0c0; Background-color: #d5e5c5; font-size:11px; } div.small {padding-left:40px; padding-top:10px; font-size:9px; } div.txt {width:400px; margin-bottom:9px; margin-left:20px; } div.txt_wide {margin-bottom:9px; margin-left:20px; } img.img {margin-left:20px; Body Table tr TD Table {margin-left:20px; } div.filename {font-size:10px; Font-style:italic; margin-left:20px; } ul {margin-top:1px;margin-bottom:9px;} OL {margin-top:1px;margin-bottom:9px;} Li {margin-bottom:2px}--> </style> </pead> <body bgcolor= "#eeeecc" text= "#000000" onload= "if ( Self!= top) top.location = self.location; > <table border=0 cellpadding=0 cellspacing=0 width=100% summary= ' layout table ' > <tr valign= ' top ' &GT;&L T;td><p>methods and properties of microsoft.xmldom</p> </td></tr> <tr valign= ' top ' > <td> <p>Document</p> <p>Properties</p> <div class= ' txt ' > <ul> <li>async boolean:spe Cifies whether asynchronous download of the document is permitted. <li>doctype <li>documentelement <li>implementation <li>ondataavailable [ie] <li >onreadystatechange [ie] <li>ontransformnode [ie] <li>parseerror [ie] <li>preservewhit eSpace [ie] <li>readystate <li>resolveexternals [ie] <li>setproperty) [ie] the Follo Wing (2<sup>nd</sup> level) properties can is set: <ul> <li>allowdocumentfunction <li >forcedresync <li>maxxmlsize <li>newparser <li>selectionlanguage <li>Select Ionnamespace <li>serverhttprequest </ul> <p> for example: &LT;CODE&GT;XMLDOC.SETP Roperty ("SelectionLanguage", "XPath"); Selection = Xmldoc.selectnOdes ("//customer");</code> <li>url [ie] <li>validateonparse [ie] </ul> </d iv> <p>Methods</p> <div class= ' txt ' > <ul> <li>abort [ie] <li>createattribute <li>createcdatasection (data) <li>createcomment (comment) <li& Gt;createdocumentfragment (data) <li>createelement (tagName) <li>createentityreference (name) <li>createnode [IE] (type, name, NamespaceURI) <li>createprocessinginstruction (target, data) &L T;li>createtextnode (data) <li>getelementsbytagname (tagName) <li>load [ie] (URL) <l I>loadxml [ie] (xml_string) <li>nodefromid [ie] (id_string) <li>save [ie] (objtarget) </ul> </div> <p>Node</p> <p>Properties</p> <div class= ' t XT ' > <ul> <li>attributes returns an array of objects. An object in this array has the <i>name</i> and <i>value</i> property. <li>basename [ie] <li>childnodes <li>datatype [ie] <li>definition [ie] <l I>firstchild <li>lastchild <li>namespaceuri [ie] <li>nodename <li>nodetype Can be <ul> <li>1:element <li>2:attribute <li>3:text <li>4:cdat A section <li>5:entity Reference <li>6:entity <li>7:processing instruction <li >8:comment <li>9:document <li>10:document Type <li>11:document Fragment <l I>12:notation </ul> <li>nodetypedvalue [ie] <li>nodetypestring [ie] <li>no Devalue this property defines the content of a div. The following example uses NodeValue to write the SEconds since the page being loaded: <div><pre class=code> <script type= ' text/javascript ' > var secs=0 ; SetTimeout (' Write_seconds () ', 1000); 1 second function write_seconds () {var span; if (document.getElementById) {span = document.getElementById (' time '); if (span && span.firstchild && span.firstChild.nodeType = 3) {span.firstChild.nodeValue = secs; secs++; } settimeout (' Write_seconds () ', 1000); 1 Second}} </script> <span id= ' time ' >0</span> </pre></div> <li>own Erdocument <li>parentnode <li>parsed [ie] <li>prefix <li>previoussibling [ie] <li>specified [ie] <li>text [ie] <li>xml [ie] </ul> </div> <p>Methods</p> <div class= ' txt ' > <ul> <li>appendchild (tagName) <li >clonenode (deep) If <i>d eep</i> is true, the children and children ' s children are cloned as. <li>haschildnodes () <li>insertbefore (newchild, Refchild) <li>removechild (child) &L T;li>replacechild (newchild, oldchild) <li>selectnodes [ie] (patternstring) Returns a list of node S. For example: <code> xmldoc.setproperty ("SelectionNamespaces", "xmlns:xsl=" Http://www.w3.org/1999/XS L/transform ' "); Xmldoc.setproperty ("SelectionLanguage", "XPath"); objNodeList = XmlDoc.documentElement.selectNodes ("//xsl:template"); </code> <li>selectsinglenode [ie] (patternstring) <li>transformnode [ie] (stylesheet) &L T;li>transformnodetoobject [ie] (stylesheet, outputobject) </ul> </div> <p>thanks</p > <div class= ' txt ' > <b>enrique a. gamez</b> who notified me the a type on this PA Ge. </div> </td></tr></table> </body></ptml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.