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

do i need to write my own validator?

I have a very complex XDR schema that uses namespaces:

xmlns="urn:schemas-microsoft-com:xml-data"
xmlns:b="urn:schemas-microsoft-com:BizTalkServer"
xmlns:d="urn:schemas-microsoft-com:datatypes"

Do I need to build a custom validator in order to validate XML documents
against this schema? How does the XML parser know how to validate against
the extra namespaces?

For example, schemas-microsoft-com:datatypes allows for attributes such as
maxLength, minLength, etc. If my XML document contains a value that doesn't
meet these criteria, then the document should not be valid.

The "schemas-microsoft-com:BizTalkServer" is even more custom, allowing for
such things as a "FieldInfo" element with "format" attributes that specifiy
the exact format for dates and times. I'm pretty sure XmlValidatingReader
doesn't check for these special validations.
If I do have to build my own validator, does anyone have some samples I can
look at? Is there an easy way to do this?
Thanks, Ryan

Nov 12 '05 #1
2 2146
I try to load a document below... using MSXML2.DOMDocument.4.0 COM Object.

----------------------------------------------------------------------------
----------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<my:myFields
xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2004-02-19
T00:33:17" xml:lang="ko">
<my:field1></my:field1>
<my:field2></my:field2>
<my:field3>2004-02-12T23:30:20</my:field3>
<my:group1></my:group1>
<my:group2>
<my:group3>
<my:field4></my:field4>
<my:field5></my:field5>
</my:group3>
</my:group2>
<my:field6></my:field6>
<my:field7>false</my:field7>
<my:field8 xsi:nil="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"></my:field8>
</my:myFields>
----------------------------------------------------------------------------
----------------------------------------
var xmlDoc;
xmlDoc = new ActiveXObject( "MSXML2.DOMDocument.4.0" );
xmlDoc.async = false;
xmlDoc.load( xmlFile );

but ... the error is occurred.

Invalid XML File!
File URL: ................
Line No.: 15
Character: 82
File Position: 533
Source Text: <my:field8 xsi:nil="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"></my:field8>
Error Code: -1072897995
Description: xsi:nil attribute on element "my:field8" is invalid.

I can't understand why this document is "Invalid XML File".
the XML File can be loaded in .NET XmlDocument class and Internet Explorer.
but... MSXML2.DOMDocument.4.0 can't load.

Are there any problem that I don't recognize?

"Ryan" <no****@nospam.net> wrote in message
news:eE**************@TK2MSFTNGP12.phx.gbl...
I have a very complex XDR schema that uses namespaces:

xmlns="urn:schemas-microsoft-com:xml-data"
xmlns:b="urn:schemas-microsoft-com:BizTalkServer"
xmlns:d="urn:schemas-microsoft-com:datatypes"

Do I need to build a custom validator in order to validate XML documents
against this schema? How does the XML parser know how to validate against
the extra namespaces?

For example, schemas-microsoft-com:datatypes allows for attributes such as
maxLength, minLength, etc. If my XML document contains a value that doesn't meet these criteria, then the document should not be valid.

The "schemas-microsoft-com:BizTalkServer" is even more custom, allowing for such things as a "FieldInfo" element with "format" attributes that specifiy the exact format for dates and times. I'm pretty sure XmlValidatingReader
doesn't check for these special validations.
If I do have to build my own validator, does anyone have some samples I can look at? Is there an easy way to do this?
Thanks, Ryan

Nov 12 '05 #2
Á¤¼ºÅ wrote:
xmlDoc = new ActiveXObject( "MSXML2.DOMDocument.4.0" );
xmlDoc.async = false;
Turn validation off here:
xmlDoc.validateOnParse = false;
xmlDoc.load( xmlFile );


--
Oleg Tkachenko [XML MVP, XmlInsider]
http://blog.tkachenko.com
Nov 12 '05 #3

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

Similar topics

6
by: Jerry Werner | last post by:
I need to replace my email address on hundreds of web pages with a new address (in a graphic, not a mailto) in order to thwart the email harvesters that spammers are using. Ideally, I'd like to do...
38
by: lawrence | last post by:
I'm just now trying to give my site a character encoding of UTF-8. The site has been built in a hodge-podge way over the last 6 years. The validator tells me I've lots of characters that don't...
0
by: TN Bella | last post by:
Hi, I am trying to get my compare validator to fire properly...Since I have panels the validator wouldn't work properly, the app would fire right but would insert the data regardless and the...
8
by: Rhino | last post by:
I am getting an error from the CSS validator that I don't understand. Here is the relevant fragment of my CSS: BODY { size: 8.5in 11in; color : #000000; background-color : #ffffff;...
40
by: VK | last post by:
Hi, After the response on my request from W3C I'm still unclear about Tidy vs. Validator discrepansies. That started with <IFRAME> issue, but there is more as I know. Anyway, this very basic...
11
by: Michael Powe | last post by:
How can I make an XHTML-compliant form of an expression in this format: document.write("<scr"+"ipt type='text/javascript' src='path/to/file.js'>"+"</scr"+"ipt>"); this turns out to be a...
5
by: Joe Reynolds | last post by:
i have an application that will take user input from a text box and write it to an access database. i need to make sure that if they ever enter a single line of text that it has at least 1 space...
12
by: bringmewater | last post by:
Is there any software that will let me write books and export to both PDF and HTML with automatically generated TOC, Index (with page numbers for PDF) and hyperlinks? Thanks !
3
by: Rich Squid | last post by:
Hello Here's my basic problem: On my asp.net form page I have a DetailsView (default mode=edit) bound to a AccessDataSource control. Users can successfuly update a databound template field,...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
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.