XMLDOM and XMLHTTP learning manual

xiaoxiao2021-03-06  104

XMLDOM learning notes

XMLDOM is a programming interface specification for accessing and operating an XML document.

1. Introduction XMLDOM is designed to be available for any language and any operating system. With DOM, programmers can create XML documents, traverse their structure, increase, change, and delete their elements. DOM regards the entire XML document as a tree, the element of the document level is the root of the tree.

2, the XML analysis of MS, IE5.0 or more. It is a COM component, contains at least the following object: (1) microsoft.xmldom (2) microsoft.xmldom.ParseError has the following properties:

PropertyDescriptionerrorCodeReturns a long integer error codereasonReturns a string explaining the reason for the errorlineReturns a long integer representing the line number for the errorlinePosReturns a long integer representing the line position for the errorsrcTextReturns a string containing the line that caused the errorurlReturns the url pointing the loaded documentfilePosReturns a Long Integer File Position of The Error

(3) Microsoft.xmlhttp, with the following properties:

PropertyDescriptionreadyStateReturns the state of the documentresponseBodyReturns the response as an array of unsigned bytesresponseStreamReturns the response as an IStreamresponseTextReturns the response as a stringresponseXMLReturns the response as an xml documentstatusReturns the status code as a numberstatusTextReturns the status as a string

There is a method:

PropertyDescriptionabort () Cancel the current http requestgetAllResponseHeaders () Returns the value of the http headersgetResponseHeader (headerName) Returns the value of one specified http headeropen (method, url, async, userid, password) Opens http request, and specifies the informationsend () Send ? The http request to the serversetRequestHeader (Headername, Headervalue) Specifies the name of a http header

(4) Node type

nodeTypeNamed ConstantnodeTypeStringnodeNamenodeValue1ELEMENT_NODEelementtagNamenull2ATTRIBUTE_NODEattributenamevalue3TEXT_NODEtext # textcontent of node4CDATA_SECTION_NODEcdatasection # cdata-sectioncontent of node5ENTITY_REFERENCE_NODEentityreferenceentity reference namenull6ENTITY_NODEentityentity namenull7PROCESSING_INSTRUCTION_NODEprocessinginstructiontargetcontent predetermined attribute node8COMMENT_NODEcomment # commentcomment text9DOCUMENT_NODEdocument # documentnull10DOCUMENT_TYPE_NODEdocumenttypedoctype namenull11DOCUMENT_FRAGMENT_NODEdocumentfragment # document fragmentnull12NOTATION_NODEnotationnotation namenullW3C of:

PropertyDescriptionattributesReturns a NamedNodeMap containing all attributes for this nodechildNodesReturns a NodeList containing all the child nodes for this nodefirstChildReturns the first child node for this nodelastChildReturns the last child node for this nodenextSiblingReturns the next sibling node. Two nodes are siblings if they have the same parent nodenodeNameReturns the nodeName, depending on the typenodeTypeReturns the nodeType as a numbernodeValueReturns, or sets, the value of this node, depending on the typeownerDocumentReturns the root node of the documentparentNodeReturns the parent node for this nodepreviousSiblingReturns the previous sibling node. Two nodes are siblings if they have the Same Parent Node

W3C specified method:

MethodDescriptionappendChild (newChild) Appends the node newChild at the end of the child nodes for this nodecloneNode (boolean) Returns an exact clone of this node. If the boolean value is set to true, the cloned node contains all the child nodes as wellhasChildNodes () returns true if this node has any child nodesinsertBefore (newNode, refNode) Inserts a new node, newNode, before the existing node, refNoderemoveChild (nodeName) Removes the specified node, nodeNamereplaceChild (newNode, oldNode) Replaces the oldNode, with the newNode (5 ) The properties and methods specified by the Nodelist's W3C.

PropertyDescriptionLENGTHRETURNS The Number of Nodes in a nodelist

MethodDescriptionItemReturns a specific node in the nodelist

转载请注明原文地址:https://www.9cbs.com/read-123988.html

New Post(0)