Tag: dtd parsing

如何加载内联DTD以用于XDocument?

我有一个问题,关于如何将文档类型定义包含到XML文件中,或者从WP7中加载到XDocument中的XML文件中。 我有与此类似的DTD文件: <!DOCTYPE root [ ]> 我需要将这个DTD添加到XML中,以便捕获特殊字符,例如é 。 我使用以下方法从Web获取XML以在Linq中使用: 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); // Saving the XML to the file system […]