国产成人精品久久免费动漫-国产成人精品天堂-国产成人精品区在线观看-国产成人精品日本-a级毛片无码免费真人-a级毛片毛片免费观看久潮喷

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

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

瀏覽:197日期: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
相關文章:
主站蜘蛛池模板: 欧美日韩亚洲高清不卡一区二区三区 | 131的美女午夜爱爱爽爽视频 | 欧美在线区| 国产激情一区二区三区在线观看 | 一区二区三区在线免费看 | 九九视频在线看精品 | 古代级a毛片可以免费看 | 亚洲成人免费在线观看 | 久久国产精品久久国产精品 | 日韩美a一级毛片 | 国内自拍视频在线播放 | 免费女人18毛片a级毛片视频 | 国产乱码精品一区二区三区卡 | 午夜刺激爽爽视频免费观看 | 一区二区三区在线视频观看 | free性丰满白嫩白嫩的hd | 国产精品黄在线观看观看 | 国产精品免费视频一区 | 久久精品午夜视频 | 日韩精品久久久免费观看夜色 | 国产精品国产高清国产专区 | 狠狠色噜噜狠狠狠米奇9999 | 国产男女 爽爽爽爽视频 | 午夜性爽视频男人的天堂在线 | 成人免费网站视频www | 欧美一级毛片在线一看 | 暖暖免费高清日本一区二区三区 | 亚洲视频手机在线 | 国产高清在线精品 | 精品伊人久久久久7777人 | 久久国产精品久久久 | 岛国大片在线播放高清 | 精品日本一区二区三区在线观看 | www国产精品| 特级毛片在线播放 | 免费视频一区二区 | 久久久久一区二区三区 | 最新理论三级中文在线观看 | 久久亚洲精品中文字幕亚瑟 | 欧美亚洲国产视频 | 欧美一区二区三区免费不卡 |