473,657 Members | 2,366 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

------- I have also posted this to the microsoft.publi c.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_T o_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.WebE xception:
Unable to connect to the remote server --->
System.Net.Sock ets.SocketExcep tion: 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.Sock ets.Socket.DoCo nnect(EndPoint endPointSnapsho t,
SocketAddress socketAddress)
at System.Net.Sock ets.Socket.Inte rnalConnect(End Point remoteEP)
at System.Net.Serv icePoint.Connec tSocketInternal (Boolean
connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress&
address, ConnectSocketSt ate state, IAsyncResult asyncResult, Int32
timeout, Exception& exception)
--- End of inner exception stack trace ---
at System.Net.Http WebRequest.GetR esponse()
at System.Xml.XmlD ownloadManager. GetNonFileStrea m(Uri uri,
ICredentials credentials)
at System.Xml.XmlD ownloadManager. GetStream(Uri uri, ICredentials
credentials)
at System.Xml.XmlU rlResolver.GetE ntity(Uri absoluteUri, String role,
Type ofObjectToRetur n)
at System.Xml.XmlT extReaderImpl.O penStream(Uri uri)
at
System.Xml.XmlT extReaderImpl.D tdParserProxy_P ushExternalSubs et(String
systemId, String publicId)
at
System.Xml.XmlT extReaderImpl.D tdParserProxy.S ystem.Xml.IDtdP arserAdapter.Pu shExternalSubse t(String
systemId, String publicId)
at System.Xml.DtdP arser.ParseExte rnalSubset()
at System.Xml.DtdP arser.ParseInDo cumentDtd(Boole an
saveInternalSub set)
at System.Xml.DtdP arser.Parse(Boo lean saveInternalSub set)
at System.Xml.XmlT extReaderImpl.P arseDoctypeDecl ()
at System.Xml.XmlT extReaderImpl.P arseDocumentCon tent()
at System.Xml.XmlT extReaderImpl.R ead()
at System.Xml.XmlL oader.LoadNode( Boolean skipOverWhitesp ace)
at System.Xml.XmlL oader.LoadDocSe quence(XmlDocum ent parentDoc)
at System.Xml.XmlL oader.Load(XmlD ocument doc, XmlReader reader,
Boolean preserveWhitesp ace)
at System.Xml.XmlD ocument.Load(Xm lReader reader)
at System.Xml.XmlD ocument.Load(St ring filename)
at MetisDatabaseCl ass.MetisToData base.LoadMetisX MLDocument() in
D:\Visual Studio 2005
Projects\MetisT oDB\MetisDataba seClass\Convert MetisXMLToDatab ase.vb:line
223
at MetisDatabaseCl ass.MetisToData base.GetContain ers(TreeView&
pobj_TreeView) in D:\Visual Studio 2005
Projects\MetisT oDB\MetisDataba seClass\Convert MetisXMLToDatab ase.vb:line
359
at
MetisToDBFrontE nd.frmMetisDBFr ontEnd.frmMetis DBFrontEnd_Load (Object
sender, EventArgs e) in D:\Visual Studio 2005
Projects\MetisT oDB\MetisToDBFr ontEnd\frmMetis DBFrontEnd.vb:l ine 61
at System.Windows. Forms.Form.OnLo ad(EventArgs e)
at System.Windows. Forms.Form.OnCr eateControl()
at System.Windows. Forms.Control.C reateControl(Bo olean
fIgnoreVisible)
at System.Windows. Forms.Control.C reateControl()
at System.Windows. Forms.Control.W mShowWindow(Mes sage& m)
at System.Windows. Forms.Control.W ndProc(Message& m)
at System.Windows. Forms.Scrollabl eControl.WndPro c(Message& m)
at System.Windows. Forms.Container Control.WndProc (Message& m)
at System.Windows. Forms.Form.WmSh owWindow(Messag e& m)
at System.Windows. Forms.Form.WndP roc(Message& m)
at
System.Windows. Forms.Control.C ontrolNativeWin dow.OnMessage(M essage& m)
at System.Windows. Forms.Control.C ontrolNativeWin dow.WndProc(Mes sage&
m)
at System.Windows. Forms.NativeWin dow.DebuggableC allback(IntPtr hWnd,
Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows. Forms.SafeNativ eMethods.ShowWi ndow(HandleRef hWnd,
Int32 nCmdShow)
at System.Windows. Forms.Control.S etVisibleCore(B oolean value)
at System.Windows. Forms.Form.SetV isibleCore(Bool ean value)
at System.Windows. Forms.Control.s et_Visible(Bool ean value)
at
System.Windows. Forms.Applicati on.ThreadContex t.RunMessageLoo pInner(Int32
reason, ApplicationCont ext context)
at
System.Windows. Forms.Applicati on.ThreadContex t.RunMessageLoo p(Int32
reason, ApplicationCont ext context)
at System.Windows. Forms.Applicati on.Run(Form mainForm)
at MetisToDBFrontE nd.startupModul e.Main() in D:\Visual Studio 2005
Projects\MetisT oDB\MetisToDBFr ontEnd\startupM odule.vb:line 12

Oct 19 '06 #1
1 3966
Ok - So the following solution works:
Dim lobj_XMLTextRea der As XmlTextReader
Dim iobj_MetisModel As New XmlDocument
'Start up the XmlTextReader - using this to override the
XMLResolver
lobj_XMLTextRea der = New XmlTextReader(i s_Path_To_File)
lobj_XMLTextRea der.XmlResolver = Nothing
iobj_MetisModel .Load(lobj_XMLT extReader)

this was a pain - I hope it helps others :)

Dec 6 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

72
5188
by: Stephen Poley | last post by:
I have quite often (as have probably many of you) come across HTML forms with irritating bits of Javascript attached. The last straw on this particular camel's back was a large form I was asked to complete in connection with attendance at a seminar. After spending more than 15 minutes on it, I clicked on the submit button - and nothing happened. Looking round the pages on Javascript form validation that Google produced for me (well,...
2
1705
by: Joe Au | last post by:
I create a (left) panel control to hold some image buttons, and a (right) panel to hold some textboxes and corresponding validation controls. When I press one of the button on the left panel, then the validatons takes place on the right panel to show up the error messages. How can I skip these validation if the user really want to leave the right panel? Thanks.
2
1987
by: Jayson | last post by:
Hi guys, I am using a control(I only got the dll file) downloaded from web. Whenever a key is enter it will validate the user input. If not valid it will ignore the key being enter. I want to skip that validation handler. How do I do that? Thank you!
4
2713
by: ron | last post by:
I have a access based guest book. I want to create a validation rule to block certain words or parts of a srting. How do i do this? ie: this is a nice site. come visit my porn site at www.abc.zy If the message contains the word porn, can I block the whole message using a validation rule
1
2359
by: harriegovin | last post by:
Hi, Here is the scenario. I have a web application written in vb.net. One of the functionalities of the application is to save the recordset in an xml format on to the client machine. The xml file needs to be saved on the client machine for the offline application to work. when the user works on the offline module the data in the saved xml file gets updated. The data from the updated xml file needs to be written back to the main...
5
2540
by: matt | last post by:
hello, i am on an interesting project. in this project, i have to create dynamic data-entry forms for offline-users to fill out, save locally, and eventually postback to our app (when back online). data validation is required on the form. i had looked at using PDF-forms for this.. Adobe's "LifeCyle Forms" would work perfectly. with it one can pass in xml to their webservice & get back PDF-form binaries. however, Adobe's pricing is...
0
1545
by: xievvv | last post by:
I am trying to have a SslStream client and an SslStream server mutually authenticate and communicate with each other, over TCP. So when I call the methods AuthenticateAsClient() and AuthenticateAsServer() with CRL checking disabled (last argument: false) everything works fine. Now I want to incorporate CRL checking during the validation process. When I specify the CRL checking argument: true, I get RemoteCertificateChainErrors on both the...
1
1923
by: shakthi | last post by:
Hi I created an online Mobile application using .net 2.0 on server side and another offline application on mobile client using .net compact framework 2.0. I packaged my offline application to CAB file and installed inside Pocket PC. The CAB file created an exe file of my offline application in the Pocket PC. My offline application downloads a zip file from the server and unzips into a particular folder inside the Pocket PC device and this...
8
2840
by: Jean Pierre Daviau | last post by:
Ho to everyone, ======== http://validator.w3.org/check?uri=' =========== I would like to rewrite this script to validate files from my desktop. Thanks for your attention.
0
8399
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8827
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8606
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7337
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6169
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4159
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4318
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2732
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1959
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.