An Error Has Occurred While Opening External Dtd
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might
An Error Has Occurred While Opening Eclipse
have Meta Discuss the workings and policies of this site About an error has occurred while opening the rewire system Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up An error has occurred opening extern DTD (w3.org, xhtml1-transitional.dtd). 503 Server Unavailable up vote 10 down vote favorite 4 I'm trying to do xpath queries over an xhtml document. Using .NET 3.5. The document looks like this:
.... ... Because the document includes various char entities ( and so on), I need to use the DTD, in order to load it with an XmlReader. So my code looks like this: var s = File.OpenRead(fileToRead) var reader = XmlReader.Create(s, new XmlReaderSettings{ ProhibitDtd=false }); But when I run this, it returns An error has occurred while opening external DTD 'http://www.w3.org/TR/xhtml1-transitional.dtd': The remote server returned an error: (503) Server Unavailable. Now, I know why I am getting the 503 error. W3C explained it very clearly. I've seen "workarounds" where people just disable the DTD. This is what ProhibitDtd=true can do, and it eliminates the 503 error. But in my case that leads to other problems - the app doesn't get the entity defintions and so isn't well-formed XML. How can I validate with the DTD, and get the entity definitions, without hitting the w3.org website? I think .NET 4.0 hSQL Server 2014 Express resources Windows Server 2012 resources Programs MSDN subscriptions Overview Benefits Administrators Students Microsoft Imagine Microsoft Student Partners ISV Startups TechRewards Events Community Magazine Forums Blogs Channel 9 Documentation APIs and reference Dev centers Retired content Samples We’re sorry. The content you requested has been removed. You’ll be auto http://stackoverflow.com/questions/2558021/an-error-has-occurred-opening-extern-dtd-w3-org-xhtml1-transitional-dtd-503 redirected in 1 second. Ask a question Quick access Forums home Browse forums users FAQ Search related threads Remove From My Forums Answered by: Xml.XmlDocument.Load problem and don't know why??? Data Platform Development > XML, System.Xml, MSXML and XmlLite Question https://social.msdn.microsoft.com/Forums/en-US/26bfed46-bde9-4145-82cb-f4b1aa8e58b0/xmlxmldocumentload-problem-and-dont-know-why?forum=xmlandnetfx 0 Sign in to vote ok i've done this before and i know how to use it, but i'm a little confused now because of the following error i'm getting. and maybe whats really confusing me is that the file is local and that i have the same code in an app that's using the 1.1 framework but for some reason the 2.0 doesn't work. path:"c:\documents and settings\derekklingman\desktop\20050901\reviewpwk010906.xml" System.Net.WebException: The remote server returned an error: (407) Proxy Authentication Required.at System.Net.HttpWebRequest.GetResponse()at System.Xml.XmlDownloadManager.GetNonFileStream(Uri uri, ICredentials credentials)at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials)at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)at System.Xml.XmlTextReaderImpl.OpenStream(Uri uri)at System.Xml.XmlTextReaderImpl.DtdParserProxy_PushExternalSubset(String systemId, String publicId)at System.Xml.XmlTextReaderImpl.DtdParserProxy.System.Xml.IDtdParserAdapter.PushExternalSubset(String systemId, String publicId)at System.Xml.DtdParser.ParseExternalSubset()at System.Xml.DtdParser.ParseInDocumentDtd(Boolean saveInternalSubset)at System.Xml.DtdParser.Parse(Boolean saveInternalSubset)at System.Xml.XmlTextReaderImpl.ParseDoctypeDecl()at System.Xml.XmlTextReaderImpl.ParseDocumentContent()at System.Xml.XmlTextReaderImpl.Read()at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)at System.Xml.XmlLoader.Load(XmlDocument do
get tips & solutions from a community of 418,419 IT Pros & Developers. It's quick & easy. Parsing XHTML P: https://bytes.com/topic/net/answers/460629-parsing-xhtml n/a gizap I'm trying to parse an XHTML document like this: file.html: http://forums.devx.com/showthread.php?160146-XML-Validation-External-DTD
Some text
with the following code: XmlReaderSettings xs = new XmlReaderSettings(); xs.ProhibitDtd = false; XmlReader reader = XmlReader.Create("file.html", xs); reader.MoveToContent(); The last line generates the following an error exception: An error has occurred while opening external DTD 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd': Unable to connect to the remote server There is no difference if I'm using XmlReader, XmlDocument.Load... There is no difference if I'm loading XML from file or from string... The following line: xs.ProhibitDtd = true; produces of course an exception: For security reasons DTD is prohibited in this XML document. an error has To enable DTD processing set the ProhibitDtd property on XmlReaderSettings to false and pass the settings into XmlReader.Create method. Ok, but I need this DTD! :) How to do it? Feb 23 '06 #1 Post Reply Share this Question 1 Reply P: n/a Martin Honnen gi***@poczta.onet.pl wrote: I'm trying to parse an XHTML document like this: file.html:Some text
with the following code: XmlReaderSettings xs = new XmlReaderSettings(); xs.ProhibitDtd = false; XmlReader reader = XmlReader.Create("file.html", xs); reader.MoveToContent(); The last line generates the following exception: An error has occurred while opening external DTD 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd': Unable to connect to the remote server Works for me if I am connected to the internet. Are you connected? How? Is there any proxy used? Make sure there is no code setting the property xs.XmlResolver to null. -- Martin Honnen --- MVP XML http://JavaScript.FAQTs.com/ Feb 23 '06 #2 This discussion thread is closed Start new discussion Replies have been disabled for this discussioXML Validation - External DTD If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. Results 1 to 1 of 1 Thread: XML Validation - External DTD Tweet Thread Tools Show Printable Version Email this Page… Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode 03-24-2007,11:58 PM #1 monarltee View Profile View Forum Posts Registered User Join Date Jan 2007 Posts 7 XML Validation - External DTD Hello. I cannot get my .net xml validator working with an external dtd. I am hoping somebody could help me out here. This is my code: Dim settings As New XmlReaderSettings() settings.ValidationType = ValidationType.DTD settings.ProhibitDtd = False AddHandler settings.ValidationEventHandler, AddressOf ValidateHandler Dim xml As String = "C:\XmlDocuments\order.xml" Dim xmlStream As New FileStream(xml, FileMode.Open) Dim xmlReader As XmlReader = System.Xml.XmlReader.Create(xmlStream, settings) Try While xmlReader.Read() End While Catch ex As Exception Response.Write(ex.Message) Finally xmlReader.Close() xmlStream.Close() xmlStream.Dispose() End Try Private Sub ValidateHandler(ByVal sender As Object, ByVal e As ValidationEventArgs) Response.Write(ex.Message) End Sub I am getting the following exception: An error has occurred while opening external DTD 'file:///C:/Program Files/Microsoft Visual Studio 8/Common7/IDE/order.dtd': Could not find file 'C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\order.dtd'. This is what I got in order.xml for the dtd declaration: My code works with an inline DTD, but not using a xml file with an external DTD. Thank you so much. Reply With Quote Quick Navigation ASP.NET Top Site Areas Settings Private Messages Subscriptions Who's Online Search Forums Forums Home Forums DevX Developer Forums .NET ASP.NET VB Classic Java C++ XML Web AJAX Database Security Mobile Architecture and Design Talk to the Editors Careers The Lounge API-Finder API Programming API Recommendations « Previous Thread | Next Thread » Forum DevX Developer Forums ASP.NET XML Validation - External DTD Similar Threads [Linker Error] Error: Unresolved external 'SQLSetPos.... (borland c++) By