Differences from the Desktop .NET Framework


The .NET Compact Framework's XML DOM implementation does not support schema validation or DTDs. This means that the only entities that will be resolved are the five standard XML entities: < , > , & , and ' . Other entities will cause a System.NotSupportedException to be thrown while parsing or loading the document. Also, documents that contain DOCTYPE nodes cannot be loaded. Again, a System.NotSupportedException will be thrown while parsing or loading the document. Finally, element-to-element references using the ID , IDREF , and IDREFS attributes are not supported. Although they will not raise exceptions, you will not be able to use them for navigating from one element to another using the ID attribute. Each call to LoadXml in Listing 11.1 will raise a System.NotSupportedException because of unsupported DTD functionality.

Listing 11.1
 C# // Raise an exception when reading the DOCTYPE node XmlDocument doc = new XmlDocument(); doc.LoadXml("<!DOCTYPE person [ " +             "<!ELEMENT first_name (#PCDATA)> " +             "]>" +             "<root>" +             "</root>" ); // Raise an exception when reading an entity doc = new XmlDocument(); doc.LoadXml("<root>&bogus;</root>" ); VB 'Raise an exception when reading the DOCTYPE node Dim doc As New XmlDocument() doc.LoadXml("<!DOCTYPE person [ " & _             "<!ELEMENT first_name (#PCDATA)> " & _             "]>" & _             "<root>" & _             "</root>" ) ' Raise an exception when reading an entity doc = new XmlDocument() doc.LoadXml("<root>&bogus;</root>" ) 


Microsoft.NET Compact Framework Kick Start
Microsoft .NET Compact Framework Kick Start
ISBN: 0672325705
EAN: 2147483647
Year: 2003
Pages: 206

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net