You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by lingan <sa...@gmail.com> on 2007/08/09 18:24:38 UTC
Betwixt 7 Reading problem
Hi I am trying to convert the XML to Java Object . I am getting the following
excpetion . Any help is highly appreciated.
java.net.MalformedURLException: no protocol: Successful 56263 4
at java.net.URL.(URL.java(Compiled Code))
at java.net.URL.(URL.java:463)
at java.net.URL.(URL.java:412)
at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown
Source)
at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown
Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.commons.digester.Digester.parse(Digester.java:1605)
at
com.physiciansmutual.service.sircon.SirconMockTest.extractPacketData(SirconMockTest.java:86)
at
com.physiciansmutual.service.sircon.SirconMockTest.main(SirconMockTest.java:127)
null
Here is my code .
BufferedReader reader = new BufferedReader(new
InputStreamReader(SirconMockTest.class.getResourceAsStream(batchId +
".xml")));
StringBuffer buffer = new StringBuffer();
String thisLine = "";
while ((thisLine = reader.readLine()) != null) {
buffer.append(thisLine);
}
StringReader xmlReader = new StringReader(buffer.toString());
BeanReader beanReader = new BeanReader();
beanReader.getBindingConfiguration().setMapIDs(false);
beanReader.getXMLIntrospector().getConfiguration().setWrapCollectionsInElement(false);
beanReader.registerBeanClass("ContractDataExtractResponse",
ContractDataExtractResponseType.class);
beanReader.registerBeanClass("Status", StatusType.class);
beanReader.registerBeanClass("BatchID", BatchIDType.class);
beanReader.registerBeanClass("RecordCount",
ContractDataExtractResponseType_RecordCount.class);
System.out.println("String from XMLReader : " + buffer.toString());
//StringEscapeUtils.escapeJava(
conData =
(ContractDataExtractResponseType)beanReader.parse(buffer.toString());
Thanks.
--
View this message in context: http://www.nabble.com/Betwixt-7-Reading-problem-tf4243596.html#a12075613
Sent from the Commons - User mailing list archive at Nabble.com.
RE: Betwixt 7 Reading problem
Posted by lingan <sa...@gmail.com>.
Hi Shishir ,
Your point was right.
Just now I modified using a StringReader .
thanks for pointing out though.
Now I am getting this
<pre>
Aug 9, 2007 11:49:26 AM org.apache.commons.betwixt.expression.Context
popOptions
INFO: Cannot pop options off empty stack
Aug 9, 2007 11:49:26 AM org.apache.commons.betwixt.expression.Context
popOptions
INFO: Cannot pop options off empty stack
Aug 9, 2007 11:49:26 AM org.apache.commons.betwixt.expression.Context
popOptions
INFO: Cannot pop options off empty stack
Aug 9, 2007 11:49:26 AM org.apache.commons.betwixt.expression.Context
popOptions
INFO: Cannot pop options off empty stack
BatchRequestType = null;StatusType = null;clientRequestID = null
Aug 9, 2007 11:49:26 AM org.apache.commons.betwixt.expression.Context
popOptions
INFO: Cannot pop options off empty stack
Aug 9, 2007 11:49:26 AM org.apache.commons.betwixt.expression.Context
popOptions
INFO: Cannot pop options off empty stack
Aug 9, 2007 11:49:26 AM org.apache.commons.betwixt.expression.Context
popOptions
INFO: Cannot pop options off empty stack
Aug 9, 2007 11:49:26 AM org.apache.commons.betwixt.expression.Context
popOptions
INFO: Cannot pop options off empty stack
</pre>
could you give your inputs on this ?
Thanks
Shishir K. Singh wrote:
>
> Instead of doing
>
> StringBuffer buffer = new StringBuffer();
> String thisLine = "";
> while ((thisLine = reader.readLine()) != null) {
>
> buffer.append(thisLine);
> }
> Ty this:
>
> BeanReader beanReader = new BeanReader();
>
> beanReader.getBindingConfiguration().setMapIDs(false);
>
>
> beanReader.getXMLIntrospector().getConfiguration().setWrapCollectionsInE
> lement(false);
>
> beanReader.registerBeanClass("ContractDataExtractResponse",ContractDataE
> xtractResponseType.class);
> beanReader.registerBeanClass("Status",
> StatusType.class);
> beanReader.registerBeanClass("BatchID",
> BatchIDType.class);
>
> beanReader.registerBeanClass("RecordCount",ContractDataExtractResponseTy
> pe_RecordCount.class);
>
> BufferedReader reader = new BufferedReader(new
> InputStreamReader(SirconMockTest.class.getResourceAsStream(batchId
> +".xml")));
> conData =
> (ContractDataExtractResponseType)beanReader.parse(new
> InputSource(reader));
>
> -----Original Message-----
> From: lingan [mailto:sathya78.guna@gmail.com]
> Sent: Thursday, August 09, 2007 12:25 PM
> To: user@commons.apache.org
> Subject: Betwixt 7 Reading problem
>
>
> Hi I am trying to convert the XML to Java Object . I am getting the
> following
> excpetion . Any help is highly appreciated.
>
> java.net.MalformedURLException: no protocol: Successful 56263 4
> at java.net.URL.(URL.java(Compiled Code))
> at java.net.URL.(URL.java:463)
> at java.net.URL.(URL.java:412)
> at
> org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown
> Source)
> at
> org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown
> Source)
> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
> Source)
> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
> Source)
> at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
> at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown
> Source)
> at
> org.apache.commons.digester.Digester.parse(Digester.java:1605)
> at
> com.physiciansmutual.service.sircon.SirconMockTest.extractPacketData(Sir
> conMockTest.java:86)
> at
> com.physiciansmutual.service.sircon.SirconMockTest.main(SirconMockTest.j
> ava:127)
> null
>
>
> Here is my code .
>
> BufferedReader reader = new BufferedReader(new
> InputStreamReader(SirconMockTest.class.getResourceAsStream(batchId +
> ".xml")));
> StringBuffer buffer = new StringBuffer();
> String thisLine = "";
> while ((thisLine = reader.readLine()) != null) {
>
> buffer.append(thisLine);
> }
> StringReader xmlReader = new
> StringReader(buffer.toString());
> BeanReader beanReader = new BeanReader();
>
> beanReader.getBindingConfiguration().setMapIDs(false);
>
> beanReader.getXMLIntrospector().getConfiguration().setWrapCollectionsInE
> lement(false);
>
> beanReader.registerBeanClass("ContractDataExtractResponse",
> ContractDataExtractResponseType.class);
> beanReader.registerBeanClass("Status",
> StatusType.class);
> beanReader.registerBeanClass("BatchID",
> BatchIDType.class);
> beanReader.registerBeanClass("RecordCount",
> ContractDataExtractResponseType_RecordCount.class);
> System.out.println("String from XMLReader : " +
> buffer.toString());
> //StringEscapeUtils.escapeJava(
> conData =
> (ContractDataExtractResponseType)beanReader.parse(buffer.toString());
>
> Thanks.
> --
> View this message in context:
> http://www.nabble.com/Betwixt-7-Reading-problem-tf4243596.html#a12075613
> Sent from the Commons - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/Betwixt-7-Reading-problem-tf4243596.html#a12076204
Sent from the Commons - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org
RE: Betwixt 7 Reading problem
Posted by "Shishir K. Singh" <sk...@synapsistech.com>.
Instead of doing
StringBuffer buffer = new StringBuffer();
String thisLine = "";
while ((thisLine = reader.readLine()) != null) {
buffer.append(thisLine);
}
Ty this:
BeanReader beanReader = new BeanReader();
beanReader.getBindingConfiguration().setMapIDs(false);
beanReader.getXMLIntrospector().getConfiguration().setWrapCollectionsInE
lement(false);
beanReader.registerBeanClass("ContractDataExtractResponse",ContractDataE
xtractResponseType.class);
beanReader.registerBeanClass("Status",
StatusType.class);
beanReader.registerBeanClass("BatchID",
BatchIDType.class);
beanReader.registerBeanClass("RecordCount",ContractDataExtractResponseTy
pe_RecordCount.class);
BufferedReader reader = new BufferedReader(new
InputStreamReader(SirconMockTest.class.getResourceAsStream(batchId
+".xml")));
conData =
(ContractDataExtractResponseType)beanReader.parse(new
InputSource(reader));
-----Original Message-----
From: lingan [mailto:sathya78.guna@gmail.com]
Sent: Thursday, August 09, 2007 12:25 PM
To: user@commons.apache.org
Subject: Betwixt 7 Reading problem
Hi I am trying to convert the XML to Java Object . I am getting the
following
excpetion . Any help is highly appreciated.
java.net.MalformedURLException: no protocol: Successful 56263 4
at java.net.URL.(URL.java(Compiled Code))
at java.net.URL.(URL.java:463)
at java.net.URL.(URL.java:412)
at
org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown
Source)
at
org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown
Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown
Source)
at
org.apache.commons.digester.Digester.parse(Digester.java:1605)
at
com.physiciansmutual.service.sircon.SirconMockTest.extractPacketData(Sir
conMockTest.java:86)
at
com.physiciansmutual.service.sircon.SirconMockTest.main(SirconMockTest.j
ava:127)
null
Here is my code .
BufferedReader reader = new BufferedReader(new
InputStreamReader(SirconMockTest.class.getResourceAsStream(batchId +
".xml")));
StringBuffer buffer = new StringBuffer();
String thisLine = "";
while ((thisLine = reader.readLine()) != null) {
buffer.append(thisLine);
}
StringReader xmlReader = new
StringReader(buffer.toString());
BeanReader beanReader = new BeanReader();
beanReader.getBindingConfiguration().setMapIDs(false);
beanReader.getXMLIntrospector().getConfiguration().setWrapCollectionsInE
lement(false);
beanReader.registerBeanClass("ContractDataExtractResponse",
ContractDataExtractResponseType.class);
beanReader.registerBeanClass("Status",
StatusType.class);
beanReader.registerBeanClass("BatchID",
BatchIDType.class);
beanReader.registerBeanClass("RecordCount",
ContractDataExtractResponseType_RecordCount.class);
System.out.println("String from XMLReader : " +
buffer.toString());
//StringEscapeUtils.escapeJava(
conData =
(ContractDataExtractResponseType)beanReader.parse(buffer.toString());
Thanks.
--
View this message in context:
http://www.nabble.com/Betwixt-7-Reading-problem-tf4243596.html#a12075613
Sent from the Commons - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org