Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > APIs for SAX writers

Reply
Thread Tools

APIs for SAX writers

 
 
Duke Hamacher
Guest
Posts: n/a
 
      10-12-2004
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
 
Reply With Quote
 
 
 
 
Jan van Mansum
Guest
Posts: n/a
 
      10-13-2004
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
 
Reply With Quote
 
 
 
 
Duke Hamacher
Guest
Posts: n/a
 
      10-13-2004

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!
 
Reply With Quote
 
Donald Roby
Guest
Posts: n/a
 
      10-13-2004
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/developerwork...-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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Infinity is looking for writers. The Modfather The Lounge 71 02-12-2006 08:04 AM
Spyware & Adware writers switching over to Mozilla marc@mercund.org Firefox 4 03-03-2005 11:46 PM
Tutorial Writers? Jim Saunders Cisco 1 05-17-2004 03:41 PM
closing writers and outputstreams Andy Fish Java 1 11-13-2003 10:18 AM



Advertisments