472,782 Members | 1,147 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,782 software developers and data experts.

LoadXML fails when XML contains !DocType. Now what do I do?

AFN
I'm comfortable with VB.NET but new to XML. I am getting XML data from a
remote machine across the internet. Sometimes my LoadXML call works fine
and I parse out the data I need thereafter. But other times, LoadXML fails
because it says it can't find a DTD file which is referenced in <!DOCTYPE
Response SYSTEM "The_File.DTD">. I don't know what a DTD file is, but I
don't have it and I'm just trying to parse the rest of the XML. There are
some elements there that I want to parse. I don't control the remote
server. What should I do?

Nov 12 '05 #1
3 5992
AFN wrote:
I'm comfortable with VB.NET but new to XML. I am getting XML data from a
remote machine across the internet. Sometimes my LoadXML call works fine
and I parse out the data I need thereafter. But other times, LoadXML fails
because it says it can't find a DTD file which is referenced in <!DOCTYPE
Response SYSTEM "The_File.DTD">. I don't know what a DTD file is, but I
don't have it and I'm just trying to parse the rest of the XML. There are
some elements there that I want to parse. I don't control the remote
server. What should I do?

DTD is a schema definition for the XML file. Are you trying to validate
the XML file that you receive?
Nov 12 '05 #2
AFN

"uttara" <pl*******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
AFN wrote:
I'm comfortable with VB.NET but new to XML. I am getting XML data from a remote machine across the internet. Sometimes my LoadXML call works fine and I parse out the data I need thereafter. But other times, LoadXML fails because it says it can't find a DTD file which is referenced in <!DOCTYPE Response SYSTEM "The_File.DTD">. I don't know what a DTD file is, but I don't have it and I'm just trying to parse the rest of the XML. There are some elements there that I want to parse. I don't control the remote
server. What should I do?

DTD is a schema definition for the XML file. Are you trying to validate
the XML file that you receive?

No, I'm just trying to parse. Maybe I should be using the TextReader
object, but it doesn't take a string input and the XML is being passed to
this function as string. Someone else wrote the routine. Here it is, in
case you can offer any suggestions (thanks)...
Dim objDocXMLResponse As System.Xml.XmlDocument
Dim objResponseNodeList As Xml.XmlNodeList

objDocXMLResponse = New System.Xml.XmlDocument
objDocXMLResponse.LoadXml(strResponse)
objResponseNodeList =
objDocXMLResponse.SelectNodes("Response/ACResponse/CommonDataResponse/Common
MandatoryResponse")
Dim intNodeCount As Integer
For intNodeCount = 0 To objResponseNodeList.Count - 1

Dim objResponseChildNode As Xml.XmlNodeList

txRefNo =
getNodeValue(objResponseNodeList(intNodeCount), "TxRefNum")
strAuthNumber =
getNodeValue(objResponseNodeList(intNodeCount), "ResponseCodes/AuthCode")
strResponseCode =
getNodeValue(objResponseNodeList(intNodeCount), "ResponseCodes/RespCode")

Next


Nov 12 '05 #3
AFN wrote:
I'm comfortable with VB.NET but new to XML. I am getting XML data from a
remote machine across the internet. Sometimes my LoadXML call works fine
and I parse out the data I need thereafter. But other times, LoadXML fails
because it says it can't find a DTD file which is referenced in <!DOCTYPE
Response SYSTEM "The_File.DTD">. I don't know what a DTD file is, but I
don't have it and I'm just trying to parse the rest of the XML. There are
some elements there that I want to parse. I don't control the remote
server. What should I do?


AFAIK you can provide null as XmlResolver to avoid resolving of an
external DTD.

--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com
Nov 12 '05 #4

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

Similar topics

4
by: Tim Haughton | last post by:
I think I might be misunderstanding just what the LoadXml method is doing. I have 2 seemingly identical XmlDocuments, an XPath query succeeds on one of them, and fails on the other. Can anyone tell...
6
by: jmgonet | last post by:
Hello everybody, I'm having troubles loading a Xml string encoded in UTF-8. If I try this code: ------------------------------ XmlDocument doc=new XmlDocument(); String s="<?xml...
4
by: cloudx | last post by:
hi there, in VB LoadXML(str) returns true or false so that you can do different coding when the str is XML or not, but in C# LoadXML doesn't have return but only throw exception if str is not XML...
0
by: Reshma Prabhu | last post by:
Hello, I am using XmlDataDocument's LoadXml( ) function to load a particular xml string. This xml string contains a reference to a particular DTD. Though LoadXml function does not perform DTD or...
2
by: ian | last post by:
Hi, I've got the weirdest garbage collection problem - I'd appreciate any advice you've got. 1. A class 'X' in a system I'm working on contains a reference to an XmlDocument, populated via...
0
by: Johan | last post by:
Hi! I have a problem with my app which is mixed .NET and native code. The problem is of course with the well-known buggy EnableVisualStyles. Now, at first I called:...
1
by: BobbyJohn | last post by:
Hello.. I am attempting to load a Subform from a recordset. The recordsource is set to a string containing SQL using a query object. The Recordsource returns 0 rows in RecordSet, yet when the same...
2
by: binder | last post by:
How do I eliminate an extra backslash that is appearing after LoadXML call? This issue is causing an error with Process.Start. I have a string stored in sql: c:\program files\internet...
1
by: sumanmshan | last post by:
Hi everyone, This is my first post to this forum, hope I would get a reply quickly :-) Iam using loadXML(xmlString) and it is always returning "false". My code looks like this : if...
1
by: Beamor | last post by:
function art_menu_xml_parcer($content, $showSubMenus) { $doc = new DOMDocument(); $doc->loadXML($content);//this is the line in question $parent = $doc->documentElement; $elements =...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.