You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Vadim Solonovich <vs...@park.ru> on 2001/05/04 11:56:29 UTC

How to make external entity work with schema ?

Hi All !

Could anybody tell me what should I do to make this work ?

Thanks in advance,
 Vadim Solonovich, www.park.ru

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

[Fatal Error] test.xml:5:5: The entity "X" was referenced, but not declared.

org.xml.sax.SAXException: Stopping after fatal error: The entity "X" was referen
ced, but not declared.
        at org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1145)
        at org.apache.xerces.readers.DefaultEntityHandler.startReadingFromEntity(DefaultEntityHandler.java:596)
        at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1320)
        at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
        at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:998)
        at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1039)
        at sax.SAXCount.print(SAXCount.java:155)
        at sax.SAXCount.main(SAXCount.java:382)


test.xsd

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE schema [
<!ENTITY X SYSTEM 'test.ent'>
]>

<xsd:schema xmlns:xsd='http://www.w3.org/2000/10/XMLSchema'>
 <xsd:element name='A'>
  <xsd:complexType>
   <xsd:sequence>
    <xsd:element name='B' type='xsd:string' 
  minOccurs='1' maxOccurs='unbounded'/>
   </xsd:sequence>
  </xsd:complexType>
 </xsd:element>
</xsd:schema>

test.xml

<?xml version="1.0" encoding="UTF-8"?>
<A xmlns:xsi='http://www.w3.org/2000/10/XMLSchema-instance'
      xsi:noNamespaceSchemaLocation='test.xsd'> 
   
 &X;
 
</A>

test.ent

<?xml version="1.0" encoding="UTF-8"?>
<B></B>
<B></B>
<B></B>