This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes XML data cannot  be retrieved Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XML data cannot  be retrieved" Watch "XML data cannot  be retrieved" New topic
Author

XML data cannot be retrieved

Deepshan Shetty
Ranch Hand

Joined: May 28, 2012
Posts: 30
Hi

I am trying to connect to a remote Host.

I get a response but then it throws a exception like

Exception in xmlParseString::org.xml.sax.SAXParseException: Element type
"VerifyOutput" must be followed by either attribute specifications, ">" or "/>"


My XML output string is

<?xml version='1.0' encoding='UTF-8'?><VerifyOutput ITC='ABC' PRN ='2100001' CURRENCY = 'INR'PMTDATE ='2012-06-04'AMT ='1.0'STATUS='FAILED' > </VerifyOutput>

Can anyone help me knowing why and what case can this happen?

Regards
S V Shetty

John Jai
Rancher

Joined: May 31, 2011
Posts: 1776
If there is no child / text content for VerifyOutput node, then it shall be either look like below.
<VerifyOutput></VerifyOutput> or <VerifyOutput/>

You get the ParseException when your XML is not valid. Change the node and check again.
Deepshan Shetty
Ranch Hand

Joined: May 28, 2012
Posts: 30
But i get attributes right? Even then it shows the same exception??

<?xml version='1.0' encoding='UTF-8'?><VerifyOutput ITC='ABC' PRN ='2100001' CURRENCY = 'INR'PMTDATE ='2012-06-04'AMT ='1.0'STATUS='FAILED' > </VerifyOutput>

This is incorrect you mean??
Deepshan Shetty
Ranch Hand

Joined: May 28, 2012
Posts: 30
Hi

Can i know how can i retrieve such kind of a data from the tags without this exception??

The data must be in the same format.

<?xml version='1.0' encoding='UTF-8'?><VerifyOutput ITC='ABC' PRN ='2100001' CURRENCY = 'INR'PMTDATE ='2012-06-04'AMT ='1.0'STATUS='FAILED' > </VerifyOutput>

Regards
S V shetty
John Jai
Rancher

Joined: May 31, 2011
Posts: 1776
I missed to see the VerifyOutput start tag. Why are you using single quote for attribute values? Replace it with double quotes.
Paul Clapham
Sheriff

Joined: Oct 14, 2005
Posts: 19747
    
  10

John Jai wrote:I missed to see the VerifyOutput start tag. Why are you using single quote for attribute values? Replace it with double quotes.


No, either type of quote is acceptable to delimit attribute values. The problem here is that there are attributes which are run together without spaces separating them:

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: XML data cannot be retrieved
 
It's not a secret anymore!