色综合图-色综合图片-色综合图片二区150p-色综合图区-玖玖国产精品视频-玖玖香蕉视频

您的位置:首頁技術文章
文章詳情頁

jscript與vbscript 操作XML元素屬性的代碼

瀏覽:200日期:2022-06-04 11:41:41
Although attributes belong to a particular element, they are not considered child nodes of element nodes. Instead, they behave more like properties of IXMLDOMElement.

Most of the methods for working with attributes come from IXMLDOMElement. Attributes can be manipulated in the following ways.

Directly, through the getAttribute and setAttribute methods of IXMLDOMElement.

As named IXMLDOMAttribute nodes, with getAttributeNode and setAttributeNode.

As a set of nodes accessible through the attributes property and returned as an IXMLNamedNodeMap.

Examples
JScript
The following JScript example creates a new document containing a <memo> element, and then creates an attribute named author with a value of "Pat Coleman".
復制代碼 代碼如下:
var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.3.0");
var rootElement=xmlDoc.createElement("memo");
rootElement.setAttribute("author", "Pat Coleman");
xmlDoc.appendChild(rootElement);


VBScript
復制代碼 代碼如下:
Set xmlDoc = CreateObject("Msxml2.DOMDocument.3.0")
Set rootElement=xmlDoc.createElement("memo")
rootElement.setAttribute("author", "Pat Coleman")
xmlDoc.appendChild(rootElement)


If you prefer to work with attribute nodes, you can create the attribute, and then create a text node to store its value. Attribute nodes can only contain text nodes and entity reference nodes. (If you need to create an attribute containing an entity reference, you must use this approach.)

Working with attribute nodes requires using the DOMDocument object to create attribute and text (and entity reference, if necessary) nodes before assigning the nodes to the element.

JScript
The following JScript code uses this approach to perform the same work as the preceding examples, creating a <memo> element with an author attribute holding the value "Pat Coleman".

復制代碼 代碼如下:
var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.3.0");
var rootElement=xmlDoc.createElement("memo");
var memoAttribute=xmlDoc.createAttribute("author");
var memoAttributeText=xmlDoc.createTextNode("Pat Coleman");
memoAttribute.appendChild(memoAttributeText);
rootElement.setAttributeNode(memoAttribute);
xmlDoc.appendChild(rootElement);


VBScript
復制代碼 代碼如下:
Set xmlDoc = CreateObject("Msxml2.DOMDocument.3.0")
Set rootElement=xmlDoc.createElement("memo")
Set memoAttribute=xmlDoc.createAttribute("author")
Set memoAttributeText=xmlDoc.createTextNode("Pat Coleman")
memoAttribute.appendChild(memoAttributeText)
rootElement.setAttributeNode(memoAttribute)
xmlDoc.appendChild(rootElement)
標簽: XML/RSS
相關文章:
主站蜘蛛池模板: 成人做爰 | 91精品国产91热久久p | 亚洲不卡一区二区三区在线 | 亚洲国产第一区二区三区 | 我要看三级毛片 | 香蕉亚洲精品一区二区 | 福利云 | 日产日韩亚洲欧美综合搜索 | 玖玖精品国产 | 国产精品18久久久久久久久久 | 国产精品日韩欧美在线第3页 | 中文字幕在线观看不卡视频 | 日韩性黄色一级 | 色视频在线观看视频 | 国产一在线 | 欧美在线视频观看 | 国产精品7m凸凹视频分类大全 | 男人天堂网在线视频 | 欧美色成人tv在线播放 | 免费视频观看在线www日本 | 欧美国一级毛片片aa | 国产亚洲欧美日韩在线观看一区二区 | 91免费国产高清观看 | 久久亚洲综合中文字幕 | 午夜一级毛片不卡 | 亚洲第一网色综合久久 | 女人被男人躁得好爽免费视频免费 | 九九九九热精品免费视频 | 国产大片在线观看 | 亚洲在线中文字幕 | 香蕉成人国产精品免费看网站 | 国产美女做爰免费视频网址 | 国产精品爱久久久久久久小 | 97国产在线观看 | 一级做a爰片性色毛片中国 一级做a爰性色毛片 | 久久亚洲国产的中文 | 毛片免费观看的视频在线 | 美女黄网站色一级毛片 | 日本一道免费一区二区三区 | 国产91精品一区 | 成人免费一级片 |