[program-l] Re: Visual Basic .net: getting XMLWriter not to access the Internet

  • From: "Ian Sharpe" <isforums@xxxxxxxx>
  • To: <program-l@xxxxxxxxxxxxx>
  • Date: Wed, 18 May 2011 10:29:44 +0100

Hi Pranav

I'm sure it must be possible to prevent the XmlTextReader from trying to
retrieve external resources in some way. Whether it be by disabling
validation or whatever. I just took a look at the XmlTextReader properties
and XmlReaderSettings class and thought the following may help. I haven't
looked at the documentation  though, nor tested anything. The first thing
you could try is setting the prohibitDTD to true which could tell the parse
to ignore the DTD. Although it could simply cause the parse to through an
error if a DTD exists. The second looks more promissing though and sets the
ValidationType of an associated XmlReaderSettings object to none, which
looks like it should disable validation. There are a few other properties
that look like they could also be relevant but see how you go with the below
first. 

XmlTextReader r = new XmlTextReader();
r.ProhibitDtd=true;

XmlReaderSettings s = new XmlReaderSettings();
s.ValidationType=ValidationType.None

Cheers
ian


  

-----Original Message-----
From: program-l-bounce@xxxxxxxxxxxxx [mailto:program-l-bounce@xxxxxxxxxxxxx]
On Behalf Of Pranav Lal
Sent: 18 May 2011 01:39
To: program-l@xxxxxxxxxxxxx
Subject: [program-l] Re: Visual Basic .net: getting XMLWriter not to access
the Internet

Hi Ian,

All I want to do is to format the XML correctly so that each element is on a
single line. Once that is done, my code takes over and adds aditional
elements. That bit is working. The problem is in formatting the XML output
correctly. See my response to David Lant. There seems to be a unique
combination of the xmlTextReader and xmlTextWriter in which my code works. 

Pranav

** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq

** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq

Other related posts: