VMware Cloud Community
VladimirMytko
Contributor
Contributor

XML Parsing

Hi!

Can I parse xml with properties like this?

 

<?xml version="1.0" encoding="utf-8" standalone="yes"?>

<entry xml:base="https://scorch.hq.bc/Orchestrator2012/Orchestrator.svc/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" m:etag="W/&quot;datetime'2022-06-27T08%3A44%3A53.017'&quot;" xmlns="http://www.w3.org/2005/Atom">

<id>https://scorch.hq.bc/Orchestrator2012/Orchestrator.svc/Jobs(guid'80a7816b-1507-48a7-9bb7-3b04f31c7db...')</id>

<title type="text"></title>

<published>2022-06-27T08:44:53+06:00</published>

<updated>2022-06-27T08:44:53+06:00</updated>

<author>

<name />

</author>

<link rel="edit" title="Job" href="Jobs(guid'80a7816b-1507-48a7-9bb7-3b04f31c7db5')" />

<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Runbook" type="application/atom+xml;type=entry" title="Runbook" href="Jobs(guid'80a7816b-1507-48a7-9bb7-3b04f31c7db5')/Runbook" />

<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Instances" type="application/atom+xml;type=feed" title="Instances" href="Jobs(guid'80a7816b-1507-48a7-9bb7-3b04f31c7db5')/Instances" />

<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/RunbookServer" type="application/atom+xml;type=entry" title="RunbookServer" href="Jobs(guid'80a7816b-1507-48a7-9bb7-3b04f31c7db5')/RunbookServer" />

<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Statistics" type="application/atom+xml;type=feed" title="Statistics" href="Jobs(guid'80a7816b-1507-48a7-9bb7-3b04f31c7db5')/Statistics" />

<category term="Microsoft.SystemCenter.Orchestrator.WebService.Job" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />

<content type="application/xml">

<m:properties>

<d:Id m:type="Edm.Guid">80a7816b-1507-48a7-9bb7-3b04f31c7db5</d:Id>

<d:RunbookId m:type="Edm.Guid">5a2c9bc4-cbcb-4dcb-8dec-7cbe9b2414ba</d:RunbookId>

<d:Parameters>&lt;Data&gt;&lt;Parameter&gt;&lt;ID&gt;{f238917b-fab4-41fe-981e-8cc5aec3ed2b}&lt;/ID&gt;&lt;Value&gt;template2019vol.hq.bc&lt;/Value&gt;&lt;/Parameter&gt;&lt;/Data&gt;</d:Parameters>

<d:RunbookServers m:null="true" />

<d:RunbookServerId m:type="Edm.Guid" m:null="true" />

<d:ParentId m:type="Edm.Guid" m:null="true" />

<d:ParentIsWaiting m:type="Edm.Boolean">false</d:ParentIsWaiting>

<d:Status>Pending</d:Status>

<d:CreatedBy>S-1-5-21-1451182435-1389936362-2546935155-158317</d:CreatedBy>

<d:CreationTime m:type="Edm.DateTime">2022-06-27T08:44:53.017</d:CreationTime>

<d:LastModifiedBy>S-1-5-21-1451182435-1389936362-2546935155-158317</d:LastModifiedBy>

<d:LastModifiedTime m:type="Edm.DateTime">2022-06-27T08:44:53.017</d:LastModifiedTime>

</m:properties>

</content>

</entry>

 

I need to addres that line: <d:Status>Pending</d:Status>.

And unfortunately way pointed below doesnt work.

var XML = new XML(XMLString);
var ns = new Namespace("http://www.w3.org/2005/Atom");
var data = XML.ns::content.properties.Status;
 
Please help.
Reply
0 Kudos
0 Replies