Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JDOM User »

[jdom-interest] adding EntityRef to Document throws Exception

Quinten Verheyen

2004-09-09

Replies:

Hi,
 
I wonder how one adds an entity to a document type, I want something like this :
 
<!DOCTYPE blabla SYSTEM "first.DTD" [<!ENTITY % extension SYSTEM "second.dtd"> %extension; ]>
 
I didn't find any method in DocType who could do the job, so I assumed Document.addContent(Content content) (the class EntityRef extends Content) would be the thing to use :
 
Document doc = new Document(documentRoot);
DocType docType = new DocType( elementName, systemID );
doc.setDocType(docType);
EntityRef entityRef = new EntityRef( elementName, systemID );
doc.addContent(entityRef ); // throws exception
 
but it didn't work, I got : "An EntityRef is not allowed at the document root".
 
So .. how do I accomplish this ? (I hope this isn't a stupid question)

Verheyen Quinten

Software Engineer
Rue Gabrielle Petitstraat 4/6
1080 Brussel
Tel : +0032 (0)2 502 85 00
Fax : +0032 (0)2 502 76 07
Gsm : +0032 (0)494 81 04 81

E-mail : q.verheyen@ringring.be

"The process of intelligent conduct is essentially a process of selection from among various alternatives; intelligence is largely a matter of selectivity. Delayed reaction is necessary to intelligent contact." - Mead G.H.
 
_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@(protected)
©2008 junlu.com - Jax Systems, LLC, U.S.A.