How to skip validation of DTD file on VB.Net when the DTD is offline

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



------- I have also posted this to the microsoft.public.xml group but I
am not sure which one it belongs in ------

OK - I have an XML file from a vendor that uses a DTD files as follows:

<!DOCTYPE metis PUBLIC "-//METIS/METIS XML 1.2//EN"
"http://xml.metis.no/metis12.dtd";>

The problem is - currently and periodically - the vendor takes the dtd
file offline. Thus, when I am trying to open the XML document in
Vb.Net using the following code:

Private iobj_MetisModel As New XmlDocument
iobj_MetisModel.Load(is_Path_To_Metis_File)

The load is failing with a SocketException because the DTD is not
available (see full stack trace below). I am only reading the XML and
doing some Xpath queries on it. Any idea how I can tell the XML
document to simply continue if it cannot access the DTD?

-------------------------------- Stack Trace
-----------------------------------
MetisReporting: An error occurred while the Metis Reporting System
process was running. Full details are below. System.Net.WebException:
Unable to connect to the remote server --->
System.Net.Sockets.SocketException: A connection attempt failed because
the connected party did not properly respond after a period of time, or
established connection failed because connected host has failed to
respond
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot,
SocketAddress socketAddress)
at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean
connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress&
address, ConnectSocketState state, IAsyncResult asyncResult, Int32
timeout, Exception& exception)
--- End of inner exception stack trace ---
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 doc, XmlReader reader,
Boolean preserveWhitespace)
at System.Xml.XmlDocument.Load(XmlReader reader)
at System.Xml.XmlDocument.Load(String filename)
at MetisDatabaseClass.MetisToDatabase.LoadMetisXMLDocument() in
D:\Visual Studio 2005
Projects\MetisToDB\MetisDatabaseClass\ConvertMetisXMLToDatabase.vb:line
223
at MetisDatabaseClass.MetisToDatabase.GetContainers(TreeView&
pobj_TreeView) in D:\Visual Studio 2005
Projects\MetisToDB\MetisDatabaseClass\ConvertMetisXMLToDatabase.vb:line
359
at
MetisToDBFrontEnd.frmMetisDBFrontEnd.frmMetisDBFrontEnd_Load(Object
sender, EventArgs e) in D:\Visual Studio 2005
Projects\MetisToDB\MetisToDBFrontEnd\frmMetisDBFrontEnd.vb:line 61
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean
fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&
m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd,
Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd,
Int32 nCmdShow)
at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
at System.Windows.Forms.Control.set_Visible(Boolean value)
at
System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32
reason, ApplicationContext context)
at
System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32
reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at MetisToDBFrontEnd.startupModule.Main() in D:\Visual Studio 2005
Projects\MetisToDB\MetisToDBFrontEnd\startupModule.vb:line 12

.



Relevant Pages

  • Re: Lets think who will like to say delphi is dying?
    ... if that particular DTD rules it out. ... there are 2 basic usage forms for XML. ... HTML is/canbe quite strict too. ... Parsing and compiling are kind of the same thing.. ...
    (borland.public.delphi.non-technical)
  • Re: standalone validating XML parser for Solaris?
    ... the unix command line to validate large XML files against an XML DTD. ... Older versions only parse but dont validate. ... More recent versions can validate against DTD or Schema. ...
    (comp.text.xml)
  • Re: DTD in browsers
    ... statement that "DTD for XML are always fetched" is totally correct. ... It is definitely fetched by XML parsers in known Web ... I just presume that Thomas was not aware of the current bug in Gecko ... agree that there is only one DOCTYPE and only one DTD mechanics equal ...
    (comp.infosystems.www.authoring.html)
  • Re: A new paradigm
    ... AccuTerm GUI application for the WinDoze types and a ... With Coyote and a finished XML project, I'm sure that all of that could ... Tom H has taken over the DTD stuff recently ... XML-based development under OpenQM should take part in discussions on the ...
    (comp.databases.pick)
  • Re: Java Flash Application Communication
    ... is to use the XMLSocket object. ... If you want a continuous connection for asynchronous messaging, XML Sockets is probably the way to go. ... I don't know the details though because I am only involved on the Java side. ... You just send XML documents down the socket, separated by a single null byte. ...
    (comp.lang.java.programmer)