473,511 Members | 15,630 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 4227
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 XmlValidatingReader, 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
XmlValidatingReader 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
1976
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...
12
9420
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...
5
1606
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...
13
2331
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...
11
6387
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...
6
2232
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 =...
14
5908
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...
1
1569
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: ...
0
6715
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, ...
2
3503
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...
0
7242
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,...
0
7138
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
7353
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,...
1
7075
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
3222
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...
0
3212
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1572
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 ...
1
781
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
446
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...

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.