473,586 Members | 2,681 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Simple XML & XSD Question

We have developed about 80 XML documents, each probably 150 lines long, that
are all supposed to conform to a schema. My understanding is the way to
show that an XML document conforms to a schema is to include a reference to
the XSD in the XML document, and check that it is valid.

Some other members of the project team don't want to include a reference to
the XSD in the XML documents, citing possible differences in parsers.

Is my understanding of XML / XSD correct? That is, the standard way to
prove that a well formed XML document conforms to a schema is to include the
reference to the XSD in the XML document.

Thanks.

-- Mark
Nov 12 '05 #1
6 4234
Mark Jerde wrote:
We have developed about 80 XML documents, each probably 150 lines
long, that are all supposed to conform to a schema. My understanding
is the way to show that an XML document conforms to a schema is to
include a reference to the XSD in the XML document, and check that it
is valid.

Some other members of the project team don't want to include a
reference to the XSD in the XML documents, citing possible
differences in parsers.

Is my understanding of XML / XSD correct? That is, the standard way
to prove that a well formed XML document conforms to a schema is to
include the reference to the XSD in the XML document.
Hi Mark,

A few remarks...

1. One thing is for sure, there will be no way for a client application
to validate the XML document against its schema if the document doesn't
contain any reference to the schema and if the application is not made
aware of this schema from an external source of information.

2. Validating XML documents against their schema is not always necessary
as long as they were produced in a safe way (e.g. they can be validated
just after being produced). It depends on what you need to do with them
and on how you distribute them.

3.> the standard way to prove that a well formed XML document
conforms to a schema is to
include the reference to the XSD in the XML document


Adding a reference to the schema in the document will not prove
anything. It depends on how the client application loads the XML
document. For example, in .Net, if you don't use a validating reader, no
validation occurs. The schema reference is just ignored. Again, you can
provide the schema's URL to the client application, if needed, by using
an external channel. In .Net, when using an XmlValidatingRe ader, the
schema can be specified separately from the document itself (See Schemas
property).

4. >possible differences in parsers.

If the schema is correctly defined, any reliable and correctly written
validating parser will validate the document against that schema.
There's no room for interpretation, the XSD specification is accurate
enough, IMHO. If the parser fails to validate a valid document, then the
parser is buggy. Not referencing the schema is not a protection against
a buggy parser.

--
Patrick Philippot - Microsoft MVP
MainSoft Consulting Services
www.mainsoft.fr
Nov 12 '05 #2
Hi Mark,

If you'd be using these in Microsoft Word, by using the same TargetNamespace
in both the xml and xsd files you can get Word to associate the schema.
Assuming it's been added to the user's schema library, that is.
We have developed about 80 XML documents, each probably 150 lines long, that
are all supposed to conform to a schema. My understanding is the way to
show that an XML document conforms to a schema is to include a reference to
the XSD in the XML document, and check that it is valid.

Some other members of the project team don't want to include a reference to
the XSD in the XML documents, citing possible differences in parsers.

Is my understanding of XML / XSD correct? That is, the standard way to
prove that a well formed XML document conforms to a schema is to include the
reference to the XSD in the XML document.


Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)

Nov 12 '05 #3
Thanks, Patrick & Cindy.

-- Mark
Nov 12 '05 #4
I wonder is there a way to embed a schema into the document, rather then
just referencing it. So that when the schema is needed it could be obtained
directly from the document.

--
Yours, respectfully
Ruslan Popov
Nov 12 '05 #5
Ruslan Popov wrote:
I wonder is there a way to embed a schema into the document, rather
then just referencing it. So that when the schema is needed it could
be obtained directly from the document.


Hi,

For sure, you can do that. See an example of inline schemas here:

http://msdn.microsoft.com/library/de...ineSchemas.asp
http://groups-beta.google.com/group/...ple.xml?part=2

However, using inline schemas generates new validation problems. For
example, since the <schema> element is a child of the root element, the
root element itself cannot be validated (when using an
XmlValidatingRe ader for example).

http://msdn.microsoft.com/library/de...exsdschema.asp

--
Patrick Philippot - Microsoft MVP
MainSoft Consulting Services
www.mainsoft.fr
Nov 12 '05 #6
Use FREEWARE XMLFox XML/XSD editor:
http://www.xmlfox.com/xml_schema_editor.htm

XMLFox is an XML editing and validation tool for creating valid,
well-formed XML documents and/or XSD Schema. It includes an XML View,
XML Tree, XML Grid, and XML Script modes for editing, as well as
extensive find capabilities for text and XML data. Additional
features include XML and Schema Validation, standard editing
features, XSD Schema building and more.
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Nov 12 '05 #7

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

Similar topics

2
1983
by: Gene Ellis | last post by:
Put simple I would like to have this line in my XSL template: document.writeln("<a href='http://www.mydomain.com/user/login.php' class='login'>") My XML parser seems to be breaking on the single quotes. Do you know how I can use double quotes? Or even single quotes? I have tried using a backslash, and even tried using their numeric and...
12
9447
by: Sammy | last post by:
Hi, my mind is going crazy. I have tried everything I can think of to no avail. I have tried Disable Output Escaping. I tried to think of a way of enclosing the attribute data in a CDATA element. That did not parse. Here is my question: How can I get attribute values to not get converted from &apos; to '
5
1613
by: Ryan Waye | last post by:
I have looked extensively, and I have been unable to find commands that allow a C++ program to manipulate other files. How do I make C++ do simple things like copy and past files, and navigate directories? Also, where is a good command reference that I can use so I dont have to post these annoying questions? RW
13
2349
by: LRW | last post by:
Having a problem getting a onSubmit function to work, to where it popsup a confirmation depending on which radiobutton is selected. Here's what I have: function checkdel() { if (document.getElementById"].value=='1') { confirm('Are you sure you want to delete this file?'); } } ......
11
6410
by: Jeremy | last post by:
How can one stop a browser from converting &amp; to & ? We have a textarea in our system wehre a user can type in some html code and have it saved to the database. When the data is retireved and
6
2235
by: cj | last post by:
I'm receiving an xml formatted string that I pull data from by reading it into an xml document like this: Dim doc As New Xml.XmlDocument doc.LoadXml(respstr) Dim co_name As Xml.XmlNodeList = doc.GetElementsByTagName("co_name") textbox1.text = co_name(0).innertext Now I'm getting company names that have ampersands in them. I was not...
14
5918
by: Arne | last post by:
A lot of Firefox users I know, says they have problems with validation where the ampersand sign has to be written as &amp; to be valid. I don't have Firefox my self and don't wont to install it only because of this, so I hope some of you gurus can enlighten me with this :) In what circumstances can the "&amp;" in the source code be involuntary...
1
1573
by: macklin01 | last post by:
Hi, everybody. I'm trying to do some last cleaning up on the following php page I wrote: http://www.math.uci.edu/~pmacklin/Publications.php This URL parses an XML file of publications: http://www.math.uci.edu/~pmacklin/Publications.xml
0
6727
by: Vijay | last post by:
Prep Courses for International Certifications, CSTE & CSQA & ISEB & ISTQB &Business Analyst & SOA Certifications in HYDERABAD. After receiving overwhelming response to our last 50+ batches, SPECTRAMIND SOLUTIONS now announces a new batch of Prep Courses for CSQA & CSTE& ISEB & ISTQB & Business Analyst & SOA so as to prepare you...
2
3513
by: nicholas08 | last post by:
I am new to programming and trying to work on a simple console app. I am making a simple Library Management system where the user/admin can manage members and item. Attaching the menu so it's clear to understand what I am saying. http://i475.photobucket.com/albums/rr116/nicholasCsharp/Untitled.jpg So far I have only looked at Item and Member...
0
7839
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8202
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. ...
0
8338
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...
1
5710
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3837
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...
0
3865
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2345
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
1
1449
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1180
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.