OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   RE: [xml-dev] Help creating DTD

[ Lists Home | Date Index | Thread Index ]


There aren't any stupid questions |-).

Using DTD's you use the DOCTYPE statements.

<!DOCTYPE ORDER SYSTEM "http://www.eccnet.com/dtds/order.dtd";>

Note:  Substitute your system URI.

Hope this helps.

Betty

/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
Betty Harvey                         | Phone: 410-787-9200 FAX: 9830
Electronic Commerce Connection, Inc. |
harvey@eccnet.com                    | Washington,DC SGML/XML Users Grp
URL:  http://www.eccnet.com          | http://www.eccnet.com/xmlug/
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\\/\/

On Tue, 9 Jul 2002, Karl Stubsjoen wrote:

> Stupid question:  how do I refernce the DTD from my XML documentation?  Lets
> say I want the DTD to reside in its own file local to the XML document.
>
> Karl
>
> -----Original Message-----
> From: Betty Harvey [mailto:harvey@eccnet.com]
> Sent: Tuesday, July 09, 2002 1:34 PM
> To: Karl Stubsjoen
> Cc: Xml-Dev
> Subject: Re: [xml-dev] Help creating DTD
>
>
>
> Karl:
>
> 	This should work.
>
> <!ELEMENT ORDER (UID, DEALER, ORDERS+)>
> <!ELEMENT UID (#PCDATA)>
> <!ELEMENT DEALER (#PCDATA)>
> <!ELEMENT ORDERS (ITEM+)>
> <!ELEMENT ITEM (#PCDATA)>
> <!ATTLIST ITEM
>           id NMTOKEN #REQUIRED
>           datatype CDATA #FIXED "number">
>
> There are a couple of things to look at here.  The first is the 'id'
> for the <ITEM>. If you want to use the XML datatype ID for the unique
> identifier, then the ID would have to start with an alphabetic character.
> Also, there is limited datatyping available in DTD's for attributes and
> none for elements.  This is why I included the #FIXED attribute 'number'.
> An external process would be required to validate the the content of
> <ITEM> is a number.
>
> The other alternative if you really need validataion for datatyping is to
> use XML Schema.
>
> Hope this helps.
>
> Betty
>
> /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
> Betty Harvey                         | Phone: 410-787-9200 FAX: 9830
> Electronic Commerce Connection, Inc. |
> harvey@eccnet.com                    | Washington,DC SGML/XML Users Grp
> URL:  http://www.eccnet.com          | http://www.eccnet.com/xmlug/
> /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\\/\/
> On Tue, 9 Jul 2002, Karl Stubsjoen wrote:
>
> > Hello,
> >
> > I need help creating a DTD.  Actually, is it a DTD that I mean to create?
> I
> > have an existing XML document, from this I need to create a *template*
> > (dtd?) which I can then use to validate future XML documents.
> >
> > My XML document looks like this:
> >
> >   <?xml version="1.0" encoding="UTF-8" ?>
> > - <ORDER>
> >   	<UID>DSM/RSM USER NAME</UID>
> >   	<DEALER>21</DEALER>
> > - <ORDERS>
> >   	<ITEM id="0116602800">7</ITEM>
> >   	<ITEM id="1106500706">8</ITEM>
> >   	<ITEM id="1106502706">9</ITEM>
> >   	<ITEM id="1106700706">5</ITEM>
> >   	<ITEM id="1106702706">7</ITEM>
> >   	<ITEM id="0100102883">3</ITEM>
> >   	<ITEM id="0100100805">333</ITEM>
> >   	<ITEM id="0101000725">5</ITEM>
> >   </ORDERS>
> >   </ORDER>
> >
> > I'll try and describe the above:
> >
> > <ORDER> can contain any number of child elements
> > <UID> must be included
> > <DEALER> must be included
> > <ORDERS> must be included
> >
> > <ORDERS> can contain multiple ITEM(s) but restricted to just ITEM nodes
> > <ITEM> must have unique id property and the value of item must be numeric
> >
> > 0
> >
> > Thanks for the help!
> > *meanwhile I will give this a go myself!*
> >
> > Karl
> >
> >
> > -----------------------------------------------------------------
> > The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
> > initiative of OASIS <http://www.oasis-open.org>
> >
> > The list archives are at http://lists.xml.org/archives/xml-dev/
> >
> > To subscribe or unsubscribe from this list use the subscription
> > manager: <http://lists.xml.org/ob/adm.pl>
> >
>
> --
>
>
>
> -----------------------------------------------------------------
> The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
> initiative of OASIS <http://www.oasis-open.org>
>
> The list archives are at http://lists.xml.org/archives/xml-dev/
>
> To subscribe or unsubscribe from this list use the subscription
> manager: <http://lists.xml.org/ob/adm.pl>
>
>

-- 






 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS