473,387 Members | 1,673 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,387 software developers and data experts.

How do I ignore DTD validation in .net 1.1

Hi our server does not have access to the internet, and is failing to
load cXml documents posted to it due to trying to validate the DTD.

I found an example for .net 2.0 using XmlReaderSettings to turn off the
validation, but I'm using .net 1.1.

Here's the current code:

Stream xmlInString = ((Stream)Request.InputStream);
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(xmlInString);

Has anyone got any ideas.

Thanks,

Nov 21 '06 #1
2 4284
Martin wrote:
Hi our server does not have access to the internet, and is failing to
load cXml documents posted to it due to trying to validate the DTD.

I found an example for .net 2.0 using XmlReaderSettings to turn off the
validation, but I'm using .net 1.1.

Here's the current code:

Stream xmlInString = ((Stream)Request.InputStream);
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(xmlInString);
..NET 1.x does not validate unless you are using XmlValidatingReader. It
will however load DTDs/external entities. If you don't want that then
you need to set the XmlResolver to null e.g.
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.XmlResolver = null;
xmlDoc.Load(stream);
Try whether that works, if there are any entity references in the XML
where the entities are defined in the external DTD then you will get an
exception.
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Nov 21 '06 #2
Thanks!

That's done the trick.

Martin Honnen wrote:
Martin wrote:
Hi our server does not have access to the internet, and is failing to
load cXml documents posted to it due to trying to validate the DTD.

I found an example for .net 2.0 using XmlReaderSettings to turn off the
validation, but I'm using .net 1.1.

Here's the current code:

Stream xmlInString = ((Stream)Request.InputStream);
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(xmlInString);

.NET 1.x does not validate unless you are using XmlValidatingReader. It
will however load DTDs/external entities. If you don't want that then
you need to set the XmlResolver to null e.g.
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.XmlResolver = null;
xmlDoc.Load(stream);
Try whether that works, if there are any entity references in the XML
where the entities are defined in the external DTD then you will get an
exception.
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Nov 23 '06 #3

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

Similar topics

0
by: Curtiss Howard | last post by:
I'm using Xerces 2.4.0 and I've got a schema (converted from a DTD) for my XML documents. However, Xerces will NOT ignore the whitespace between elements. These are the options I've set for the...
1
by: Andy | last post by:
Hello All! Is there any way to validate XML document agains schema, but at the same time ignore any attributes or elements that are not specified in schema? Example: <Customer>...
6
by: Nat | last post by:
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...
3
by: aidancasey | last post by:
I want to bypass the dtd validation that child elements must appear in a certain order ... In a DTD child elements that are defined and seperated by commas they must appear in the same sequence...
1
by: sunilkeswani | last post by:
Hi I have an Access form which is used in a multiple-user environment. Could someone please help me with this. I want to put a CLEAR, or ADD NEW RECORD button which should ignore all the alerts...
6
by: RSB | last post by:
Hi I am executing a JavaScript Function for a Button and doing some custom data validation. Now i want to Ignore the Button Click if the Data validation Fails. i am using return(false) in the...
4
by: A.M | last post by:
Hi, How can I set the option of RegularExpressionValidator to RegexOptions.IgnoreCase ? Thanks, Alan
2
by: Tom | last post by:
I have written a validatedTextBox class which inherits from textBox. I've added code which validates the input text using the onValidation event. The problem I have is that when I have input...
1
by: Ganesh | last post by:
Hi There, I've a validation control in my page, In some cases i don't want to check the validation like when users click cancel, i'l take the page to home page. But it checks always validation....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.