This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Product and Other Certifications and the fly likes element with ANY content Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Certification » Product and Other Certifications
Bookmark "element with ANY content" Watch "element with ANY content" New topic
Author

element with ANY content

Serge Adzinets
Ranch Hand

Joined: Nov 26, 2002
Posts: 166
Got a question in a mock exam, if this document is valid. The answer was no, because though an element was declared with ANY content, it could contain only declared elements. I guess this is wrong. Any thoughts?



Best Regards,<br />Serge
Hari Vignesh Padmanaban
Ranch Hand

Joined: Oct 07, 2003
Posts: 578
Originally posted by Siarhei Adzinets:
Got a question in a mock exam, if this document is valid. The answer was no, because though an element was declared with ANY content, it could contain only declared elements. I guess this is wrong. Any thoughts?


No. It is correct !!
Here is the quote from the DTD specs


Well-formedness constraint: Element Type Match

The Name in an element's end-tag MUST match the element type in the start-tag.

An element is valid if there is a declaration matching elementdecl where the Name matches the element type, and one of the following holds:

The declaration matches ANY, and the content (after replacing any entity references with their replacement text) consists of character data and child elements whose types have been declared.





To see more see this link
http://www.w3.org/TR/REC-xml/

and search for "Validity constraint: Element Valid" using "find box" in Edit menu in IE

Hope this helps
Serge Adzinets
Ranch Hand

Joined: Nov 26, 2002
Posts: 166
Hi Hari,

Tried to parse the file with Xerces and got an error
I was in doubt because "XML Professional" doesn't mention this important detail.

Tnanks,
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: element with ANY content