A word to those doing SAX-based XML parsing and implementing the org.xml.sax.ContentHandler interface: Don’t assume all the characters between a “begin” and “end” tag, e.g. given the following XML snippet:
<mycoolelement>My precious data</mycoolelement>
…I’m talking about the “My precious data” part — are returned in a single call to characters(). Yes, most of the time, characters() will smile and give you “My precious data” with a bow on top. But don’t be fooled! Sometimes it’ll give you “My precio” in one call, and “us data” in another. And you have no idea when.
The solution then, is to accumulate the data you receive from characters(), until you get notification the end tag has been reached, and THEN, and ONLY THEN, process the data.
Let’s just say I ran into this, and it’s caused me several hours of grief. Thankfully I was able to learn from others’ experiences (see question, reply, followup and answer). Yay mailing lists and Google!
-
-
Live from my porch
It’s Tuesday night! Okay not quite live… pretty close though.
If the video doesn’t work, you can try downloading the file here (7.1mb).
-
Update on me
Hello readers.. how goes it? I have been keeping myself pretty busy over the past few days as you’ve doubtless guessed. We had pickup (all welcome) Ultimate Frisbee on Thursday, that was an unexpected surprise: 22 people showed up! That was nice, considering the week before attendance was around 13.
Friday, Cam, Melissa and I went over to Eric and Angela‘s for dinner, and met up with Greg, who came into town the night before to visit. We watched the first couple quarters of the Bucs-NYC Jets preseason game, before getting bored and switching to Making the Squad. In pre-season games, typically the first string plays in the first quarter, second in the second quarter, third in the third, etc. So usually things go downhill. That may be so, but at least the third string finally made the score higher than 3-3! The Bucs went on to win 16-3.
Saturday I spent a good portion of the morning and early afternoon at work, then a group of us went over to Darren‘s for a traditional night of NHL2006, frozen pizza and beer!! Yeah ๐ Haha. I think I like the 2006 version, it was fun… now if only I could figure out a way to prevent my thumb from going numb. We of course also drank entirely too much. But hey it wouldn’t be tradition if we didn’t. ๐
Sunday Cam and I got up early and went out to Lakewood Ranch Highschool for a game of early morning pickup Ultimate. There was just six of us, so there was a lot of running. Met Sean (Shawn/Shaun?) there, a high-school teacher and recent transplant to the area from the midwest. He’s got a good sense of humour and is a pretty good Ultimate player to boot ๐ Gotta say though, playing under the 11am sun is draining; we played half court, and took shadow/water breaks every 20 mins or so and still only lasted about an hour and a half. We cooled off with a stop at 7-11 for slurpees… ahhh… so good. ๐
The afternoon was spent in the apartment complex pool, where we played a game of “whip the ball across the pool in order to knock down their plastic beer steins” and I had fun playing with Joe. Melissa and Cam had Patricia and I over for dinner, grilled marinated chicken, tomato/mozarella salad and ice cream ๐ Mmm.. We watched Liar Liar, which felt a little too much like a vehicle for Jim Carrey‘s physical comedy, because the plot was utterly simple: Lawyer can’t lie. Hilarity ensues. I preferred him in Eternal Sunshine of the Spotless Mind. There were some pretty funny outtakes at the end though.
Anyhow, expect updates this week to be on the light side, as I’ll likely be working some late nights, but I’ll try and get in at least one. ๐