You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Lars Martin <la...@smb-tec.com> on 2000/12/06 12:49:39 UTC
Unparsed Entities?
Given the following simple document I get the attached SAXException
when I try to parse this document. What does this exception mean or
what do I have to do get it working? I use Xerces release 1.2.2 and
yes, the logo is present in the current directory ... ;-)
[----------------------------DOCUMENT--------------------------------]
<?xml version="1.0"?>
<!DOCTYPE doc [
<!ELEMENT doc (logo)>
<!ELEMENT logo (#PCDATA)>
<!ENTITY CompanyLogo SYSTEM "logo.gif" NDATA gif>
<!NOTATION gif SYSTEM "viewgif.exe">
]>
<doc>
<logo>&CompanyLogo;</logo>
</doc>
[-------------------------EXCEPTION----------------------------------]
Exception in thread "main" org.xml.sax.SAXParseException: The unparsed entity reference "&CompanyLogo;" is not permitted.
at org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1016)
at org.apache.xerces.readers.DefaultEntityHandler.startReadingFromEntity(DefaultEntityHandler.java:607)
at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1315)
at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:380)
at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:908)
at org.xml.sax.helpers.ParserAdapter.parse(ParserAdapter.java:430)
at org.xml.sax.helpers.ParserAdapter.parse(ParserAdapter.java:406)
at Client.saxStore(Client.java:247)
at Client.main(Client.java:149)
--
______________________________________________________________________
Lars Martin mailto:lars@smb-tec.com
SMB GmbH http://www.smb-tec.com
Re: Unparsed Entities?
Posted by Arnaud Le Hors <le...@us.ibm.com>.
[All the mail I've sent out since yesterday sometime seem to have been
lost somewhere, this is a resent, I apology if you already received it]
Lars Martin wrote:
>
> According to the quoted XML spec it is not
> possible to use entities as a child of an element node... Strange,
> because this samples is taken from B. McLaughlins book 'Java and XML'.
>
Specs rule...
--
Arnaud Le Hors - IBM Cupertino, XML Technology Group
Re: Unparsed Entities?
Posted by Lars Martin <la...@smb-tec.com>.
On Wed, 06 Dec 2000 09:51:35 -0500
Elena Litani <hl...@jtcsv.com> wrote:
> Hi, Lars,
>
> I am "new" to XML specs but I will give it a try.
>
> According to (4.2.2) of XML Specs if NDATA "is present, this is a
> general unparsed entity..".
> Thus, CompanyLogo is unparsed entity.
>
> According to XML Specs we access unparsed entities by name, given in the
> value of ENTITY or ENTITIES attributes.
> See (4.2): "The Name identifies the entity in an entity reference or, in
> the case of an unparsed entity, in the value of an ENTITY or ENTITIES
> attribute"
Many thanks, that worked. According to the quoted XML spec it is not
possible to use entities as a child of an element node... Strange,
because this samples is taken from B. McLaughlins book 'Java and XML'.
> I believe a solution should be the following:
> -- declare attribute
> <!ATTLIST logo myGif ENTITY #REQUIRED>
> --in your XML doc:
> <logo myGif="CompanyLogo"></logo>
>
> Hope it helps,
> Elena
>
> Lars Martin wrote:
> >
> > Given the following simple document I get the attached SAXException
> > when I try to parse this document. What does this exception mean or
> > what do I have to do get it working? I use Xerces release 1.2.2 and
> > yes, the logo is present in the current directory ... ;-)
> >
> > [----------------------------DOCUMENT--------------------------------]
> >
> > <?xml version="1.0"?>
> > <!DOCTYPE doc [
> > <!ELEMENT doc (logo)>
> > <!ELEMENT logo (#PCDATA)>
> > <!ENTITY CompanyLogo SYSTEM "logo.gif" NDATA gif>
> > <!NOTATION gif SYSTEM "viewgif.exe">
> > ]>
> >
> > <doc>
> > <logo>&CompanyLogo;</logo>
> > </doc>
> >
> > [-------------------------EXCEPTION----------------------------------]
> >
> > Exception in thread "main" org.xml.sax.SAXParseException: The unparsed entity reference "&CompanyLogo;" is not permitted.
> > at org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1016)
> > at org.apache.xerces.readers.DefaultEntityHandler.startReadingFromEntity(DefaultEntityHandler.java:607)
> > at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1315)
> > at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:380)
> > at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:908)
> > at org.xml.sax.helpers.ParserAdapter.parse(ParserAdapter.java:430)
> > at org.xml.sax.helpers.ParserAdapter.parse(ParserAdapter.java:406)
> > at Client.saxStore(Client.java:247)
> > at Client.main(Client.java:149)
> >
> > --
> > ______________________________________________________________________
> > Lars Martin mailto:lars@smb-tec.com
> > SMB GmbH http://www.smb-tec.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xerces-j-dev-help@xml.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-dev-help@xml.apache.org
--
______________________________________________________________________
Lars Martin mailto:lars@smb-tec.com
SMB GmbH http://www.smb-tec.com
Re: Unparsed Entities?
Posted by Elena Litani <hl...@jtcsv.com>.
Hi, Lars,
I am "new" to XML specs but I will give it a try.
According to (4.2.2) of XML Specs if NDATA "is present, this is a
general unparsed entity..".
Thus, CompanyLogo is unparsed entity.
According to XML Specs we access unparsed entities by name, given in the
value of ENTITY or ENTITIES attributes.
See (4.2): "The Name identifies the entity in an entity reference or, in
the case of an unparsed entity, in the value of an ENTITY or ENTITIES
attribute"
I believe a solution should be the following:
-- declare attribute
<!ATTLIST logo myGif ENTITY #REQUIRED>
--in your XML doc:
<logo myGif="CompanyLogo"></logo>
Hope it helps,
Elena
Lars Martin wrote:
>
> Given the following simple document I get the attached SAXException
> when I try to parse this document. What does this exception mean or
> what do I have to do get it working? I use Xerces release 1.2.2 and
> yes, the logo is present in the current directory ... ;-)
>
> [----------------------------DOCUMENT--------------------------------]
>
> <?xml version="1.0"?>
> <!DOCTYPE doc [
> <!ELEMENT doc (logo)>
> <!ELEMENT logo (#PCDATA)>
> <!ENTITY CompanyLogo SYSTEM "logo.gif" NDATA gif>
> <!NOTATION gif SYSTEM "viewgif.exe">
> ]>
>
> <doc>
> <logo>&CompanyLogo;</logo>
> </doc>
>
> [-------------------------EXCEPTION----------------------------------]
>
> Exception in thread "main" org.xml.sax.SAXParseException: The unparsed entity reference "&CompanyLogo;" is not permitted.
> at org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1016)
> at org.apache.xerces.readers.DefaultEntityHandler.startReadingFromEntity(DefaultEntityHandler.java:607)
> at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1315)
> at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:380)
> at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:908)
> at org.xml.sax.helpers.ParserAdapter.parse(ParserAdapter.java:430)
> at org.xml.sax.helpers.ParserAdapter.parse(ParserAdapter.java:406)
> at Client.saxStore(Client.java:247)
> at Client.main(Client.java:149)
>
> --
> ______________________________________________________________________
> Lars Martin mailto:lars@smb-tec.com
> SMB GmbH http://www.smb-tec.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-dev-help@xml.apache.org