Jump to content

[help] about external DTD and element repetition


Guest vinnieattack
 Share

Recommended Posts

Guest vinnieattack

Hi, all, I'm a greenhand to XML. The editor i used is XMLSpy 6.0 enterprise edition. I was trying to create a library dtd. A library has a collection of books and videos. and each item must have title, callnumber. The code i made is like this :

 <!DOCTYPE library [<!ELEMENT library (book+, video+)> <!ELEMENT book (title, callnum)> <!ELEMENT title EMPTY> <!ELEMENT callnum EMPTY><!APPLIST title tl CDATA #REQUIRED> <!APPLIST callnum num CDATA #REQUIRED> <!ELEMENT video (title, callnum)> <!ELEMENT title EMPTY> <!ELEMENT callnum EMPTY> <!APPLIST title tl CDATA #REQUIRED> <!APPLIST callnum num CDATA #REQUIRED>]>

Then i was told the element title, callnum had been defined already. So far, my 1st question is: Do i need to change the element name? Or it willbe alright if i just delete the extra element?After that, i tried external dtd. I copied two files from internet, 1.xml, 1dtd.the code is as follows:1.xml content

<?xml version="1.0"?><!DOCTYPE name SYSTEM "1.dtd"><name>	<first>Child element.</first></name>

1.dtd content

<!ELEMENT name (first)><!ELEMENT first (#PCDATA)>

The xml file can show properly while the dtd file cannot work. The error information is like this: -----------------------------------------------------------------------------------Cannot have a DTD declaration outside of a DTD. Error processing resource 'file:///C:/Documents and Settings/abc/My Documen...<!ELEMENT name (first)>----------^-----------------------------------------------------------------------------------Really hope some kind person can enlighten me , 3x in advance. :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...