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

DTD vs. schema?

Hello,
I am sort of new to all this XML, but I would like to enforce a
date format within one of my XML elements. Everything I've read
indicates that a DTD is not suitable for this purposes, so I should
use a schema. In as far as this seems to be the only limitation of a
DTD, are there any disadvantages to using a schema? Or should I just
use a DTD and have a little extra programming to verify valid date
formats (which seems to defeat the purpose of XML)?

Thanks for any advice anyone can provide, Dave
Jul 20 '05 #1
3 3758
D. Alvarado scribbled something along the lines of:
Hello,
I am sort of new to all this XML, but I would like to enforce a
date format within one of my XML elements. Everything I've read
indicates that a DTD is not suitable for this purposes, so I should
use a schema. In as far as this seems to be the only limitation of a
DTD, are there any disadvantages to using a schema? Or should I just
use a DTD and have a little extra programming to verify valid date
formats (which seems to defeat the purpose of XML)?

Thanks for any advice anyone can provide, Dave


You can't use the W3C Validator any longer if you use Schema instead of
a DTD, but if your text editor can do that or you care to search for a
schema based validator, even that shouldn't be an issue.

Read a little about RELAX NG and W3C's XML Schema, then decide which
suits you most. I think there's other schemas as well, but those are the
only ones I can think of right now.
You should be able to find the XML Schema recommendation in the XML
section of the W3C website [1] and the RELAX NG spec should be somewhere
at OASIS [2].

[1] http://www.w3.org
[2] http://www.oasis-open.org
--
Alan Plum, WAD/WD, Mushroom Cloud Productions
http://www.mushroom-cloud.com/
Jul 20 '05 #2


D. Alvarado wrote:
I am sort of new to all this XML, but I would like to enforce a
date format within one of my XML elements. Everything I've read
indicates that a DTD is not suitable for this purposes, so I should
use a schema. In as far as this seems to be the only limitation of a
DTD, are there any disadvantages to using a schema? Or should I just
use a DTD and have a little extra programming to verify valid date
formats (which seems to defeat the purpose of XML)?


If you want to use a schema you need a parser that understands schemas
and can validate against schemas and schema validation is more complex
than DTD validation. However by now there are many parsers with schema
support, look at http://xml.apache.org/ for the Xerces C++ and the
Xerces Java solution for instance, or on Windows MSXML 4 is an option.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #3
It's been a while since I experimented with it but ...

You can use a DTD if you opt to have the data be an attribute
instead of an element.
la***********@zipmail.com (D. Alvarado) wrote in message news:<9f**************************@posting.google. com>...
Hello,
I am sort of new to all this XML, but I would like to enforce a
date format within one of my XML elements. Everything I've read
indicates that a DTD is not suitable for this purposes, so I should
use a schema. In as far as this seems to be the only limitation of a
DTD, are there any disadvantages to using a schema? Or should I just
use a DTD and have a little extra programming to verify valid date
formats (which seems to defeat the purpose of XML)?

Thanks for any advice anyone can provide, Dave

Jul 20 '05 #4

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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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,...
0
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...

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.