You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jaxme-dev@ws.apache.org by Stracuzzi Stefano <St...@siemens.com> on 2004/08/17 12:03:00 UTC
java.net.MalformedURLException: no protocol
Hi,
i'm a noob in XML developing and i'm using JaxMe to generate xml
document and to parse them.
I've followed all the docs and i'm now able to marshall a document, but when
i try to unmarshall it i had this exception:
javax.xml.bind.UnmarshalException
at
org.apache.ws.jaxme.impl.JMUnmarshallerImpl.unmarshal(JMUnmarshallerImpl.jav
a:106)
at wgs.cq.system.XMLManager.executeUnMarshall(XMLManager.java:60)
at wgs.cq.system.test.main(test.java:44)
Caused by:
java.net.MalformedURLException: no protocol: <?xml version='1.0'
encoding='UTF-8'?>
<QRY_A19 xmlns="urn:hl7-org:v2xml">
<MSH>
<MSH.1>|</MSH.1>
<MSH.2>^~\&</MSH.2>
<MSH.3>
<HD.2>Siemens_WgsCq_1.0.0</HD.2>
</MSH.3>
<MSH.9>
<MSG.1>QRY</MSG.1>
<MSG.2>A19</MSG.2>
<MSG.3>QRY_A19</MSG.3>
</MSH.9>
<MSH.10>123321</MSH.10>
<MSH.11>
<PT.1>P</PT.1>
<PT.2>not present</PT.2>
</MSH.11>
<MSH.12>
<VID.1>2.3.1</VID.1>
</MSH.12>
</MSH>
<QRD>
<QRD.1>
<TS.1>200408171156</TS.1>
</QRD.1>
<QRD.2>R</QRD.2>
<QRD.3>I</QRD.3>
<QRD.4>1234</QRD.4>
<QRD.7>
<CQ.1>100</CQ.1>
<CQ.2>
<CE.1>RD</CE.1>
</CQ.2>
</QRD.7>
<QRD.8>
<XCN.2>
<FN.1>STRACUZZI</FN.1>
</XCN.2>
<XCN.3>EMANUELE</XCN.3>
</QRD.8>
<QRD.9>
<CE.1>DEM</CE.1>
</QRD.9>
<QRD.10>
<CE.1>""</CE.1>
</QRD.10>
</QRD>
<QRF>
<QRF.1>SOLE</QRF.1>
<QRF.4>PRLPLA74C28F257S</QRF.4>
<QRF.5></QRF.5>
<QRF.5></QRF.5>
<QRF.5>19761011</QRF.5>
</QRF>
</QRY_A19>
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<init>(Unknown Source)
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.ws.jaxme.impl.JMUnmarshallerImpl.unmarshal(JMUnmarshallerImpl.jav
a:98)
at wgs.cq.system.XMLManager.executeUnMarshall(XMLManager.java:60)
at wgs.cq.system.test.main(test.java:44)
The XML is generated by a marshalling operation :(
i don't know how to resolve it.
My Unmarshall code is like this:
JAXBContext jaxbContext = JAXBContext.newInstance("wgs.cq.xml");
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
unmarshaller.setValidating(false);
InputSource sIS = new InputSource(sXML);
return unmarshaller.unmarshal(sIS);
can someone explain me where is the problem??
thanks a lot!
---
Cordiali Saluti / Best Regards
Stefano Stracuzzi
:: Web Developer | Java & IBM ::
Re: java.net.MalformedURLException: no protocol
Posted by Jochen Wiedmann <jo...@freenet.de>.
Stracuzzi Stefano wrote:
> My Unmarshall code is like this:
>
> JAXBContext jaxbContext = JAXBContext.newInstance("wgs.cq.xml");
> Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
> unmarshaller.setValidating(false);
> InputSource sIS = new InputSource(sXML);
> return unmarshaller.unmarshal(sIS);
>
> can someone explain me where is the problem??
>
You are doing slightly wrong here: Replace
InputSource sIS = new InputSource(sXML);
with
InputSource sIS = new InputSource(new StringReader(sXML));
The constructor InputSource(String) has the meaning, that the argument
is the URL of a file being loaded, not the actual file.
Jochen
P.S: Would you mind creating an entry (for example "How do I unmarshal
an XML document from a string?" in the FAQ?
See http://wiki.apache.org/ws/JaxMe/FrequentlyAskedQuestions
---------------------------------------------------------------------
To unsubscribe, e-mail: jaxme-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: jaxme-dev-help@ws.apache.org