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

xmlValidating reader and stream vs. file

I pass an xmlDocument to my web service. There I want to use an xmlValidating
reader for validation of that document. I do not want to create a file, but
rather validate from a stream. My schema document specifies a boolean for an
element where, in the instance document, there is the value "2222".

The code:

(1)

Dim buf As Byte() = System.Text.UTF8Encoding.UTF8.GetBytes(oReport.Out erXml)
Dim ms As New MemoryStream(buf)
ms.Position = 0
tr = New XmlTextReader(ms)

--

I have also tried

(1a)

Dim myStream As System.IO.StringReader
myStream = New System.IO.StringReader(oReport.OuterXml.ToString)
tr = New XmlTextReader(myStream)

(1b)

Dim myStream As System.IO.StringReader
myStream = New System.IO.StringReader(oReport.OuterXml.ToString)
tr = New XmlTextReader(myStream)
tr.Read()

(1c)

tr = New XmlTextReader("C:\inetpub\wwwroot\mc\ws050523.1\fi le.xml")

(1d)

tr = New XmlTextReader("C:\inetpub\wwwroot\mc\ws050523.1\fi le.xml")
tr.Read()

--

(2)

vr = New XmlValidatingReader(tr)
AddHandler vr.ValidationEventHandler, AddressOf ValidationCallBack

Dim schema As String = "urn:myschema-schema"
Dim xsc As New XmlSchemaCollection
xsc.Add(schema, "C:\inetpub\wwwroot\mc\ws050523.1\myschema.xsd ")
vr.Schemas.Add(xsc)

While vr.Read()

End While

....

I can step through the proxy class created from the web service and using
vr.ReadString I see the values being read from either the file or from the
stream.

Using 2 with

(1) --> The expected validation exception is Not raised.
(1a) --> is Not raised.
(1b) --> is Not
(1c) --> is
(1d) --> is Not

Can anyone help me understand these results and why I can't use 1 & 2 to
validate the xmlDocument in the web service?
Thank you,

John Hopper

Nov 12 '05 #1
0 979

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

Similar topics

0
by: Eric | last post by:
I've written a spiffy class to validate my xml. it loads up a schema into an xmlvalidatingreader and runs thru the xml, firing validationevents as it goes. Friend Sub ValidationEventHandle(ByVal...
8
by: Todd Bright | last post by:
Is there a way to get the current XmlNode from the reader while in the validation event handler? What I'd like to do is display the error message along with the name of its parent node. In my...
5
by: Drew Yallop | last post by:
I read an XML file with a stream reader in VB.Net. When I look at the stream reader output in debug mode (by passing cursor over the stream reader object)the format is a perfect replica of the...
6
Atran
by: Atran | last post by:
Hello: In this article: You will learn to Write or Read A Text File. Let's Begin: First Create a new project (ConsoleApp or WinApp). And Make sure your program uses these namespaces: using...
0
by: ErikaW | last post by:
Hi all, I've tried to google this but could not find a clear solution. I have a Web application developed in JDevloper using mostly html and Javascript. I have a pre-defined PDF form which I merge...
1
by: sandhyabhavani | last post by:
This article is used to zip a file or directory using vb.net. The classes and method to zip a file is availale in java.io, java.util, java.util.zip class library.To import these you have to add a...
0
by: nagashree | last post by:
Hi, i want to compress the file or directory i am able to do that can anybody help me to decompress the file when i double click on the zipped file i am getting the error message as...
6
by: Andy B | last post by:
I need to make sure that a file saved in a particular place is a valid xml file that fits a certain schema. Where would I get started doing this? The original file would have been created and saved...
6
by: wolfgang.woegerer | last post by:
I have a pdf document saved (as a base64 encoded string) in a remote database. I now want to allow the client application to display that document. Because of legal issues I am not allowed to...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.