Quantcast
Channel: VMware Communities : Discussion List - vRealize Orchestrator
Viewing all articles
Browse latest Browse all 6251

How to extract an XML attribute

$
0
0

I want to extract the NetworkConnection network name (none) in the following xml content:

 

<ns6:NetworkConnection network="none" needsCustomization="true" xmlns="http://www.vmware.com/vcloud/versions" xmlns:ns2="http://schemas.dmtf.org/ovf/envelope/1" xmlns:ns3="http://schemas.dmtf.org/wbem/wscim/1/common" xmlns:ns4="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:ns5="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:ns6="http://www.vmware.com/vcloud/v1.5" xmlns:ns7="http://www.vmware.com/schema/ovf" xmlns:ns8="http://schemas.dmtf.org/ovf/environment/1" xmlns:ns9="http://www.vmware.com/vcloud/extension/v1.5">

  <ns6:NetworkConnectionIndex>0</ns6:NetworkConnectionIndex>

  <ns6:IsConnected>false</ns6:IsConnected>

  <ns6:MACAddress>00:50:56:3f:03:5c</ns6:MACAddress>

  <ns6:IpAddressAllocationMode>NONE</ns6:IpAddressAllocationMode>

</ns6:NetworkConnection>

 

 

I have:

 

var nsXML = ns.toXml();

 

    var doc = new XML(nsXML);
    //default xml namespace = doc.namespace();
    var networkName = doc.NetworkConnection.network;;
    System.log(networkName);

 

and am getting null

 

I dont know how to reference the attribute.


Viewing all articles
Browse latest Browse all 6251

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>