Yes I'd contemplated everything you mention. What I tried was parsing XML
with ENTITY elements specified and then using the API to add elements to the
document created during parsing.

StringBufferInputStream sbis = new StringBufferInputStream("<?xml
version=\"1.0\"?> <!DOCTYPE temp [ <!ENTITY nbsp \"&#160;\" > ]>
<temp></temp>");

    try {
      doc = docBuilderFactoryImpl.newDocumentBuilder().parse(sbis);
    }
    catch (Exception ex) {
 ex.printStackTrace();
    }

I created entity reference elements/nodes where appropriate when
constructing the rest of the document with the API.

Ted X. Toth
Elegiant, Inc.
8705 Shoal Creek Blvd., Suite 202
Austin, TX 78757
Phone: 512.206.0660
Fax: 512.206.0003


----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Thursday, June 28, 2001 11:21 AM
Subject: Re: Entity and Entity Reference


>
> Remember that the DOM's view of the text is _after_ character references
> have been expanded -- if you put & in a DOM Text node, that's the same
> thing as &amp; in the XML file. To write an Entity Reference, you must use
> an Entity Reference Node that refers to an existing Entity definition --
> and note that as of DOM Level 2 there is no portable way to
> programmatically create Entity definitions. (DOM Level 3 is expected to
> close that gap, as part of the Abstract Schema work.)
>
>

Reply via email to