I am reading data from an XML document with xmlDoc.load(ful lname).
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
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it! 6 9630
Nat wrote: I am reading data from an XML document with xmlDoc.load(ful lname). 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.
--
Oleg Tkachenko [XML MVP, XmlInsider] http://blog.tkachenko.com
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("filep ath");
OR
XmlTextReader tr = new XmlTextReader(n ew StreamReader("f ilePath"));
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/de...lResources.asp
Thanks,
Tejal.
--
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.
"Oleg Tkachenko [MVP]" <oleg@NO!SPAM!P LEASEtkachenko. com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. .. Nat wrote:
I am reading data from an XML document with xmlDoc.load(ful lname). 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.
-- Oleg Tkachenko [XML MVP, XmlInsider] http://blog.tkachenko.com
Hi,
Is there a way to ignore the doctype by using ASP technology (not ASP.net) technology?
Thank you very much,
Elvina
---
Posted using Wimdows.net NntpNews Component -
Post Made from http://www.DotNetJunkies.com/newsgroups Our newsgroup engine supports Post Alerts, Ratings, and Searching.
Hi,
Is there a way to ignore the doctype by using ASP technology (not ASP.net) technology?
Thank you very much,
Elvina
---
Posted using Wimdows.net NntpNews Component -
Post Made from http://www.DotNetJunkies.com/newsgroups Our newsgroup engine supports Post Alerts, Ratings, and Searching.
DotNetJunkies User wrote: Is there a way to ignore the doctype by using ASP technology (not ASP.net) technology?
Try to turn off validation on parse:
xDoc.validateOn Parse = false;
xDoc.Load(....)
--
Oleg Tkachenko [XML MVP] http://blog.tkachenko.com
DotNetJunkies User wrote: Is there a way to ignore the doctype by using ASP technology (not ASP.net) technology?
Try to turn off validation on parse:
xDoc.validateOn Parse = false;
xDoc.Load(....)
--
Oleg Tkachenko [XML MVP] http://blog.tkachenko.com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: KongHu |
last post by:
--
|
by: Daniel Ng |
last post by:
Hello,
This question has been asked before, unfortunately, no answer
has been posted.
I want to parse an XML file and ignore the <!DOCTYPE ..> tag.
Does anyone know the answer?
Daniel
|
by: red |
last post by:
If I have <span>text</span> <br> and then some text
isn't there sopposed to be a line break between the span and the text ?
Why do browsers ignore the <br> ?
|
by: DartmanX |
last post by:
I doubt this is possible, but I want to ask, just in case it is.
I have a project going using Google Maps. This project spits out an
HTML page template for people to post to their website and display a
map. Most of the people doing this will have limited knowledge of HTML.
I want to ensure that this page remains an XHTML 1.0 Transitional...
|
by: Viken Karaguesian |
last post by:
Hello all,
I'm somewhat of a newbie to webscripting. I've made a couple of websites in
the past with WYSIWYG software, but now I'm much more interested in manual
scripting. I have some questions about DOCTYPE:
1. Is a doctype statement *required*, or is it just "strongly suggested"? I
would probably be using a Transitional doctype.
2....
| |
by: KatB |
last post by:
Hi, I'm using the transform class for an xml document. However, all my
documents are created by authoring tool and contain a DTD declaration:
<!DOCTYPE jabil SYSTEM "C:\Program
Files\Epic\custom\doctypes\Jabil\Jabil.dtd">
I can't remove this since the authors need it every time they edit the
document.
Is there some way I can tell the...
|
by: Bill nguyen |
last post by:
I'm using ReadXML to read xml files. These files contain the declaration
<!DOCTYPE DTN_ENERGY_XML_PRICE_FORMAT SYSTEM "NPD1_XML.DTD"> that I don't
have access to (and don't need to) that causes an error (please the sample
file below).
Is there any way for readXml to ignore this line or at least handle it
graciously? Currently it crashes the...
|
by: drhowarddrfine |
last post by:
The Doctype or DTD
Many coders get confused by all the talk of doctypes and how they affect browsers and the display of their web pages. This article will get right to the point about doctypes and their use.
Doctype is short for its full name "Document Type Definition", or DTD. If you pay attention to what those words mean, you will...
|
by: samz |
last post by:
Hello,
Here is a simple PHP recursive file list (with interactive and visual FX)
Sam's Files
http://acc.jexiste.ch/JPN/RecurciveDIR12.RAR
1. How to ignore/avoid empty folders in this PHP script ?
2. How to sort files by filename (and, if possible, folders on top) ?
3. Is this MAILTO hidden tool still useful against the current Spam robots...
|
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...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
| |
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. ...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
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...
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |