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.
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>" ) |
18.226.4.191