473,564 Members | 2,759 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3776
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***********@z ipmail.com (D. Alvarado) wrote in message news:<9f******* *************** ****@posting.go ogle.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
3313
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 schema instance.
0
4215
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> > <password>brown</password> > </userlogin> > Above is my schema instance.
6
2480
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. I've made a small list of some good and bad points of both. These points don't really go into the grammar aspects of these languages, but are more...
1
2086
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? Any related informaiton on this is appreciated. Thanks!
4
2383
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 generate any of the specific instances. sample schema one: <?xml version="1.0" encoding="UTF-8"?> <xs:schema...
2
2477
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 target namespace of the components from the included schema document. I'm confused because of the rules I read in the XML Schema spec...
0
1711
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" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:element name="Loan"> <xs:complexType> <xs:sequence> <xs:element...
4
2489
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 of projects. Therefore, I wish to include the project customType in the projectCollection namespace. I therefore have declared two xsd documents:...
6
2568
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 schema for it with Visual Studio, I get the error "Failed to create a schema for this data file because:
0
11256
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 information for the". I am using Cassini as the web server on my PCand I can still run my site from within VWD. Does anyone know what I have done to cause...
0
7665
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7583
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...
0
8106
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...
0
7950
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...
0
6255
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...
1
5484
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...
0
3643
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...
1
2082
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 we have to send another system
0
924
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.