locked
best way to parse below xml in C# for windows store app RRS feed

  • Question

  • I have the below xml (for a upnp device):

    <root xmlns="urn:schemas-upnp-org:device-1-0">
    <specVersion>
    <major>1</major>
    <minor>0</minor>
    </specVersion>
    <device>
    <deviceType>urn:schemas-upnp-org:device:MediaServer:1</deviceType>
    <dlna:X_DLNADOC xmlns:dlna="urn:schemas-dlna-org:device-1-0">DMS-1.00</dlna:X_DLNADOC>
    <intel_nmpr:X_INTEL_NMPR xmlns:intel_nmpr="urn:schemas-intel-com:device-1-0">2.0</intel_nmpr:X_INTEL_NMPR>
    <friendlyName>A300: UPnP AV Server</friendlyName>
    <manufacturer>Syabas Technology Sdn Bhd</manufacturer>
    <manufacturerURL>http://www.syabas.com</manufacturerURL>
    <modelDescription>UPnP/AV Media Server</modelDescription>
    <modelName>myiHome Media Server</modelName>
    <modelNumber>1.0</modelNumber>
    <serialNumber>0000001</serialNumber>
    <UDN>uuid:757569643a003a063adc3a833a123a9e</UDN>
    <iconList>
    <icon>
    <mimetype>image/png</mimetype>
    <width>48</width>
    <height>48</height>
    <depth>8</depth>
    <url>/icon/nas_on48.png</url>
    </icon>
    <icon>
    <mimetype>image/png</mimetype>
    <width>120</width>
    <height>120</height>
    <depth>8</depth>
    <url>/icon/nas_on120.png</url>
    </icon>
    <icon>
    <mimetype>image/jpeg</mimetype>
    <width>48</width>
    <height>48</height>
    <depth>24</depth>
    <url>/icon/nas_on48.jpg</url>
    </icon>
    <icon>
    <mimetype>image/jpeg</mimetype>
    <width>120</width>
    <height>120</height>
    <depth>24</depth>
    <url>/icon/nas_on120.jpg</url>
    </icon>
    </iconList>
    <serviceList>
    <service>
    <serviceType>urn:schemas-upnp-org:service:ConnectionManager:1</serviceType>
    <serviceId>urn:upnp-org:serviceId:ConnectionManager</serviceId>
    <SCPDURL>ConnectionManager/scpd.xml</SCPDURL>
    <controlURL>ConnectionManager/control</controlURL>
    <eventSubURL>ConnectionManager/event</eventSubURL>
    </service>
    <service>
    <serviceType>urn:schemas-upnp-org:service:ContentDirectory:1</serviceType>
    <serviceId>urn:upnp-org:serviceId:ContentDirectory</serviceId>
    <SCPDURL>ContentDirectory/scpd.xml</SCPDURL>
    <controlURL>ContentDirectory/control</controlURL>
    <eventSubURL>ContentDirectory/event</eventSubURL>
    </service>
    </serviceList>
    </device>
    </root>

    i want to to get the icon url /icon/nas_on120.jpg from above where it is the first icon where height=120 and mimetype=image/jpeg 

    I am looking for c# syntax (not VB) maybe using linq if it helps. i tried using the windows.data.xml classes and am finding it impossible. 



    • Edited by Rumman Tuesday, November 5, 2013 1:45 AM
    Monday, November 4, 2013 3:08 PM

Answers

  • This is more of an XML question than anything - you might want to try in the XML forums for a better response.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    • Marked as answer by Anne Jing Tuesday, November 12, 2013 3:49 AM
    Monday, November 4, 2013 9:30 PM
    Moderator