• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

element with ANY content

 
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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,
 
reply
    Bookmark Topic Watch Topic
  • New Topic