Optimizing SAX CDATA handling

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Aidan

    #1

    Optimizing SAX CDATA handling

    The setup: a Sax parser in a servlet and a Java client (same machine) which
    uploads an XML document containing CDATA elements which hold base 64
    encoded binary files. The servlet then SAX parses the client's data. If I
    comment out the parser call I can see that the transmition time of large
    data files is very low.

    My understanding is that a SAX parser should transmit the content of a CDATA
    string downstream without signiificant processing.

    What I see:

    If the CDATA sections are small (1KB or so) the Sax parser processes the
    document around 20ms.

    When the CDATA sections are large (totalling 1MB for example) parsing
    becomes drastically slower, edging up towards 1000ms.

    The only diffence between the two documents is the size of the CDATA.

    I've tried several Sax implementations but the behaviour is the same.

    How can I speed up parsing ? Is there a way have the parser's lexical
    analyser perform fast copy-through processing on large CDATA sections? Is
    there a buffering issue here?

    A
Working...