473,738 Members | 6,332 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3671
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
1550
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 an ActiveXObject and use the function validate(). The function validate() does some sort of validation of the given schema aginst the standard dtds mentioned above and throws error in case the validation fails. But there are many cases which...
0
1426
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 the common type definitions from 1 or more of the component XML schemas rather than just explicitly adding the common definitions in every XML schema we create. This works great from a definition and validation point of view, but I
4
1691
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 article (http://www.xfront.com/ZeroOneOrManyNamespaces.html) imply that I can submit an XML instance without having to qualify each element. How do I accomplish this while still using .Net & the
1
2850
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(); xmlReaderSettings.Schemas.Add(@"http://myschema/myschema.xsd", "myschema.xsd");
0
1438
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 I'm currently on starts with XML files (say, 10 as an example) that, after validation, are reconfigured via SAS for Teradata loading. Since we're in development, the location of needed schemas isn't fixed, often moving as phases are completed...
5
2155
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
220
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 borrowed from the .NET help files. It blows up when I try to refererence a schema that is on my desktop. If you can, please correct my misunderstanding about referencing schemas, as evidenced in the below example. Am I attempting the...
5
40931
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 I want to combine with an XML/Schema that a friend has created. Both XML files/Schema validate individually. Now comes the tricky part, combining them. I've created a new XML file and schema, called catalog.xml and catalog.xsd. Into the...
3
2392
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 ensure than a multiplicity is equal to the value held in another attribute? In case anyone is interested, I am storing knitting charts in XML, for use in a Java application. They are a 2x2 matrix and I store the number of rows as an attribute of...
0
8787
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9473
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9334
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9259
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9208
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8208
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6750
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6053
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4569
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...

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.