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

xml schema

Hello!

First of all does every Xml document have a schema ?

I'm trying to get the right feeling for what a xml schema is ?
As far as I understand it's used for defining a structure how you are permitted to right your Xml document.

Is it possible to make a simile to C# in some sensible way.

//Tony
Aug 14 '08 #1
9 1496
Tony Johansson <jo*****************@telia.comwrote:
First of all does every Xml document have a schema ?
No.
I'm trying to get the right feeling for what a xml schema is ?
As far as I understand it's used for defining a structure how you are
permitted to right your Xml document.
Yes, pretty much.
Is it possible to make a simile to C# in some sensible way.
I have no idea what you mean by this, I'm afraid.

--
Jon Skeet - <sk***@pobox.com>
Web site: http://www.pobox.com/~skeet
Blog: http://www.msmvps.com/jon.skeet
C# in Depth: http://csharpindepth.com
Aug 14 '08 #2
Hello!

When should a Xml schema be used and when can you skip it ?

//Tony

"Jon Skeet [C# MVP]" <sk***@pobox.comskrev i meddelandet
news:MP*********************@msnews.microsoft.com. ..
Tony Johansson <jo*****************@telia.comwrote:
First of all does every Xml document have a schema ?

No.
I'm trying to get the right feeling for what a xml schema is ?
As far as I understand it's used for defining a structure how you are
permitted to right your Xml document.

Yes, pretty much.
Is it possible to make a simile to C# in some sensible way.

I have no idea what you mean by this, I'm afraid.

--
Jon Skeet - <sk***@pobox.com>
Web site: http://www.pobox.com/~skeet
Blog: http://www.msmvps.com/jon.skeet
C# in Depth: http://csharpindepth.com

Aug 14 '08 #3
Tony Johansson <jo*****************@telia.comwrote:
When should a Xml schema be used and when can you skip it ?
It's a bit like static typing vs dynamic typing - XML schema allows you
to validate the XML document to some extent. It also enables editors to
provide the equivalent of Intellisense.

Personally I'm not a massive fan, but it depends on the situation. It's
a good way of conveying a specification in a machine-readable format.

--
Jon Skeet - <sk***@pobox.com>
Web site: http://www.pobox.com/~skeet
Blog: http://www.msmvps.com/jon.skeet
C# in Depth: http://csharpindepth.com
Aug 14 '08 #4
On Thu, 14 Aug 2008 11:46:33 +0200, Tony Johansson wrote:
Hello!

When should a Xml schema be used and when can you skip it ?
My take on this is that schema validation should be used sparingly in
production. Strict adherence to an XML standard (schema) must be done
during testing between exchanging parties but you should be free to
handle schema validation errors in production.

Ken
Aug 14 '08 #5

"Tony Johansson" <jo*****************@telia.comwrote in message
news:uA**************@TK2MSFTNGP02.phx.gbl...
Hello!
First of all does every Xml document have a schema ?
I'm trying to get the right feeling for what a xml schema is ?
As far as I understand it's used for defining a structure how you
are permitted to right your Xml document.
Is it possible to make a simile to C# in some sensible way.
An XML document without a schema is roughly like a C# object whose
only property is a list of name-value pairs. You can iterate through
the list, but until you do, there's no way to tell what names will be
present or what type each value will have.

An XML document with a schema is like a normal C# object. The type of
the object (just like the schema) shows you the properties and their
types.
Aug 14 '08 #6
On Aug 14, 1:54*pm, Ken Foskey <rmove.fos...@optushome.com.auwrote:
My take on this is that schema validation should be used sparingly in
production. *Strict adherence to an XML standard (schema) must be done
during testing between exchanging parties but you should be free to
handle schema validation errors in production.
A better rule is to be lax on your input but strict on your output. So
you wouldn't validate XML when reading it, trying to detect and
recover from errors as you go, but you'd validate your outputs, so as
to be sure that it adhers to the spec, and your own program and any
third-party product can read it back correctly.

Also, .NET XML schema validation classes allow one to do incremental
validation, and perform recoverable error handling.
Aug 14 '08 #7
Pavel Minaev <in****@gmail.comwrote:
On Aug 14, 1:54*pm, Ken Foskey <rmove.fos...@optushome.com.auwrote:
My take on this is that schema validation should be used sparingly in
production. *Strict adherence to an XML standard (schema) must be done
during testing between exchanging parties but you should be free to
handle schema validation errors in production.
A better rule is to be lax on your input but strict on your output.
I find it's better to be strict on both input and output. Everyone
being lax on input means that errors on output don't get noticed. Being
lax on input is what got browsers into such a horrible mess as they
tried to work out what invalid HTML was meant to read.

Invalid XML is particularly inexcusable, as it's meant to be machine
generated - if something is generating XML which doesn't conform to the
spec, it is *broken* and you shouldn't work with it IMO.

--
Jon Skeet - <sk***@pobox.com>
Web site: http://www.pobox.com/~skeet
Blog: http://www.msmvps.com/jon.skeet
C# in Depth: http://csharpindepth.com
Aug 14 '08 #8
Tony Johansson wrote:
When should a Xml schema be used and when can you skip it ?
You should use it whenever you have time to do one.

Arne
Aug 15 '08 #9
Pavel Minaev wrote:
On Aug 14, 1:54 pm, Ken Foskey <rmove.fos...@optushome.com.auwrote:
>My take on this is that schema validation should be used sparingly in
production. Strict adherence to an XML standard (schema) must be done
during testing between exchanging parties but you should be free to
handle schema validation errors in production.

A better rule is to be lax on your input but strict on your output. So
you wouldn't validate XML when reading it, trying to detect and
recover from errors as you go, but you'd validate your outputs, so as
to be sure that it adhers to the spec, and your own program and any
third-party product can read it back correctly.

Also, .NET XML schema validation classes allow one to do incremental
validation, and perform recoverable error handling.
I would not recommend continue processing XML that is not
valid according to the expected XSD.

Something is wrong and until the reason is invesigated
it could do more harm than good to continue.

Arne
Aug 15 '08 #10

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

Similar topics

2
by: wooks | last post by:
<?xml version='1.0'?> <userlogin xmlns="urn:faster:userlogin" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'> <login>mick</login> <password>brown</password> </userlogin> Above is my...
0
by: C. M. Sperberg-McQueen | last post by:
wooks (wookiz@hotmail.com) wrote: > <?xml version='1.0'?> > <userlogin xmlns="urn:faster:userlogin" > xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'> > <login>mick</login> > ...
6
by: Pieter | last post by:
I've read a lot of posts on "why relax ng is so very good" and on "why w3c xml schema should be the only schema language". I'm, however, still not clear on why I should prefer one over the other. ...
1
by: Hari Om | last post by:
Subject: XML Schema to XML Schema Conversion I have an XML Schema A which needs to mapped to another XML Schema B. Is there any handy tool which I could use to convert from Schema A to Schema B?...
4
by: Gordon Dickens | last post by:
I have target xml to generate from schema. All of the XML instances have the same global element i.e. <base>. I would like to combine all of the schemas into a single schema where I could...
2
by: Stanimir Stamenkov | last post by:
I'm trying to find out if it is permissible to include a schema document with absent target namespace to a schema with specified target namespace, and if it is, what are the rules to resolve the...
0
by: Rajesh Jain | last post by:
I Have 2 separate schemas. --------------Schema 1 is defined as below----------- <xs:schema targetNamespace="http://Schemas/1" xmlns="http://Schemas/1" xmlns:xs="http://www.w3.org/2001/XMLSchema"...
4
by: Iain A. Mcleod | last post by:
Hi I'm stuck with the following schema validation problem in VS.NET 2003: I have two types of xml document and related schema: project and projectCollection. A projectcollection is just a set...
6
by: Martin | last post by:
Hi, I have a xml file like the one below <?xml version="1.0" encoding="utf-8"?><e1 xmlns:e1="http://tempuri.org/Source1.xsd" e1:att1="1" e1:att2="2" e1:rest="345"/> If I try to create a...
0
by: Derek | last post by:
I am creating an intranet using Visual Web Developer Express Edition. Everything has been working OK until yesterday when I started getting 62 messages all beginning "Could not find schema...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.