Next in thread → Next in month →

Re: [xml-dev] DTDs newbie question

From
Jeff Rafter <>
To
Bertin Jean-Charles <>,
Date
2002-01-08T04:34:25Z
ID
<001d01c197fd$c0bb6070$5a171318@C1980223A>
Thread
Re: [xml-dev] DTDs newbie question
<snip/>

> but now i want to define a element 'registry' which a value struct like
> this: Do i need a schema for that ?

You need to declare it within your DTD, yes. The DTD is a schema but it is
not an XML Schema-- you probably know that but just to be clear. Simply add

<!ELEMENT registry (value) >

To your DTD. So this document would be valid:

<?xml version="1.0"?>
<!DOCTYPE registry [
 <!ELEMENT registry (value) >
 <!ELEMENT value (string | int | struct) >
 <!ELEMENT int (#PCDATA) >
 <!ELEMENT string (#PCDATA) >
 <!ELEMENT struct (member)+ >
 <!ELEMENT member (name, value) >
 <!ELEMENT name (#PCDATA)>
]>
<registry>
  <value>
    <struct>
      <member>
        <name></name>
        <value>
          <string></string>
        </value>
      </member>
    </struct>
 </value>
</registry>

All the best
Jeff Rafter
Defined Systems
http://www.defined.net
XML Development and Developer Web Hosting
Next in thread → Next in month →