Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
arunbiet
Posts: 376
Registered: ‎06-22-2010
My Device: na
My Carrier: blackberry developer

XML parsing using DOM

<h_box id="h1">
  <Class name="BitmapField" image="/xyz.png">
    <width="50">
    <Height="70">
  </Class>

  <Class name="LabelField" image="Hello World">
    <width="50">
    <Height="70">
    <Color ="Green">
  </Class>
</h_box>

<v_box id="v1">
  <Class name="BitmapField" image="/abc.png">
    <width="50">
    <Height="70">
  </Class>

  <Class name="LabelField" image="Welcome">
    <width="50">
    <Height="70">
    <Color ="Green">
  </Class>
</v_box>

 I have an XML in this format.I am using DOM parser to parse through the document.I need to take some action when First ""h_box" end and than again when "v_box" ends.How to know that my "h_box" node has ended.Can anyone help?

Please use plain text.
Developer
Dionysus
Posts: 152
Registered: ‎07-28-2011
My Device: Bold 9900
My Carrier: MTN

Re: XML parsing using DOM

I've never used DOM or really done much XML parsing but using the SAXParser and a Custom handler.

 

In the custom handler you get the start and end element. You can use a flag for the start and end of you h_box as well as your v_box.

Please use plain text.