[jdom-interest] Merging text nodes
Jason Hunter
jhunter at acm.org
Mon Feb 18 19:54:33 PST 2002
"Bradley S. Huffman" wrote:
>
> > > It is unnecessary clutter. Worse yet, it presents an incorrect
> > > picture of the structure and semantics of an XML document. Text nodes
> > > are strings (in JDOM). Entity references are entity references. We
> > > shouldn't mix them up.
> >
> > I agree. I did make a case for mixing Text and EntityRef when trying to
> > figure out a way for attribute values to have entity refs in them. Since
> > we're not going to support that feature, I think we should avoid trying to
> > do to much in this direction.
>
> So we shouldn't allow the following sequence of code?
>
> Element e = new Element("title");
> e.addContent( new Text("Cats "));
> e.addContent( new EntityRef("connect"));
> e.addContent( new Text(" Dogs"));
>
> Which produces the same structure for the element's content as running
>
> <?xml version="1.0"?>
> <!DOCTYPE greeting [
> <!ENTITY connect "and">
> ]>
> <title>Cats &connect; Dogs</title>
>
> thru SAXBuilder with setExpandEntities(false).
More information about the jdom-interest
mailing list