[Home] [By Thread] [By Date] [Recent Entries]

  • From: Rob Lugt <roblugt@e...>
  • To: billinfo@s..., xml-dev@l...
  • Date: Mon, 08 Oct 2001 14:51:51 +0100

BillGong <billinfo@s...> wrote:
(and I hit "send" to quickly)

> I created 3 DTDs in XML Spy as below:
> 1.report.dtd
> <!ELEMENT report (title,paragraph+)>
> <!ELEMENT title (#PCDATA)>
> <!ELEMENT paragraph (#PCDATA|emph)*>
> <!ELEMENT emph (#PCDATA)>
>
> 2.person.dtd
> <!ELEMENT person (firstname, lastname)>
> <!ELEMENT firstname (#PCDATA)>
> <!ELEMENT lastname (#PCDATA)>
>
> 3.report_person.dtd
> <!ENTITY % report "report.dtd">
> <!ENTITY % person "person.dtd">
> <!ELEMENT P_R (%person; , %report;)>
>
> When I create an XML file trying to use P_R in
> report_person.dtd, it failed. Can anyone here tell
> me the reason? Very thanks.
>

You need to use the SYSTEM keyword in your parameter entity declarations
otherwise the parser treats them as literals.  Also, the PEs need to be
dereferenced, and the content models should contain element names not the
names of DTDs.

Here's the corrected report_person.dtd:

<!ENTITY % report "report.dtd">
%report;
<!ENTITY % person "person.dtd">
%person;
<!ELEMENT P_R (person, report)>


Hope this helps (and that I got it right this time)
~Rob




Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member