XML DTD - Defining attributes as numbers and requiring #PCDATA
I realize Schema is the way to go, but this is an assignment. If I wanted to require an attribute on some element to be a float/number, is that possible? The only thing I know to do is to define it as CDATA - is there some predefined ENTITY ? I don't think I should pull in any other DTD, so if it's that complex, it's incorrect for the purposes of this assignment. Right now I do it like so:
<!ATTLIST elemName attrName CDATA>
Is this just a limitation of DTD?
Additionally, is there a way to require #PCDATA on an element? I'm using Altova XML Spy and it is allowing elements with:
<elem foo="bar"/>
for开发者_运维技巧 something defined like:
<!ELEMENT elem (#PCDATA)>
<!ATTLIST elem foo CDATA #REQUIRED>
past the validation. Thanks.
there doesn't appear to be a way to specify only numbers and the empty string is valid for #PCDATA
.
精彩评论