简体   繁体   English

外部dtd(xml)中的外部实体引用

[英]External entity reference in external dtd (xml)

i have little bit of problem while working with External entity reference in External DTD 我在外部DTD中使用外部实体引用时遇到一些问题

for Example 例如

[name.xml] [name.xml的]

<?xml version="1.0" ?>
<!DOCTYPE simple SYSTEM "simple.dtd">
<simple>
       <name> &a;   </name>
       <age>  21   </age>
       <address> bsk street </address>  
</simple>

[name.dtd] [name.dtd]

<?xml version="1.0" ?>
<!ELEMENT simple (name,age,address)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT age (#PCDATA)>
<!ELEMENT address (#PCDATA)>
<!ELEMENT a "abhijeet">

when i run this program on the Internet Explorer i am getting error... 当我在Internet Explorer上运行此程序时,我收到错误...

That's because you're using an ELEMENT declaration to declare an entity. 那是因为您使用ELEMENT声明来声明实体。

This is what your ENTITY declaration should look like: 这是您的ENTITY声明应如下所示:

<!ENTITY a "abhijeet">

Also, you have [name.dtd] in your example, but your system identifier shows simple.dtd . 此外,您的示例中有[name.dtd] ,但系统标识符显示simple.dtd Be sure your system identifier is pointing to the correct DTD. 确保您的系统标识符指向正确的DTD。

Example of internal subset: 内部子集的示例:

<?xml version="1.0"?>
<!DOCTYPE simple SYSTEM "simple.dtd" [
<!ENTITY a "abhijeet">
]>
<simple>
  <name> &a;   </name>
  <age>  21   </age>
  <address> bsk street </address>
</simple>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM