I am reading data from an XML document with xmlDoc.load(fullname).
Unfortunately, in my xml file there is the definition of a doctype file
that is not available and so, it buggs. I would like to ignore it, to
remove this line, or I don?t know? my language is Visual C#.
Thanks in advance for your help.
Nathalie
> I am reading data from an XML document with xmlDoc.load(fullname).
> Unfortunately, in my xml file there is the definition of a doctype file
> that is not available and so, it buggs. I would like to ignore it, to
> remove this line, or I don’t know… my language is Visual C#.
> Thanks in advance for your help.
You can load XML via XmlTextReader with custom XmlResolver set up. In
XmlResolver implementation (inherit XmlUrlResolver and override
ResolveUri method, see "Creating a Custom Resolver" topic in MSDN) you
can resolve DTD reference to your local copy. In fact if you don't have
teh DTD, that local copy can be even a dummy one, as XmlTextReader only
checks DTD exists and is well-formed.

Signature
Oleg Tkachenko [XML MVP, XmlInsider]
http://blog.tkachenko.com
Tejal Joshi \(MSFT\) - 16 Apr 2004 02:09 GMT
Another simple method would be to specify a null resolver on either the
document or the text reader
XmlDocument doc = new XmlDocument();
doc.XmlResolver = null;
doc.Load("filepath");
OR
XmlTextReader tr = new XmlTextReader(new StreamReader("filePath"));
tr.XmlResolver = null;
XmlDocument doc = new XmlDocument();
doc.Load(tr);
This article might gives good overview of how the resolver is used :
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cp
conResolvingExternalResources.asp
Thanks,
Tejal.

Signature
This posting is provided "AS IS" with no warranties, and confers no rights.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
> > I am reading data from an XML document with xmlDoc.load(fullname).
> > Unfortunately, in my xml file there is the definition of a doctype file
[quoted text clipped - 8 lines]
> teh DTD, that local copy can be even a dummy one, as XmlTextReader only
> checks DTD exists and is well-formed.
DotNetJunkies User - 22 Jun 2004 20:48 GMT
Hi,
Is there a way to ignore the doctype by using ASP technology (not ASP.net) technology?
Thank you very much,
Elvina
---
Oleg Tkachenko [MVP] - 23 Jun 2004 10:37 GMT
> Is there a way to ignore the doctype by using ASP technology (not ASP.net) technology?
Try to turn off validation on parse:
xDoc.validateOnParse = false;
xDoc.Load(....)

Signature
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com