[xml] XML : PE reference outside DTD



Hi ,

According to standard, PE reference must not occur outside DTD.

Well-formedness constraint: In DTD

Parameter-entity references MUST NOT appear outside the DTD.

 

So,

If my xml document is as follows:

 

<?xml version="1.0"?>

<!DOCTYPE root [

     <!ELEMENT root (a, b)>

     <!ELEMENT a EMPTY>

     <!ELEMENT b (#PCDATA | c)*>

     <!ELEMENT c ANY>

     <!ENTITY inContent "<b>General entity reference in element content</b>">

     <!ENTITY % paaa "wrong">

]>

<!--* content: element|CharData|Reference|CDSect|PI|CDSect|PI|Comment *-->

<root>

     <a/>

     <b>

          <!-- there is an empty element in the above line -->

          <c/>

   CharData: content of b element

   %paaa; : PE reference should not be recognized in element content

   <c>

               <?PIcontent anyProcessingInstruction?>

               <!-- Comment content -->

    &inContent;

    Charater reference: &#x41;

    CDSect in content: <![CDATA[ <html>markups<head>HEAD</head><body>nothing</body></html> ]]></c>

     </b>

</root>

<!--* test P43 *-->

--------------------------------------------------------

And here I have used PE reference paaa outside DTD , shouldn’t it be a fatal error.

Please clarify.

 

Regards,

Murali

 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]