XDocument class not recognised

  • Thread starter Thread starter dev100
  • Start date Start date
D

dev100

Hi, we are trying to get some code previously compiled in 3.5 CF
into a V2.0 CF build using VS2008 The compiler doesn't like the XDocument
class.
Looking around the docs it appears that XmlDocument is the closest
equivalent from CF 2.0. Is this correct?

Thanks
 
XDocument is a CF 3.5 class part of the System.Xml.Linq namespace (CF 3.5
namespace). You can't use this on CF 2.0.

You can use anything in System.Xml on CF 2.0 and yes XmlDocument is one way
of parsing XML on CF 2.0.
 
XDocument is a CF 3.5 class part of the System.Xml.Linq namespace (CF 3.5
namespace). You can't use this on CF 2.0.

You can use anything in System.Xml on CF 2.0 and yes XmlDocument is one way
of parsing XML on CF 2.0.
 
Thanks, how to get an element by the tag name, it seems there is only
GetElementsByTagName which returns a list of nodes.
eg if i have this

<product>
<name>Prod1</name>
<id>1000</id>
<price>25.98</price>
</product>

So if i want to directly get the value of id, how to easily get without
iterating through the product list of tags one by one

foreach (XmlElement e in xmlDoc.GetElementsByTagName("product")) // this
gives me the product tag

{

// how do i just get the value of the id or price here without iterating
the list

}


Simon Hart said:
XDocument is a CF 3.5 class part of the System.Xml.Linq namespace (CF 3.5
namespace). You can't use this on CF 2.0.

You can use anything in System.Xml on CF 2.0 and yes XmlDocument is one
way of parsing XML on CF 2.0.

--
Simon Hart
Visual Developer - Device Application Development MVP
http://www.simonrhart.com




__________ Information from ESET Smart Security, version of virus
signature database 4091 (20090520) __________

The message was checked by ESET Smart Security.

http://www.eset.com



__________ Information from ESET Smart Security, version of virus signature database 4091 (20090520) __________

The message was checked by ESET Smart Security.

http://www.eset.com
 
Thanks, how to get an element by the tag name, it seems there is only
GetElementsByTagName which returns a list of nodes.
eg if i have this

<product>
<name>Prod1</name>
<id>1000</id>
<price>25.98</price>
</product>

So if i want to directly get the value of id, how to easily get without
iterating through the product list of tags one by one

foreach (XmlElement e in xmlDoc.GetElementsByTagName("product")) // this
gives me the product tag

{

// how do i just get the value of the id or price here without iterating
the list

}


Simon Hart said:
XDocument is a CF 3.5 class part of the System.Xml.Linq namespace (CF 3.5
namespace). You can't use this on CF 2.0.

You can use anything in System.Xml on CF 2.0 and yes XmlDocument is one
way of parsing XML on CF 2.0.

--
Simon Hart
Visual Developer - Device Application Development MVP
http://www.simonrhart.com




__________ Information from ESET Smart Security, version of virus
signature database 4091 (20090520) __________

The message was checked by ESET Smart Security.

http://www.eset.com



__________ Information from ESET Smart Security, version of virus signature database 4091 (20090520) __________

The message was checked by ESET Smart Security.

http://www.eset.com
 
Back
Top