Problem with NKFEntityResolver - system/public ids mixed up?

Poster Content
nk4um Moderator
Posts: 901
August 9, 2006 10:19Thanks
Thanks Nigel,

Sometimes the subtleties of XML get too much for me!  We''ll fix this and post an update.
Like · Post Reply
nk4um User
Posts: 9
August 9, 2006 08:30Sorry
Jumped straight into the forums and didn''t notice/remember bugxter.
Like · Post Reply
nk4um User
Posts: 9
August 8, 2006 16:55Problem with NKFEntityResolver - system/public ids mixed up?
Hello,

I''m trying to use an EntityResolver (in a transreptor) and kept getting an
IllegalArgumentException when using the a ''SYSTEM'' doctype in an XML file being parsed, for example:

<!DOCTYPE comparatorPipeline SYSTEM "dxp.dtd">


The stacktrace included the following fragment:

Caused by: java.lang.IllegalArgumentException: aURI is null in setURI()
   at org.ten60.netkernel.layer1.nkf.impl.NKFRequestImpl.setURI(NKFRequestImpl.java:212)
   at org.ten60.netkernel.layer1.nkf.impl.NKFHelperImpl.sourceAspect(NKFHelperImpl.java:360)
   at org.ten60.netkernel.xml.util.NKFEntityResolver.resolveEntity(NKFEntityResolver.java:63)


Which lead me to the NKFEntityResolver source code:

public InputSource resolveEntity(String aPublicId, String systemId)
  throws SAXException, IOException {
try {
  IAspectReadableBinaryStream aspect= 
       (IAspectReadableBinaryStream)
       mContext.sourceAspect(aPublicId,
                             IAspectReadableBinaryStream.class);


I suspect the 1st argument of sourceAspect() needs to be a URI and hence
should use the systemId, and not the publicId at this point?

The following work-around using a faked publicId:

<!DOCTYPE comparatorPipeline PUBLIC "dxp.dtd" "dxp.dtd">


provides a temporary solution and confirms the problem/fix.

Cheers,

Nigel

Like · Post Reply