473,799 Members | 3,006 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.UTF 8Encoding.UTF8. GetBytes(oRepor t.OuterXml)
Dim ms As New MemoryStream(bu f)
ms.Position = 0
tr = New XmlTextReader(m s)

--

I have also tried

(1a)

Dim myStream As System.IO.Strin gReader
myStream = New System.IO.Strin gReader(oReport .OuterXml.ToStr ing)
tr = New XmlTextReader(m yStream)

(1b)

Dim myStream As System.IO.Strin gReader
myStream = New System.IO.Strin gReader(oReport .OuterXml.ToStr ing)
tr = New XmlTextReader(m yStream)
tr.Read()

(1c)

tr = New XmlTextReader(" C:\inetpub\wwwr oot\mc\ws050523 .1\file.xml")

(1d)

tr = New XmlTextReader(" C:\inetpub\wwwr oot\mc\ws050523 .1\file.xml")
tr.Read()

--

(2)

vr = New XmlValidatingRe ader(tr)
AddHandler vr.ValidationEv entHandler, AddressOf ValidationCallB ack

Dim schema As String = "urn:mysche ma-schema"
Dim xsc As New XmlSchemaCollec tion
xsc.Add(schema, "C:\inetpub\www root\mc\ws05052 3.1\myschema.xs d")
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 993

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

Similar topics

0
1056
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 sender As Object, ByVal args As ValidationEventArgs) _bIsValid = False _errordata.Add(_reader.Name & "|" & _sCurrentFilename & "|" &
8
2530
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 XML format, there are parent nodes named differently with some of the same names for child nodes, so when I get an error message that references the 'LOGICALPOCKET' node that could be under more than one different parent node. I need to be able to...
5
17702
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 file as displayed when I open the xml file in VS .net 2003 IDE. When I perform the same procedure in C# the stream reader obkect displays a chaotic mess. Lots of whitespace after and "\r" and "\n" after each element. The problem is that I cannot...
6
249001
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 System; using System.IO; using System.Diagnostics;
0
2607
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 with a XML file. I want to be able to save the form automatically for the User so as to prevent typing errors i.e. c:/erikaTemp/subFolder/erika_12345.pdf but from what I've seen this can only be done via the the 'File download' pop up which only...
1
13543
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 reference vsjlib Library in .net component. .NET Classes used : Imports System.IO Imports java.io Imports java.util Imports java.util.zip
0
2153
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 compressed(zipped) folder is invalid or corrupted. I am using VB.NET .Please help me out in this regard...Thank you in advance. Here is the code for that. Public Class clsZip
6
1201
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 with a dataset.
6
1597
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 temporarily save the pdf document on the local hard disk. My question: Is there a way in C# and the .net framework to display the pdf document, say in the Acrobat Reader, without saving the pdf file to hard disk? At a first glance I would say no....
0
9688
marktang
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10490
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, 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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10260
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10243
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
10030
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6809
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5467
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5590
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4146
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 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.