You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Gr...@emc.com on 2007/12/11 10:29:14 UTC

parsing with internal DTD subset

Hi,

I'm having some problems with internal DTD subsets in XML files.
Consider this piece of XML:

<?xml version="1.0" encoding="UTF-16"?>
<!DOCTYPE dmodule
[<!ENTITY ICN-S1000DBIKE-AAA-D000000-0-U8025-00536-B-04-1 SYSTEM
'ICN-S1000DBIKE-AAA-D000000-0-U8025-00536-B-04-1.CGM' NDATA cgm>
<!NOTATION cgm SYSTEM 'image/cgm'> ]> <dmodule
xmlns:dc="http://www.purl.org/dc/elements/1.1/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ipd.xsd">
	<content>
		<ipc>
			<figure id="fig-0001">
				<title>Bicycle</title>
				<graphic
boardno="ICN-S1000DBIKE-AAA-D000000-0-U8025-00536-B-04-1"
xlink:href="URN:S1000D:ICN-S1000DBIKE-AAA-D000000-0-U8025-00536-B-04-1"
xlink:title="Bicycle" xlink:type="simple"/>
			</figure>
            ......
		</ipc>
	</content>
</dmodule>


If I parse this using a Document parameter:
DmoduleDocument.Factory.parse(Document document)

I get this exception:


java.lang.IllegalStateException: java.lang.RuntimeException: Unexpected
node
	at
org.apache.xmlbeans.impl.store.Locale.loadNode(Locale.java:1465)
	at
org.apache.xmlbeans.impl.store.Locale.loadNodeChildren(Locale.java:1396)
	at
org.apache.xmlbeans.impl.store.Locale.loadNode(Locale.java:1407)
	at
org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1378)
	at
org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1363)
	at
org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoa
derBase.java:370)
......


If I parse it using a String:
DmoduleDocument.Factory.parse(String content)

Then I don't get an exception but, as far as I can tell, the internal
subset is gone afterwards: 
((Document)dmoduleDoc.getDomNode()).getDocType() == null

Is there any way to retain the internal subset? 

Thanks,
Ewout

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org