I think I answered my own question. I am no longer using doctypeDecl for subset detection. I am now doing the following. It seems to work. Can anyone tell me if this is the best way to do this?...

public void startDTD(XMLLocator arg0, Augmentations arg1) throws XNIException { fProcessingState = PROCESSING_INTERNAL_SUBSET; //initially, assume internal subset until startExternalSubset() says otherwise fInternalSubset = new StringBuffer(); //TODO - is it possible to avoid the stringbuffer in the case of no internal subset?
    }

public void startExternalSubset(XMLResourceIdentifier identifier, Augmentations augs) throws XNIException {
        fProcessingState = PROCESSING_EXTERNAL_SUBSET;
    }

    public void endDTD(Augmentations augs) throws XNIException {
        if (fInternalSubset.length() > 0) {
            fDocBuilder.setInternalSubset(fInternalSubset.toString());
        }
        fProcessingState = PROCESSING_DOCUMENT;
    }


Jake

At 10:49 PM 4/3/2006, you wrote:
>
>If I have a document that looks like this...
>
><?xml version="1.0" encoding="UTF-8"?>
><!DOCTYPE DIALOG SYSTEM "VoxML.dtd" [
>       <!ENTITY ServletURL 'http://127.0.0.1:8080'>
>]>
><DIALOG BARGEIN="N">
>       <STEP NAME="init" PARENT="init">
>               <PROMPT>Greeting for &ServletURL;</PROMPT>
> <INPUT TYPE="HIDDEN" NAME="Action" VALUE="launchEmailApplication"/>
>               <INPUT TYPE="NONE"
>NEXT="&ServletURL;/servlet/VoxSurf.Architecture.VoxML.VxsVoxMLApplicat
>ionServlet"/>
>       </STEP>
></DIALOG>
>
>
>How do I tell the internal subset apart from the external
>subset?  Normally I'd do...
>
>public void doctypeDecl(String rootElement, String publicId, String
>systemId, Augmentations augs) throws XNIException {
>         if (publicId == null && systemId == null) {
>             fProcessingState = PROCESSING_INTERNAL_SUBSET;
>             fInternalSubset = new StringBuffer();
>         } else {
>             fProcessingState = PROCESSING_EXTERNAL_SUBSET;
>         }
>}
>
>However, in this case, the System Id is not null, so I default to the
>extenal subset processing state.  In the other DTD event methods, I
>check which state I'm in and only append to the internal subset
>buffer when I'm in the internal subset processing state.  If I build
>a document from this, the output excludes the <!ENTITY> declaration
>inside what is, really, the internal subset.  Thus, parsing of the
>resulting document fails because the document references
>"&ServletURL;", but the <!ENTITY> declaration does not exist.
>
>So, is there some unique condition I can look for while using the XNI
>parser to determine if I am parsing the internal subset when the
>external and internal subsets are combined?
>
>
>Jake
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to