Two Laptop Bag*
The moose likes XML and Related Technologies and the fly likes JavaScript as Element value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "JavaScript as Element value" Watch "JavaScript as Element value" New topic
Author

JavaScript as Element value

SAM KUMAR
Greenhorn

Joined: Jan 02, 2002
Posts: 25
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

Joined: Jan 23, 2002
Posts: 11962
    
    5
Encapsulate the contents of DESCRIPTION into a CDATA block.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Dmitry Kirsanov
Author
Ranch Hand

Joined: Apr 26, 2004
Posts: 33
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JavaScript as Element value
 
Similar Threads
simple question for xslt
XSL
Rough Start
logic:match , logic:notEqual not working
xsl:if and XPath