[jdom-interest] [Newbie] - Problem using Entity

philip.nelson at omniresources.com philip.nelson at omniresources.com
Wed May 9 07:48:54 PDT 2001

> Well, what I sent you, is a description of what happens when 
> printing Entities
> within Elements. The "&Name;" and "&Comment;&Title;&Bitrate;&Year;" is
> actually entities with names Name, Comment, Title, Bitrate 
> and Year. The name
> of the entity is printed this way (&EntityName;), but the 
> content withing this
> entity is not visible anywhere in the XMLdoc. Just with a few 
> lines of code,
> how would you instantiate an Element and add a String content 
> to it, for
> finally to be outputted to File? Perhaps I use some wrong 
> methods? An example
> had been highly appreciated!

This is one of the broken parts of the current entity implementation.  The
new version which it looks like was checked in last night, drastically
simplifies the entity api.  You now would create an EntityRef where you had
created an Entity.  Then you use a dtd to define the entity.  That part is
up to you.  I hope to get to the DocType class soon where you would have
access to the internal subset as a large string but for now, it makes sense
to actually define your entities externally.

> Just for the record: Is it a total waste to buy the book 
> "Java and XML" (ISBN:
> 0596000162, by Brett McLaughlin and Mike Loukides) when 
> looking for help to
> resolve this problem? 

There is a new edition being worked on now.  In addition, the book covers
much more than JDOM and is quite worth it for the other information.  The
new book will be updated and better, IMHO.

More information about the jdom-interest mailing list