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 Arun Yadav <Ar...@Sun.COM> on 2001/10/04 06:17:56 UTC
Re: External parameter entity reference causing null pointer exceptio n
Hi
Parameter entities are declared in DTD and can only be used within the DTD. They
are used to declare content that you want to reuse as part on element or
attribute defination within the DTD. So, In your xml file you can use
paremeter entity 'userStrings' in this way...
<?xml version="1.0"?>
<!DOCTYPE waConfiguration SYSTEM 'D:\temp\wa.dtd' [
<!ENTITY % userStrings SYSTEM 'D:\temp\aspectContributor.ent'>
<!ENTITY waLocale '%userStrings;'>
<!ENTITY waBaseUrl '/'>
]>
.........
.........
Cheers
Arun Yadav
Sun Microsystem,inc.
> Mailing-List: contact xerces-j-user-help@xml.apache.org; run by ezmlm
> list-help: <ma...@xml.apache.org>
> list-unsubscribe: <ma...@xml.apache.org>
> list-post: <ma...@xml.apache.org>
> Delivered-To: mailing list xerces-j-user@xml.apache.org
> From: "Sivasubramaniam, Latha" <la...@aspect.com>
> To: "'xerces-j-user@xml.apache.org'" <xe...@xml.apache.org>
> Subject: External parameter entity reference causing null pointer exceptio n
> Date: Wed, 3 Oct 2001 17:21:52 -0700
> X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N
>
>
> I am trying to use external parameter entity reference in my XML and
> that causes null pointer exception in the DOM parser. I actually don't want
> the parser to expand the entity references but according to xerces 1.4.3 api
> document says that i can not turn off this feature. Is it that xerces does
> not support this feature, does any one know that the next version supports
> it or not.
>
> My xml and the external entity file as follows. In the xml if i remove the
> lines,
>
> *****************************lines removed *********************
> <!ENTITY % userStrings SYSTEM 'D:\temp\aspectContributor.ent'>
> %userStrings;
> **********************************lines removed *********************
> and replace &asptitle; with some regualr text, the parser succeeds.
>
>
> ************************************** XML file
> start*************************************
> <?xml version="1.0"?>
> <!DOCTYPE waConfiguration SYSTEM 'D:\temp\wa.dtd' [
> <!ENTITY % userStrings SYSTEM 'D:\temp\aspectContributor.ent'>
> %userStrings;
> <!ENTITY waLocale 'en'>
>
> <!ENTITY waBaseUrl '/'>
> ]>
> <waConfiguration waVersion="1.2">
> <waHeader>
> <waApp>
> <waAppName>XML Contributor Config
> Application</waAppName>
> <waAppVersion>1.0</waAppVersion>
> </waApp>
>
> </waHeader>
> <waBody waShowLastRefreshTime="true">
> <waHTML_Prologue dir="ltr">
> <H2 dir="ltr">&asptitle;</H2>
> <HR/>
> </waHTML_Prologue>
> <waCategories>
> <waCategory waUserLabel="colltypedetLabel"
> waId="Collector_Type">
> <waString waUserLabel="colltypeLabel"
> waId="Collector" waUserMsg="colltypeMsg" waReadOnly="false"
> waRequired="true" waMaxLength="40">siri</waString>
> <waTextArea waUserLabel="colldescLabel"
> waId="Collector_Desc" waUserMsg="colldescMsg" waReadOnly="false"
> waRequired="false" waNumRows="2">Collector for AAR Database </waTextArea>
> </waCategory>
>
> </waCategories>
> </waBody>
> </waConfiguration>
>
> ****************** XML file end **********************
>
> ********************** aspectcontributor.ent file
> start*********************
> <!ENTITY asptitle 'Aspect XML Real-Time Contributor'>
> **********************aspectcontributor.ent file end
>
> *****Stack trace of the exception********
> java.lang.NullPointerException
> java.lang.Throwable()
> java.lang.Exception()
> org.xml.sax.SAXException(java.lang.Exception)
> void
> org.apache.xerces.framework.XMLParser.parse(org.xml.sax.InputSource)
> void
> com.aspect.xmlcontributor.CContributor.configLoad(java.lang.String)
> void com.aspect.xmlcontributor.CContributor.init()
> void com.aspect.xmlcontributor.CContributor.main(java.lang.String
> [])
>
>
> Does any one have any idea about this.
>
>
> Regards
> Latha
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
Re: External parameter entity reference causing null pointer exceptio n
Posted by Andy Clark <an...@apache.org>.
Arun Yadav wrote:
> <?xml version="1.0"?>
> <!DOCTYPE waConfiguration SYSTEM 'D:\temp\wa.dtd' [
> <!ENTITY % userStrings SYSTEM 'D:\temp\aspectContributor.ent'>
> <!ENTITY waLocale '%userStrings;'>
> <!ENTITY waBaseUrl '/'>
> ]>
This will fail because parameter entities cannot be referenced
within markup declarations in the internal subset. They can
only be referenced between markup declarations within the
internal subset. This construct is allowed in the external
subset, however.
--
Andy Clark * IBM, TRL - Japan * andyc@apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org