午夜剧场伦理_日本一道高清_国产又黄又硬_91黄色网战_女同久久另类69精品国产_妹妹的朋友在线

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

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

瀏覽:502日期: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
相關文章:
主站蜘蛛池模板: 中文字幕亚洲视频 | 欧美精品三级 | 久久精品第一页 | 美国三级大片 | 日韩成人中文字幕 | 欧美日韩小视频 | 欧美区亚洲区 | 尤物天堂 | 国产女人18水真多毛片18精品 | 日本一二三不卡视频 | 日韩欧美一区二区三区在线 | 丝袜美腿亚洲综合 | 自拍偷拍国产 | 久久99久久99精品免视看婷婷 | 精品小视频 | 亚洲欧美另类视频 | 国产一区二区三区18 | 青娱乐精品 | 奇米影视狠狠干 | 青青艹av| 欧美人与性动交a欧美精品 天天干天天天天 | 麻豆视频免费入口 | 神马久久久久久久久久 | 成人三级视频在线观看 | 午夜网 | 成人在线高清视频 | 国产三级视频在线播放 | 99免费在线 | 国产91精品久久久 | 在线a网 | 一道本av| 欧美日韩一级在线 | 一二三区精品视频 | 少妇又色又紧又黄又刺激免费 | 精品国产aⅴ麻豆 | 国产精品免费在线视频 | 国内免费精品视频 | 亚洲人成人一区二区在线观看 | 国产一区二区播放 | 成年人在线观看视频网站 | 精品免费在线视频 |