Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Not able to extract XML data got in string format

 
Deepshan Shetty
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all


I get a xml data in form of a string(never seen such a xml data) but im stuck wid extracting it.

The data is like,
<ABC ONE="1023814" TWO="1234567892" THREE="INR" FOUR="2012-05-25" FIVE="1" SIX="FAILED" />

When i extract dis i get null.

Can anyone send a snippet of code to achieve this functionality, its bit urgent.

Regards
S V Shetty
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
shraddha dsn wrote:

When i extract dis i get null.

How do you extract it and from where? What does your code look like?

 
Deepshan Shetty
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Need to extract it in java..

Please Check my code




Regards
S V Shetty
 
John Jai
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please UseCodeTags while posting codes.
 
Deepshan Shetty
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay Sir

Regards
S V Shetty
 
John Jai
Rancher
Posts: 1776
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Basic things to troubleshoot -
1. Use printStackTrace() on the Exception to find which line creates Exception, if any.
2. Use System.out.print statements to find if the flow of the program.

If you have the node like - <ABC ONE="someValue" TWO="someValue" /> , then ONE and TWO are not Nodes (or Elements) but attributes of the node ABC.

So the correct way to get the value present in the attribute ONE will be like below -

and hence this won't work.


Make sure it fails there by using some print statements.
 
John Jai
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
shraddha dsn wrote:Okay Sir

Regards
S V Shetty

You can edit the post and apply code tags.
 
Deepshan Shetty
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did It Sir.

And Thank You . Will try with these now
 
Deepshan Shetty
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Very thankful to you Sir..

It worked!!!

Regards
S V Shetty
 
John Jai
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure and welcome to the Ranch

Please read Javaranch Naming Policy.
 
Deepshan Shetty
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank You
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic