>  기사  >  백엔드 개발  >  jscript 및 vbscript를 사용하여 XML 요소 속성을 조작하는 방법 공유

jscript 및 vbscript를 사용하여 XML 요소 속성을 조작하는 방법 공유

Y2J
Y2J원래의
2017-04-26 13:57:071983검색

Jscript와 vbscript는 XML 요소 속성의 코드를 작동합니다. 필요한 친구가 이를 참조할 수 있습니다.

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

위 내용은 jscript 및 vbscript를 사용하여 XML 요소 속성을 조작하는 방법 공유의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.