This week's book giveaway is in the Artificial Intelligence and Machine Learning forum.
We're giving away four copies of Machine Learning with R: Expert techniques for predictive modeling and have Brett Lantz on-line!
See this thread for details.
Win a copy of Machine Learning with R: Expert techniques for predictive modeling this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

element with ANY content

 
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

 
Ranch Hand
Posts: 578
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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,
 
Too many men are afraid of being fools - Henry Ford. Foolish tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!