xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <h...@visi.com>
Subject how do I detect internal subset when part of external subset?
Date Tue, 04 Apr 2006 03:49:34 GMT

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.VxsVoxMLApplicationServlet"/>
	</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: general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org


Mime
View raw message