Jump to content
Sign in to follow this  
Guest vinnieattack

[help] about external DTD and element repetition

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. :)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...