<?xml version="1.0" encoding="UTF-8"?>
<vmext:Notification xmlns:vmext="http://www.vmware.com/vcloud/extension/v1.5" eventId="cd35c994-5e3b-4947-a435-bae3c8886af5" type="com/vmware/vcloud/event/vm/create" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/extension/v1.5 http://vcd.hostcenter.dk/api/v1.5/schema/vmwextensions.xsd">
<vmext:EntityLink rel="entity" id="urn:vcloud:vm:f76c9a4c-b94f-4019-a014-359c8107bc18" name="Windows Server 2016 Datacenter-1" type="vcloud:vm"/>
<vmext:EntityLink rel="down" id="urn:vcloud:user:3c35fb93-39a2-4fc6-aad7-5d06e138e9e4" name="system" type="vcloud:user"/>
<vmext:EntityLink rel="up" id="urn:vcloud:org:bb878c05-b433-469f-8d76-5f17b89836de" name="xxxxx.xxx" type="vcloud:org"/>
<vmext:Timestamp>2017-05-03T17:04:46.311+02:00</vmext:Timestamp>
<vmext:OperationSuccess>true</vmext:OperationSuccess>
</vmext:Notification>
System.log(myString) <-- the xml data from top
var document = XMLManager.fromString(myString);
var members = document.getElementsByTagName("vmext:EntityLink");
System.log(members.length)
for (i = 0; i < members.length; i++){
System.log(members[i].attributes["ID"].value)
}
我想從所有的vmext ID:EntityLink我剛剛返回NULL需要幫助讀取XML @ JS
如果你能幫助我將很樂意
你嘗試過這麼遠嗎? – jediz
var document = XMLManager.fromString(myString); var members = document.getElementsByTagName(「vmext:EntityLink」)。getAttribute(「id」); SYSTEM.LOG(members.length) 爲(I = 0; I
我得到這樣的過時間 「無法調用 」的Java腳本它在側面的VMware vrealize配器 VAR文件= XMLManager.fromString(MyString的)「 空的」 –