File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP 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
Greenhorn

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

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
Greenhorn

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

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

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
Bartender

Joined: Oct 14, 2005
Posts: 18708
    
    8

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:

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: XML data cannot be retrieved