I am brand new to working with LINQ. For whatever reason, I am having a very hard time digesting it. The XML document I have seems to be pretty simple, but I am not finding any pages that are helping me.
I need to extract the AttributeValue field from each. (Not as a for each, but discreetly and store in a dedicated var for each AttributeId.)
This is the XML:
<?xml version="1.0" encoding="UTF-8"?>
<Request xmlns="urn:oasis:names:tc:xacml:2.0:context:schema:os">
<Subject SubjectCategory="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject">
<Attribute AttributeId="urn:oasis:names:tc:xacml:1.0:subject:role-id" DataType="http://www.w3.org/2001/XMLSchema#string" Issuer="requestor">
<AttributeValue>CISCO:UC:UCMPolicy</AttributeValue>
</Attribute>
<Attribute AttributeId="urn:Cisco:uc:1.0:callingnumber" DataType="http://www.w3.org/2001/XMLSchema#string">
<AttributeValue>10000</AttributeValue>
</Attribute>
<Attribute AttributeId="urn:Cisco:uc:1.0:callednumber" DataType="http://www.w3.org/2001/XMLSchema#string">
<AttributeValue>94146172510</AttributeValue>
</Attribute>
<Attribute AttributeId="urn:Cisco:uc:1.0:transformedcgpn" DataType="http://www.w3.org/2001/XMLSchema#string">
<AttributeValue>10000</AttributeValue>
</Attribute>
<Attribute AttributeId="urn:Cisco:uc:1.0:transformedcdpn" DataType="http://www.w3.org/2001/XMLSchema#string">
<AttributeValue>888884146172510</AttributeValue>
</Attribute>
</Subject>
<Resource>
<Attribute AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id" DataType="http://www.w3.org/2001/XMLSchema#anyURI">
<AttributeValue>CISCO:UC:VoiceOrVideoCall</AttributeValue>
</Attribute>
</Resource>
<Action>
<Attribute AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id" DataType="http://www.w3.org/2001/XMLSchema#anyURI">
<AttributeValue>any</AttributeValue>
</Attribute>
</Action>
<Environment>
<Attribute AttributeId="urn:Cisco:uc:1.0:triggerpointtype" DataType="http://www.w3.org/2001/XMLSchema#string">
<AttributeValue>translationpattern</AttributeValue>
</Attribute>
</Environment>
</Request>
What I have managed to try so far is not working:
var query = from t in root.Descendants("Action") where (string)t.Attribute("Attribute") == "urn:oasis:names:tc:xacml:1.0:action:action-id" select t;
As I am still trying to figure this out, I am sure I am giving all the info needed. Let me know what I am missing.