Sax parse xml bug , I can't figure it out!

(1) orginal xml file as followings:
<row>
<field name="productBundleId">22456</field>
<field name="localPath">/products/01092008/RealArcade/STD_StonesOfKhufu_NOK6030_EN_v1_0_12.jar</field>
<field name="description">/products/01092008/RealArcade/STD_StonesOfKhufu_NOK6030_EN_v1_0_12.jad</field>
</row>
(2) task parsing the above and and retrieve the value and set it to a javabean:
(3) Using the SAX as the xml file is very big , about 1M
* @author mertef
public class XerseHandlerImp extends DefaultHandler implements MF_CONSTANTS
     List                              m_data               = new ArrayList();
     private CompareSimpleBean     m_csb               = null;
     private String                    m_tmpVal          = "";
     private boolean                    m_id               = false;
     private boolean                    m_jar               = false;
     private boolean                    m_jad               = false;
     private String                    m_whitespace     = "";
     private boolean                    m_character          = false;
     @Override
     public void characters(char[] ch, int start, int length) throws SAXException
*          // System.out.println(new String(ch,start,length));*
          m_tmpVal = new String(ch, start, length);*
if (jad) System.out.println(tmpVal);*
     @Override
     public void endElement(String uri, String localName, String name) throws SAXException
          m_character = false;
          if (name.equals(MOVAYA_ROW))
               m_data.add(m_csb);
          if (name.equals(MOVAYA_FIELD))
               if (m_id)
                    m_csb.setId(m_tmpVal);
                    m_id = false;
                    m_jar = false;
                    m_jad = false;
               else if (m_jar)
                    m_csb.setJarPath(m_tmpVal);
                    m_id = false;
                    m_jar = false;
                    m_jad = false;
               else if (m_jad)
                    m_csb.setJadPath(m_tmpVal);
                    m_id = false;
                    m_jar = false;
                    m_jad = false;
     @Override
     public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException
          m_whitespace = new String(ch, start, length);
(4) please pay attention to the bold area , the method:
character()
I declare a variable "m_character" to decide if the parser don't read content of
an item in above xml file ,such as
/products/01092008/RealArcade/STD_StonesOfKhufu_NOK6030_EN_v1_0_12.jar
(5)error:
but some time it only reads part of the character contents:
eg:
/products/01092008/RealAr
cade/STD_StonesOfKhufu_UnitedStates_LGCU515_EN_v1_0_12.jad
It means that they parser comes across some character when parsing,
but in fact it doesn't.
You can use println() to monitor the outputs.
So I need to declare some boolean variable to decide whether all the content of one item has read fully.
(6)
May be its a bug, my xml file don't include any special charactor.

The problem is that the character data might be delivered in multiple chunks, this means that the characters method might be called more than once for the same element.
One way around this is to create a StringBuilder or something similar in the startElement() method, and fill it with the characters in the characters() method and read it in the endElement() method.
For more information: http://forum.java.sun.com/thread.jspa?threadID=5255925

Similar Messages

  • Mac desktop. 10.6.8. Text edit. Not locked. Read and write. Still, documents are locking when they are moved from desktop to another folder on the server. Techies can't figure it out here. What am I not doing?

    Mac desktop. 10.6.8. Text edit. Not locked. Read and write, not read only. Documents are locking when they are moved from desktop to another folder or saved directly into that folder on the server. Not happening with anyone else but me and the boss's computer so has to be in the properties for my text edit software. Techies can't figure it out after trying for two weeks. Boss can do a cut and paste and put into a new document, but that's starting to become a problem.

    Mac desktop. 10.6.8. Text edit. Not locked. Read and write, not read only. Documents are locking when they are moved from desktop to another folder or saved directly into that folder on the server. Not happening with anyone else but me and the boss's computer so has to be in the properties for my text edit software. Techies can't figure it out after trying for two weeks. Boss can do a cut and paste and put into a new document, but that's starting to become a problem.

  • I am trying to pair my cell phone and tablet using Messages   App,  but only MMS messages will come through on my tablet.   I've tried pairing and unpaired,  reinstalling app on my tablet,  and can't figure it out.   Any idea how to fix this?

    I am trying to pair my cell phone and tablet using Messages   App,  but only MMS messages will come through on my tablet.   I've tried pairing and unpaired,  reinstalling app on my tablet,  and can't figure it out.   Any idea how to fix this?
    Thanks

    I Shared my most ridiculous situation but didn t log under your problem.
    sorry, I gave you your answer under sunshine99 or Dianna. I want out and you want in.
    if you not find just email me at [removed]
    thanks
    Personal information removed as required by the Verizon Wireless Terms of Service
    Message was edited by: Admin Moderator

  • Pages will no longer let me open files that I have previously downloaded, worked on and then saved on my mac. However it will let me open pages documents that I have started from new. I need the other documents to open and can't figure it out. PLEASE

    Pages will no longer let me open files that I have previously downloaded, worked on and then saved on my mac. However it will let me open pages documents that I have started from new. I need the other documents to open and can't figure it out. PLEASE

    I just got my mac a month ago so go easy on me but I was just working with the pages that was already on it, and then today I know it updated, and now I am unable to open a lot of my documents!:(  Idk what you mean by the icloud version lol sorry! As for the version, when I open pages from my apps and click 'about' it says version 5.1? And when I open the document it just goes grey and kind of blinks and doesnt open? No error message or any indication of why it will not open now when I for sure have opened it in the past! Andddd for the OS X I think it is 10.9.1 ??

  • Is there a way to remove my facebook contacts from my phone contacts list?  I had an iphone 4 and it was easy to shut off from teh contacts through the groups link at the top left, but the iphone 5s does not have this feature nor can i figure it out throu

    Is there a way to remove my facebook contacts from my phone contacts list?  I had an iphone 4 and it was easy to shut off from teh contacts through the groups link at the top left, but the iphone 5s does not have this feature nor can i figure it out through the settings feature or anything else....HELP please as it is annoying to see all of these contacts!

    Hello ymprice91277, let's solve this mystery! To unlink the Facebook contacts go to Settings, Facebook, turn off contacts.
    WiltonA_VZW
    VZW Support
    Follow us on twitter @VZWSupport

  • Can't figure this out- cable connection vs wifi connection

    Can't figure this out: when my 13" MBP is connected wirelessly to my Airport base station, my iPad can see it. When I connect the MBP to the base station via ethernet cable (for faster connection), the iPad can no longer see it.
    Note: my airport is not connected to the internet. I'm simply wanting to setup a closed network for the iPad to connect to the MBP. There's nothing else on the network. The app on the iPad is locating the MBP by ip address so it must be a permanently assigned number.
    Message was edited by: Alan Schmidt

    Am having the same problem.
    Everything was working fine until yesterday.
    Now if I connect my iMac to the Extreme with Ethernet the Airport is not visible and I can't connect to the internet.
    iPods and iPhones can still use the wifi to get on the internet.
    If I switch the iMac to Airport it works, but, will not work with the Ethernet cable connected.
    Have tried changing ethernet cables and still no go.
    Can't figure this out.

  • Can't figure this out: locating a MBP on the same wifi network

    Can't figure this out: when my 13" MBP is connected wirelessly to my Airport base station, my iPad can see it. When I connect the MBP to the base station via ethernet cable (for faster connection), the iPad can no longer see it.
    Note: my airport is not connected to the internet. I'm simply wanting to setup a closed network for the iPad to connect to the MBP. There's nothing else on the network. The app on the iPad is locating the MBP by ip address so it must be a permanently assigned number.
    Message was edited by: Alan Schmidt

    Am having the same problem.
    Everything was working fine until yesterday.
    Now if I connect my iMac to the Extreme with Ethernet the Airport is not visible and I can't connect to the internet.
    iPods and iPhones can still use the wifi to get on the internet.
    If I switch the iMac to Airport it works, but, will not work with the Ethernet cable connected.
    Have tried changing ethernet cables and still no go.
    Can't figure this out.

  • I purchased the Brookstone DLP projector for the iPhone, and all the reviews state the iPhone 4S can be mirrored with it. However, I can't not figure out how to do so. Is there a setting to change? Can't figure it out! ARGGG!

    I purchased the Brookstone DLP projector for the iPhone, and all the reviews state the iPhone 4S can be mirrored with it. However, I can't not figure out how to do so. Is there a setting to change? Can't figure it out! ARGGG!
    It will show pictures and videos if I choose, Start Slideshow, but it won't show anything else, no apps, etc.
    Here's a few examples of the reviews which state it mirrors:
    http://www.bgr.com/2011/11/07/brookstone-pocket-projector-for-iphone-4-and-4s-re view/
    http://www.gadgetaddict.info/brookstone-pocket-projector-for-iphone-4-and-4s-rev iew/
    I bought this for video analysis presentations with an app on the phone, so this is a key feature for me.
    Any help is appreciated.
    Jim

    I also have not figured out how to mirrow either.  I ask you both, is the sound via the projector louder than the phone itself when projector is tuerned off?  No matter what I do the max vilume through the projector speakers is lower that the phone itself even with phone remaining installed in projector.  I am think of taking it back to try another one.
    Keith

  • In version 10.1 fcpx how do I edit in proxy, then when I am finished share with optimize footage? It was easy in 10.9 version, but I can't figure this out in 10.1, please help.

    in version 10.1 fcpx how do I edit in proxy, then when I am finished share with optimize footage? It was easy in 10.9 version, but I can't figure this out in 10.1, please help.

    The switch is in the upper right of the viewer.

  • I'm trying to title a movie event...won't let me.  Do I need to first move it to project library?  Can't figure that out.

    I'm trying to title a movie event...won't let me.  Do I need to first move it to project library?  Can't figure that out.

    Yes, you have to create a Project first. In iMovie's menu select File>New Project. Now drag clips (or portions of clips) to the Project from the Event. Drag titles from the Title pane on the lower right of the iMovie window (Click on the T icon to activate the Title pane). The title can be dragged onto a video clip in the Project or to a gap between clips. In the latter case you will be able to select a background from the pop-up "Choose Background" panel.
    John

  • I am using garage band for the first time.  I dragged and dropped a song from itunes into the program and I want to extend the length of the song by repeating the first 28 measures.  I can't figure it out.  Please help

    I am using garage band for the first time.  I dragged and dropped a song from itunes into the program and I want to extend the length of the song by repeating the first 28 measures.  I can't figure it out.  Please help.  I have spent several hours trying to figure it out on my own but have not been successful.  It seems like an easy task.  Can anyone help?

    dewin1or wrote:
    I want to extend the length of the song by repeating the first 28 measures.
    split the region at the 28th measure
    http://www.bulletsandbones.com/GB/GBFAQ.html#split
    (Let the page FULLY load. The link to your answer is at the top of your screen)
    then select only the first region and option-drag it to the end of the song

  • I have a 3GS. Am trying to sync a plantronics explorer 232 Bluetooth headset and can't figure it out. I have Bluetooth turned on but it searches for devices and the headset never shows up. Anyone know exactly how to do this?  My tech skills are lacking

    I have a 3GS. Am trying to sync a plantronics explorer 232 Bluetooth headset and can't figure it out. I have Bluetooth turned on but it searches for devices and the headset never shows up. Anyone know exactly how to do this?  My tech skills are lacking

    I have the same blueparrott headset headset with the directions. Actually reading them just fixed my iphone pairing issue.
    Here they are in case u still need them along with what I needed to do to get mine to work with iphone 4
    Pair Headset with Phone
    Turn off headset off
    Hold down headset's MFB (large top button) until red & blue lights flash and you hear 2 rising tones, followed by 4 more tones. Must wait for all before you release the MFB button!! (I had my hubby hold the MFB while I waited for the tones since both come from the headset
    Release the MFB and follow your phone's instructions to place it in 'bluetooth' discoverable mode.  With the iphone4, go to "General" and then "Bluetooth" and turn indicator to "ON".
    This is where my issue occurred as the phone could not find the bluetooth, although it worked with my LG phone.  So after trying it several times thinking I was nuts and that the issue was with the iphone, I looked further in the blueparrot's directions and found this step that fixed the issue.
    Reset Paired Devices List
    On the bluetooth, press and hold down both the volume up & volume down buttons for 5-6 seconds.  A double beep will be heard and the list will be reset.  Pairing info for devices previously paired will be lost.
    The bluetooth directions provide this as step 4 but that did not work for my phone (see below)
    4. Once the phone discovers the headset, select "pair" and enter "0000" code and that when pairing is complete the blue light on the headset will stop flashing and phone will prompt you to 'connect'.
    This is what I had to do after resetting the device list on my bluetooth
    4. My iphone instanting discovered the headset and displayed it under 'Devices" but showed a message that it was 'not connected'.  Once I selected the device on the iphone by pressing on it then it changed to "connected". 
    Even when I turn the bluetooth on and off the device remains on the list and alll I do is select it to connect and disconnect after I turn on my blueparrott bluetooth
    I hope this helps others!   

  • Some emails are coming in on my iPhone, but all of them are on my MacBook.  Can't figure it out.

    some emails are coming in on my iPhone, but all of them are on my MacBook.  Can't figure it out.
    any idea why this might be happening?
    Thanks!

    Yes, you do need iPhoto, or at least for the following: Plug it into the computer with the USB plug you get with it, and iTunes will automatically open. It doesn't matter if you keep it open or not, because you'll import them to iPhoto. When you open iPhoto, it will automatically go to your iPhone's inventory of photos. Choose a photo that you wish to import (or click import all), type in the titile, and click import. A pop-up message will come up that asks if yu want to keep originals. Click yes, and viola. Your photos are on your computer! Hope this helps.

  • I recently purchased a Macbook Pro and when connecting my iPhone 5 to the Macbook's Messages app, I clicked cancel after seeing the 6 digit code. I thought I could easily get that code back to my phone, but can't figure it out at all. Any help?

    I recently purchased a Macbook Pro and when connecting my iPhone 5 to the Macbook's Messages app, I clicked cancel after seeing the 6 digit code. I thought I could easily get that code back to my phone, but can't figure it out at all. Any help?

    Hello Unconscious2015,
    Thanks for using Apple Support Communities.
    If you are trying to configure your Mac to use SMS continuity with your iPhone, then please follow the directions below to configure SMS Continuity.
    To use Continuity for SMS and MMS with your iPhone and your Mac, iPad or iPod touch
    Your iPhone, iPad, and iPod touch need to use iOS 8.1, and your Mac needs to use OS X Yosemite.
    Sign in to iMessage on your iPhone, your other iOS devices, and your Mac using the same Apple ID.
    On your iPhone:
    Go to Settings > Messages > Send & Receive > You Can Be Reached By, and add a check to both your phone number and email address.
    Go to Messages > Text Message Forwarding, and enable the device(s) you would like to forward messages to.
    Your Mac, iPad, or iPod touch will display a code. Enter this code on your iPhone to verify the SMS feature.
    Connect your iPhone, iPad, iPod touch, and Mac using Continuity - Apple Support
    Take care,
    Alex H.

  • I am having trouble fading out a song at the end of an iMovie.  Also, the volume of the song is too high...I would like it to be more background music?  I have tried everything and can't figure it out...Can anyone help me, Please!!??

    I am having trouble fading out a song at the end of an iMovie.  Also, the volume of the song is too high...I would like it to be more background music?  I have tried everything and can't figure it out...Can anyone help me, Please!!??

    Did you ever resolve the iCloud problem.I am in the same position and its driving me mad!!! If you have a link to an solution I would appreciate it.

Maybe you are looking for