Xmldom Object method: Object Properties

Source: Internet
Author: User
Tags object contains numeric value object model processing instruction string valid xml attribute
Dom|xml| Object Async Property

Role

The Async property indicates whether asynchronous downloads are allowed.

Basic syntax

Boolvalue = Xmldocument.async; Xmldocument.async = Boolvalue;

Description

Boolean 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

Role

Returns a list of properties for the current node.

Basic syntax

Objattributelist = xmlnode.attributes;

Description

Returns an object. If this node cannot contain a property, the go home value is passed.

Example

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

ChildNodes Property

Role

Returns a list of nodes that contain all the available child nodes of the node.

Basic syntax

Objnodelist=node.childnodes;

Description

Returns an object. If the node does not have a child node, returns NULL.

Example

objNodeList = Xmldoc.childnodes;
alert (objnodelist);

DOCTYPE property

Role

Returns 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 syntax

Objdoctype=xmldocument.doctype;

Description

Returns 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

Role

Confirms the root node of the XML file.

Basic syntax

Objdoc=xmldocument.documentelement;

Description

Returns 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

Role

Confirms the first child element in the current node.

Basic syntax

Objfirstchild = Xmldocnode.firstchild;

Description

This 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

Role

DOM applications can use objects in other implementation. The implementation property confirms the Domimplementation object for the current XML file.

Basic syntax

Objimplementation = xmldocument.implementation;

Description

This property is read-only and returns an object.

Example

Objimp = xmldoc.implementation;
alert (OBJIMP);

LastChild Property

Role

Confirms the last child element in the current node.

Basic syntax

Objlastchild = Xmldocnode.lastchild;

Description

This 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

Role

Returns the next sibling node in the list of child nodes of the current file node.

Basic syntax

objnextsibling = xmldocnode.nextsibling;

Description

This 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

Role

Returns a string representing the current node name.

Basic syntax

Strnodename = Xmldocnode.nodename;

Description

Returns 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

Role

Identifies the DOM type of the node.

Basic syntax

Numnodetype = Xmldocnode.nodetype;

Description


This 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

Role

Returns 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 syntax

Varnodevalue = Xmldocnode.nodevalue;

Description

The 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

Role

Specify an event to handle the ondataavailable event.

Basic syntax

xmldocnode.ondataavailable = value;

Description

This 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

Role

Specify an event to handle the onReadyStateChange event. This event can identify changes in readystate properties.

Basic syntax

Xmldocnode.onreadystatechange = value;

Description

This 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

Role

Returns the root node of the file, containing the current node.

Basic syntax

Objownerdoc = xmldocument.ownerdocument;

Description

This 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

Role

Returns the parent node of the current node. Can only be applied to nodes that have parent nodes.

Basic syntax

Objparentnode = Xmldocumentnode.parentnode;

Description

This 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

Role

Returns a DOM parsing Error object that describes the last message parsing the error.

Basic syntax

Objparseerr = Xmldocument.parseerror;

Description

This property is read-only. If no error occurs, 0 is returned.

Example

Objparseerr = Xmldoc.parseerror;
alert (OBJPARSEERR);

PreviousSibling Property

Role

Returns the sibling node before the current node.

Basic syntax

objprevsibling = xmldocument.previoussibling;

Description

Returns 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

Role

Returns the current status of the XML file data.

Basic syntax

Intstate = xmldocument.readystate;

Description


This 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

Role

Returns the URL that last loaded the XML file.

Basic syntax

Strdocurl = Xmldocument.url;

Description

This 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

Role

Tells the parser whether the file is valid.

Basic syntax

Boolvalidate = Xmldocument.validateonparse;
Xmldocument.validateonparse = boolvalidate;

Description

This 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

Role

Returns the XML description and all child nodes of the specified node.

Basic syntax

Xmlvalue = Xmldocumentnode.xml;

Description

This property is read-only.

Example

Xmlvalue = XmlDoc.documentElement.xml;
alert (Xmlvalue);



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.