This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JavaScript as Element value

 
SAM KUMAR
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am trying to validate following XML which has javascript value in the "DESCRIPTION" element:
<?xml version="1.0"?>
<!DOCTYPE TEST [
<!ELEMENT TEST (MESSAGE+)>
<!ELEMENT MESSAGE (ID, DESCRIPTION)>
<!ELEMENT ID (#PCDATA) >
<!ELEMENT DESCRIPTION ANY>
]>
<TEST>
<MESSAGE>
<ID>1</ID>
<DESCRIPTION>Test message, <a href="javascript op('/help.html','Help','menubar,status,scrollbars,width=550,height=610')">click here for help.</a></DESCRIPTION>
</MESSAGE>
</TEST>
I am getting following error:
"The element a is used but not declared in the DTD/Schema"
Error line:11
Any suggestion?
Thanks in advance.
Sam
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Encapsulate the contents of DESCRIPTION into a CDATA block.
 
Dmitry Kirsanov
Author
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Lasse Koskela:
Encapsulate the contents of DESCRIPTION into a CDATA block.

Better yet, rethink your XML vocabulary. Why are you using this DTD? Can you extend it? If you can, then the fact that you needed to use another element inside DESCRIPTION is an indication that the DTD is not adequate for the markup practice. For example, if you want to allow arbitrary inline-level HTML markup inside DESCRIPTION, you can copy the corresponding DTD fragment from HTML DTD.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic