I had a question about how to include the definition of a document type in an XML file or from an XML file that is loaded into XDocument, in WP7. I have a DTD file similar to this:
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE root [ <!ELEMENT root (Person*)> <!ELEMENT Person (Name*, Description*)> <!ELEMENT Name (#PCDATA)> <!ELEMENT Description (#PCDATA)> <!ENTITY egrave "è"> <!ENTITY eacute "é"> <!ENTITY euro "€"> ]>
I need to add this DTD to the XML that I get to catch special characters like é . I get XML from the Internet for use in Linq using the following method:
private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e) { string documentUrl = "http://www.example.com"; WebClient client = new WebClient(); client.OpenReadCompleted += new OpenReadCompletedEventHandler(client_OpenReadCompleted); client.OpenReadAsync(new Uri(documentUrl, UriKind.Absolute)); } void client_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e) { Stream str = e.Result; XDocument data = XDocument.Load(str);
It seems that XDocument will not pass XML if the DTD is inserted into a string, i.e. in the XML itself. I tried many ways to use XDocumentType based on this post, but I can't figure it out. How can i do this?
source share