logo       

Related Msgs: audio.musicbrai...    enbd.general/20...    ietf.idr/2002-0...    java.ant-contri...    gnu.make.genera...    qplus.devel/200...    video.freevo.cv...    os.netbsd.ports...    yellowdog.gener...    xfree86.cvs/200...    search.nutch.us...    freedesktop.xse...    programming.swi...    capabilities.ge...    telephony.pbx.a...    mail.sylpheed.c...    db.firebase.por...    boot-loaders.u-...    recreation.radi...    netbsd.bugs/200...    web.zope.plone....    user-groups.lin...   

Re: LSSerializer: msg#00011

Subject: Re: LSSerializer
I mentioned this issue in the xalan list.

If you don't want to use the deprecated xerces serializer you can filter out the whitespace first.
This filter was already mentioned in the forum which can be set on the serializer:
static LSSerializerFilter skipWhitespaceFilter = new LSSerializerFilter()
{
public short acceptNode(Node n)
{
if (n.getNodeType() == Node.TEXT_NODE)
{
return (n.getNodeValue().trim().length() == 0) ? FILTER_REJECT
: FILTER_ACCEPT;
}
return FILTER_ACCEPT;
}

public int getWhatToShow()
{
return NodeFilter.SHOW_ALL;
}

public short startElement(Element elem)
{
return FILTER_ACCEPT;
}
};

You may want this filter more precise by filtering out only the whitespace in mixed content nodes.

Regards
Dick Deneer


Op 5-apr-2007, om 19:04 heeft Rafał Gierusz het volgende geschreven:

I'm using Xerces 2.9.0. any idea about this version and my problem?
Should I use other mailing list (xalan)?

Michael Glavassevich wrote:
You haven't said what release you tried this with (assuming it's Xerces). 
Note that "format-pretty-print" has only been implemented since Xerces 
2.8.0. If you're using Xerces 2.9.0 the LSSerializer is based on Xalan 
which has different behaviour with respect to pretty-printing.

Rafał Gierusz <superrafcio@xxxxx> wrote on 04/05/2007 05:39:51 AM:

Hello,

I would like to make "pretty-print" xml using LSSerializer, so a write:

LSSerializer serializer = ...
serializer.getDomConfig().setParameter("format-pretty-print", true);

then I get string with "pretty-print" xml using metod:
serializer.writeToString(... DOMDocument ...));

and the result is:

<a xmlns:z="http://a.com">
   <b>
      <z:c/>



                      </b>
</a>

whitespaces inside "<b>" tag are not removed (after "<z:c/>" tag). Does
anyone know how to remove this whitespaces?


---------------------------------------------------------------------
For additional commands, e-mail: j-users-help@xxxxxxxxxxxxxxxxx





Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo