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

trying to get contents of XML doc while in ValidationEventHandler

Hello,

I'm looking for help trying to get the contents of the XML document while in
the ValidationEventHandler for XmlReaderSettings. Here is what I mean:

We need to be able to validate the content of SOAP messages which are coming
into a web service. These XML messages might be missing elements, or have
incorrect values in enums, etc. We found that during the deserialization of
the XML in these messages, if there are missing elements which are ints and
floats, then these elements are added back in by the web service with default
values. Missing enums are added back in with first value in the enum. And
so forth.

This is not good, so we decided to add a SOAP extension to do XML validation
before getting to the web service. We used a WSValidation SOAP Extension
adapted from an article on MSDN.

We were able to get the validation working and are logging the exception
message, etc. We would like to log the XML message itself, but have not been
able to find a way to do so. If a validation error or warning occurs a
ValidationEventHandler is called. There are two parameters passed into the
ValidationEventHandler:

sender (which is an XmlReader or XsdValidationReader, not sure which)
ValidationEventArgs

Neither of these objects appear to give you a link back to the XML message
that contained the invalid element. You would think the "sender" object
would, but it seems to be primarily concerned with reading a tag at a time,
and there is no way, I think, to get the entire XML document out.

Any suggestions on how we can do this? Without serializing the XML message
into a string, putting that into a class-level variable and then getting at
it within the ValidationEventHandler?

Thank you!
Trevor Brierly
May 24 '06 #1
0 1032

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

Similar topics

1
by: Jonas Bush | last post by:
I'm trying to validate an XmlDocument with an XSD schema, and I'm getting the following error: Could not find schema information for the element 'month'. An error occurred at , (1, 40). Here...
0
by: Nick Finch | last post by:
Hi, I wonder if anyone else has come across this. The code below is very simple however I cannot get the ValidationHandler to be raised. I am testing with xml that I know will not validate...
18
by: Gleep | last post by:
I've searched google intensely on this topic and it seems noone really knows how to approch this. The goal I don't want clients to give out their usernames and passwords to friends, since the site...
1
by: sshankar | last post by:
Hi, New to Stored procedure. Basically just installed DB2 v8.1.0.36 Was trying to build a stored procedure.. It is giving following error.. Looks like some error related to configuration...
0
by: Marc Scheuner | last post by:
Folks, I'm faced with a dilemma here - I have an XML document and for part of it, I have an XSD schema to validate it - but not for the rest of it. Can I still validate at least part of the...
2
by: Techno_Dex | last post by:
I have an issue with the EventHandler for the XmlReaderSettings object being called twice during validation and I'm a little stumpped as to why. The error message being given is the same error...
1
by: hmbscully | last post by:
I am trying to send a complex mutli-part email with inline attachments between html pieces. I originally wrote the code in Perl with the MIME::Lite module, which worked fine. My attempts to...
1
by: barnacle.steve | last post by:
I'm trying to write what should be a simple script in Python, which I've never ever used before. Essentially, I have a text file that has a list of full path file names to other files, separated...
3
by: Konrad | last post by:
Hi I've got a xml file and xsd with only one namespace - xmlns:media="http://search.yahoo.com/mrss". When I'm getting the rss feed for example from Youtube there're also others namespaces such as...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.