APIs for SAX writers

Discussion in 'XML' started by Duke Hamacher, Oct 12, 2004.

  1. I have a situation where I occasionally would like to insert an
    element in an XML file I'm parsing, while I'm parsing it. Are there
    any dependable APIs for this? Thanx.

    Duke Hamacher
     
    Duke Hamacher, Oct 12, 2004
    #1
    1. Advertising

  2. Duke Hamacher wrote:
    > I have a situation where I occasionally would like to insert an
    > element in an XML file I'm parsing, while I'm parsing it. Are there
    > any dependable APIs for this? Thanx.
    >
    > Duke Hamacher


    Why would you want to do that? I don't know what the problems is you are
    trying to solve, but you might want to transform your source xml before
    parsing it ...

    --
    met vriendelijke groeten/kind regards,

    Jan van Mansum
     
    Jan van Mansum, Oct 13, 2004
    #2
    1. Advertising

  3. I know, it seems odd, but this world presents odd situations. What is
    going on is this . . . I have a client who will not necessarily follow
    our schema (for complex reasons). If they make a certain error, it
    would be most efficient to correct it on the spot (during parsing) and
    save the need to communicate the problem back to my client.
    Certainly, there are other ways fix files, but SAX writing provides the
    best answer resource and time-wise.

    Thanx for repsonding,
    Duke


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Duke Hamacher, Oct 13, 2004
    #3
  4. Duke Hamacher

    Donald Roby Guest

    On Wed, 13 Oct 2004 18:08:45 +0000, Duke Hamacher wrote:


    > I know, it seems odd, but this world presents odd situations. What is
    > going on is this . . . I have a client who will not necessarily follow
    > our schema (for complex reasons). If they make a certain error, it
    > would be most efficient to correct it on the spot (during parsing) and
    > save the need to communicate the problem back to my client. Certainly,
    > there are other ways fix files, but SAX writing provides the best answer
    > resource and time-wise.
    >
    >

    To do this during SAX parsing, you'll want to setup a SAX ContentHandler.
    Look at http://www-106.ibm.com/developerworks/library/x-tiphandl.html for
    a good explanation of the basics. DeveloperWorks has quite a few good
    articles on things like this, so their XML section might be worth a more
    general browse.

    If the error is regular enough, it might be cleaner and simpler to do with
    XSLT as the previous responder suggested. And if it's not, the code to
    fix it during parsing might also be a bear.
     
    Donald Roby, Oct 14, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andy Fish

    closing writers and outputstreams

    Andy Fish, Nov 13, 2003, in forum: Java
    Replies:
    1
    Views:
    507
    Thomas Weidenfeller
    Nov 13, 2003
  2. M.Kumar

    Advanced C++ writers

    M.Kumar, Aug 1, 2004, in forum: C++
    Replies:
    3
    Views:
    404
    Julie
    Aug 2, 2004
  3. Scott Abel
    Replies:
    0
    Views:
    441
    Scott Abel
    Jul 5, 2006
  4. Stani
    Replies:
    0
    Views:
    291
    Stani
    Jul 15, 2005
  5. Guest
    Replies:
    3
    Views:
    309
Loading...

Share This Page