I found it :) its not possible :) we can't use #required keyword with enumerated value lists in XML like
<!ATTLIST item type CDATA (offer|request) "offer" #REQUIRED>
I checked it with validator and it gives error with #REQUIRED ..
Вопрос
Can i use #Required keyword in XML with enumerated value list?
like ,
<!ATTLIST item type CDATA (offer|request) "offer" #REQUIRED>
Thanks..
Решение 3
I found it :) its not possible :) we can't use #required keyword with enumerated value lists in XML like
<!ATTLIST item type CDATA (offer|request) "offer" #REQUIRED>
I checked it with validator and it gives error with #REQUIRED ..
Другие советы
it's fine to have such combination like:
<!ATTLIST item type (offer|request) #REQUIRED>
But I'm not sure about CDATA definition in case of choice and also combination of default value and required is not ok. Try http://www.validome.org/grammar/validate/
Regards
JK.
No.
According to the XML Specification Attribute List Declarations you can declare atributes as
<!ATTLIST' element-name attribute-definitions* >
where attribute-definitions
has the format
attribute-name attribute-type default-declaration
The attribute-type can be one of
CDATA
ID
IDREF
IDREFS
ENTITY
ENTITIES
NMTOKEN
NMTOKENS
or |
.( token1 | token2 | token3 )
. There are no other options.
Additionally, default-declaration
allows one of the values:
#REQUIRED
#IMPLIED
#FIXED "fixed value"
"default value"
There are also no other options. So if you have CDATA
, you can't have (offer|request)
, and if you have #REQUIRED
you can't have #REQUIRED "offer"
or "offer" #REQUIRED
as you wrote. Some valid options, depending on what you want, are:
<!ATTLIST item type (offer|request) "request">
<!ATTLIST item type (offer|request) #REQUIRED>
<!ATTLIST item type CDATA "offer">
<!ATTLIST item type CDATA #REQUIRED>