473,405 Members | 2,282 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 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 6032
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 =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
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,...

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.