aspose file tools*
The moose likes XML and Related Technologies and the fly likes Not able to extract XML data got in string format Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Not able to extract XML data got in string format" Watch "Not able to extract XML data got in string format" New topic
Author

Not able to extract XML data got in string format

Deepshan Shetty
Greenhorn

Joined: May 28, 2012
Posts: 28
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

Joined: Jul 20, 2005
Posts: 10288
    
168

shraddha dsn wrote:

When i extract dis i get null.

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


[My Blog] [JavaRanch Journal]
Deepshan Shetty
Greenhorn

Joined: May 28, 2012
Posts: 28
Need to extract it in java..

Please Check my code




Regards
S V Shetty
John Jai
Bartender

Joined: May 31, 2011
Posts: 1776
Please UseCodeTags while posting codes.
Deepshan Shetty
Greenhorn

Joined: May 28, 2012
Posts: 28
Okay Sir

Regards
S V Shetty
John Jai
Bartender

Joined: May 31, 2011
Posts: 1776
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
Bartender

Joined: May 31, 2011
Posts: 1776
shraddha dsn wrote:Okay Sir

Regards
S V Shetty

You can edit the post and apply code tags.
Deepshan Shetty
Greenhorn

Joined: May 28, 2012
Posts: 28
Did It Sir.

And Thank You . Will try with these now
Deepshan Shetty
Greenhorn

Joined: May 28, 2012
Posts: 28
Very thankful to you Sir..

It worked!!!

Regards
S V Shetty
John Jai
Bartender

Joined: May 31, 2011
Posts: 1776
Sure and welcome to the Ranch

Please read Javaranch Naming Policy.
Deepshan Shetty
Greenhorn

Joined: May 28, 2012
Posts: 28
Thank You
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Not able to extract XML data got in string format