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

Why do we need XML Schemas other than for automatic validation?

Sorry for asking this beginner question.

I've written DTDs so far and read about XML Schemas. I understand that
they are a replacement of the DTD fundamentally, and therefore allow
for the validation of an XML document.

My question really is:

Why do we need XML Schemas other than for validation of an XML
document? I am more interested in knowing if already available
"common" XML tools such as the MSXML parser, or DOM Level 3
implementations in today's browsers can do something like:

a) read an XML Schema;
b) then, read the XML document that is defined in the schema;
c) ?? magic ?? read some translation rules (an XSLT file?) that says,
for instance, that <xs:element name="foo" type="xs:string" /'s value
must go to the column "bar" of this SQL Server database, etc., etc.

So, my question really is, can the available XML tools in the market
from major vendors read an XML Schema, and then not simply validate an
XML document but also read some translation rules from an XSLT file
and do the transformation without a developer having to write any
bespoke application on his part, if he just writes the XML, XSD and
XSLT sheet?
Jun 27 '08 #1
3 3631
a) read an XML Schema;
b) then, read the XML document that is defined in the schema;
c) ?? magic ?? read some translation rules (an XSLT file?) that says,
for instance, that <xs:element name="foo" type="xs:string" /'s value
must go to the column "bar" of this SQL Server database, etc., etc.
Websearch for "XML data binding"
Jun 27 '08 #2
Water Cooler v2 wrote:
Sorry for asking this beginner question.

I've written DTDs so far and read about XML Schemas. I understand that
they are a replacement of the DTD fundamentally, and therefore allow
for the validation of an XML document.
More of an enhancement to the functionality (with some exceptions).
My question really is:

Why do we need XML Schemas other than for validation of an XML
document?
A schema lets you specify much finer validation criteria (eg "this
element or attribute must contain values in date format" or "this
element or attribute can only have numeric values between 42 and 69" or
whatever). You can't do that in a DTD.

If you don't need this kind of data validation, a DTD may be all you
need. Typically, conventional text publishing applications don't need
it, although IMHO many of them would benefit from it (date and document
control being two obvious areas).
I am more interested in knowing if already available
"common" XML tools such as the MSXML parser, or DOM Level 3
implementations in today's browsers can do something like:
I rarely encounter either of these, so I can't speak for them.
Browser implementation of XML is generally very poor.
a) read an XML Schema;
b) then, read the XML document that is defined in the schema;
c) ?? magic ?? read some translation rules (an XSLT file?) that says,
for instance, that <xs:element name="foo" type="xs:string" /'s
value must go to the column "bar" of this SQL Server database, etc.,
That process is pretty conventional elsewhere, up to your last line: an
XSLT processor like Saxon, for example, can read the Schema or DTD,
process the document and apply an XSLT file, and specify what to output
when <foo>bar</foois encountered (XSLT being a declarative language,
not a procedural one). The output from XSLT itself is normally some
other XML format, or [old] HTML, or just text (but including formats
expressed in text, such as LaTeX, or a control file or data file). To go
further and bind such output functions to an external process like an
SQL server needs additional layers of software.
So, my question really is, can the available XML tools in the market
from major vendors read an XML Schema, and then not simply validate an
XML document but also read some translation rules from an XSLT file
and do the transformation without a developer having to write any
bespoke application on his part, if he just writes the XML, XSD and
XSLT sheet?
Yes, but XSLT itself stops at the point where it creates the output file
or stream. To push that output into another process requires a binding
to that process, which may or may not be included in a specific tool.

And in general this whole procedure is not usually a single monolithic
program, but a set of linked components (parser, validator, editor, API,
monitor, logger, transformer, output bindings, responder, etc). But
depending on the way it is marketed, a given tool may be wrapped so that
it *looks* like a monolith :-)

///Peter
--
XML FAQ: http://xml.silmaril.ie/
Jun 27 '08 #3
On 15 May, 23:35, Water Cooler v2 <wtr_...@yahoo.comwrote:
Sorry for asking this beginner question.

I've written DTDs so far and read about XML Schemas. I understand that
they are a replacement of the DTD fundamentally, and therefore allow
for the validation of an XML document.
Why do we need XML Schemas other than for validation of an XML
document?
* Schema is itself an XML document, so it's automatically processable,
in a way that DTDs aren't

* Schema does data typing

* Schema is an XML document, so you can use namespacing to extend it
and add other sorts of descriptive information beyond the usual
structure and type. Look at the web services world, SOAP, WSDL, EAI

* Schema is the starting point for RDFS, OWL and all the SemWeb stuff.
You can not only specify structure to allow a "valid yes/no" test,
but you can start to _communicate_ information, such as communicable
semantics.
Jun 27 '08 #4

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

Similar topics

1
by: Divya Alice George | last post by:
Dear Sir, My problem is that i am required to validate a given schema against the standard DTDs provided by w3.org- namely xmlschema.dtd and datatypes.dtd. Presently, I load the given schema into...
0
by: kyancy | last post by:
Hello All. We have several XML schemas to describe common component document parts. We then create new XML schemas as necessary that use "xsd:import schemaLocation=whateverLocation.." to include...
4
by: anonymous | last post by:
When I use the schema collection to apply many schemas to one XML instance document, I get an error if I do not qualify every element with the appropriate namespace. Both the W3C site and this...
1
by: peter.moss | last post by:
I have an XML schema and I am trying to validate any XML document sent against it. Here's some of the code: XmlReaderSettings xmlReaderSettings = new XmlReaderSettings(); ...
0
by: wolf_y | last post by:
I'm a newbie to XML and primarily program in SAS, so even though I've consulted documentation, I can't translate into language I understand. I hope I can explain the problem clearly. The project...
5
by: Donal McWeeney | last post by:
Hi, Using .Net 2.0 what is the best way to determine the list of schemas used by a XmlDocument. Thanks Donal
0
by: mgoold2002 | last post by:
Hello. I'm new to using XML/HTML. I am trying to learn to validate xml sample docs against schemas. I have an XML and Schema file (.xsd) saved to my desktop. Below is my sample code, which is...
5
by: carlpayne1984 | last post by:
Hi all, I'm fairly new to XML, however already I have studied myself stupid without being able to solve this problem. Basically, I have an XML file/Schema about a CD catalog that I've created that...
3
by: pr | last post by:
Is it possible to use an XML Schema to ensure that the data in one attribute is less than or equal to the value in another? Is it possible, through the use of the <xsd:sequenceor similar, to...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.