ashimehta
October 22nd, 2003, 07:49 AM
Hi All,
I have to create a DTD having non alpha-numeric characters like '&', '%', '>', etc. in an enumerated attribute. For this i used ENTITIES as <!ENTITY % Pct "%"> for '%' and so on.
The XML that i have created is as follows -
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE CUSTOMER [
<!ELEMENT CUSTOMER (ELEM*)>
<!ELEMENT ELEM (#PCDATA)>
<!ENTITY % Pct "%">
<!ENTITY % gt ">">
<!ENTITY % Mix "5%Pct;10%gt;3">
<!ATTLIST ELEM
attrib (%Mix; | SampleText) #IMPLIED
>
]>
<CUSTOMER>
<ELEM attrib="SampleText"></ELEM>
<ELEM attrib="5%10>3"></ELEM>
</CUSTOMER>
---------------------------
This XML gets validated. But if i try to open it in the browser, i get an error which reads -
The XML page cannot be displayed
Parameter entities cannot be used inside markup declarations in an internal subset. Error processing resource 'file:///...Test.xml'. Line 8, Position 18
<!ENTITY % Mix "5%Pct;10%gt;3">
-----------------^
Plz. tell me what is the solution to this.
Thanks in Advance.
Ashish.
I have to create a DTD having non alpha-numeric characters like '&', '%', '>', etc. in an enumerated attribute. For this i used ENTITIES as <!ENTITY % Pct "%"> for '%' and so on.
The XML that i have created is as follows -
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE CUSTOMER [
<!ELEMENT CUSTOMER (ELEM*)>
<!ELEMENT ELEM (#PCDATA)>
<!ENTITY % Pct "%">
<!ENTITY % gt ">">
<!ENTITY % Mix "5%Pct;10%gt;3">
<!ATTLIST ELEM
attrib (%Mix; | SampleText) #IMPLIED
>
]>
<CUSTOMER>
<ELEM attrib="SampleText"></ELEM>
<ELEM attrib="5%10>3"></ELEM>
</CUSTOMER>
---------------------------
This XML gets validated. But if i try to open it in the browser, i get an error which reads -
The XML page cannot be displayed
Parameter entities cannot be used inside markup declarations in an internal subset. Error processing resource 'file:///...Test.xml'. Line 8, Position 18
<!ENTITY % Mix "5%Pct;10%gt;3">
-----------------^
Plz. tell me what is the solution to this.
Thanks in Advance.
Ashish.