Hi Benson, We're talking about two different implementations of the DOM Level 3 LSSerializer, the more recently developed one in Xalan (serializer.jar which Xerces now ships and shares with Xalan) and the much older deprecated one in Xerces. If you're curious about the history on that, there's an FAQ [1] on the website.
Some users have decided to keep using Xerces' deprecated serializer due to some quirks and issues with the currently available one from Xalan. Folks really should be opening JIRA issues [2] against Xalan, so those problems get addressed there. There's no intention to do any further development or fixes to the one in Xerces. Thanks. [1] http://xerces.apache.org/xerces2-j/faq-general.html#faq-6 [2] https://issues.apache.org/jira/browse/XALANJ Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: mrgla...@ca.ibm.com E-mail: mrgla...@apache.org Benson Margulies <bimargul...@gmail.com> wrote on 11/21/2009 02:17:49 PM: > Could I please ask for a bit of clarification? The only LSSerializer > I'm aware of is the DOM level 3 stuff, which, I thought, was the > opposite of obsolete. As someone pointed out here, unlike TraX, it > will serialize doctypes and do other handy things. In general, I'm > beginning to prefer the DOMImplementationLS to JAXP and TraX. > On Sat, Nov 21, 2009 at 2:07 PM, Michael Glavassevich <mrgla...@ca.ibm.com > > wrote: > You should also be able to control whether spaces are preserved by > registering an LSSerializerFilter. > > When I added one to your test program: > > if (useXerces) > { > domWriter = new DOMSerializerImpl(); > domWriter.setFilter(new LSSerializerFilter() { > public int getWhatToShow() { > return LSSerializerFilter.SHOW_ALL; > } > public short acceptNode(Node n) { > return LSSerializerFilter.FILTER_ACCEPT; > }}); > } > > the output I get is: > > > Program started > Xerces serializer will be used > <?xml version="1.0" encoding="UTF-16"?> > <root> > <child1>text</child1> > <child2> </child2> > > </root> > > Xalan serializer will be used > <?xml version="1.0" encoding="UTF-16"?><root> > <child1>text</child1> > <child2> </child2> > </root> > which I believe is what you were expecting. > > Thanks. > > Michael Glavassevich > XML Parser Development > IBM Toronto Lab > E-mail: mrgla...@ca.ibm.com > E-mail: mrgla...@apache.org > > Dick Deneer <dick.den...@donkeydevelopment.com> wrote on 11/21/2009 > 01:19:27 PM: > > > > Hi Jake, > > > > > > I just tried your suggestion and the spaces are indeed preserved. > > But still, I woud prefer another solution. I do not have any clue > > about the xml (I use xerces in a xml editor) and I do not want to > > change the xml. > > And also I would like to stay with the LSSerializer (it also > > serilalizes doctype nodes). > > If there is another way please let me know. > > > > Thanks > > Dick Deneer > > > > > > > > Op 21-nov-2009, om 19:03 heeft Jacob Kjome het volgende geschreven: > > > > > Have you tried xml:space="preserve"? > > > > > > Jake > > > > > > On 11/20/2009 4:36 PM, Dick Deneer wrote: > > >> I am still using the deprecated LSSerializer because the xalan > > >> serializer has issues with the pretty print. > > >> But when I have simple elements with only space, the serializer > > >> produces > > >> empty elements. Is there a tweak to keep the spaces in this elements? > > >> > > >> Sample xml: > > >> <root><child1>text</child1><child2> </child2></root> > > >> I attached a simple test program, that you can just run to see the > > >> results: > > >> > > >> Program started > > >> Xerces serializer will be used > > >> <?xml version="1.0" encoding="UTF-16"?> > > >> <root> > > >> <child1>text</child1> > > >> <child2/> > > >> </root> > > >> > > >> Xalan serializer will be used > > >> <?xml version="1.0" encoding="UTF-16"?><root> > > >> <child1>text</child1> > > >> <child2> </child2> > > >> </root> > > >> > > >> Regards > > >> Dick Deneer > > >> > > >> --------------------------------------------------------------------- > > >> --- > > >> > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org > > > For additional commands, e-mail: j-users-h...@xerces.apache.org > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org > > For additional commands, e-mail: j-users-h...@xerces.apache.org