Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JDOM User »

Re: [jdom-interest] Obtaining a JDOM document from a Streamsource
 class

Jason Hunter

2007-07-13

Replies:

When you build from a stream, JDOM can't pull any supporting documents
(there's no context to pull from), but it can when you build from a
file. This is probably the cause of your problem.

-jh-

Clint.Redwood@(protected):
> Hi,
>
> I'm trying to use JDOM to access a webservice, and am using
>
> ...
>         Dispatch<Source> dispatch = svc.createDispatch(
>              portQName,
>              Source.class,
>              Service.Mode.PAYLOAD);
>
>         // Create the source
>         DOMSource input = new DOMSource((new DOMOutputter()).output(
> doc ));
>         Source output;
>
>         // Invoke the operation.
>         output = dispatch.invoke(input);
>
>         // retrieve JDOM document
>         if (
> output.getClass().getName().equals("javax.xml.transform.stream.StreamSource"
> ) ) {
>           doc = (new SAXBuilder()).build(
> ((StreamSource)output).getInputStream() );
>           out.output( doc, new FileOutputStream(
> "C:\\TEMP\\wsResponse.xml" ) );
>         } else doc = null;
>
> ...
>
> where "doc" is the input document, and the desired output document.
>
> However, this seems not to work, as I get an exception: "
> org.jdom.input.JDOMParseException: Error on line 2: The prefix "SOAP-ENC"
> for attribute "SOAP-ENC:arrayType" associated with an element type "Result"
> is not bound."
>
> I've tried to read the result using SAXBuilder directly from a file, and
> that works fine, so I presume SAXBuilder doesn't like reading from the
> input source of a stream source. Can anyone suggest a better way of doing
> this?
>
> Yours,
>
> Clint Redwood
> Senior Analyst Programmer - Boots Account
> Xansa
> t 0115 9595730 (Ext) 725730 (Int)
> e clint.redwood@(protected)
> e clint.redwood@(protected)
> http://www.xansa.com
>
>
> Whilst this email has been checked for all known viruses, recipients should undertake their own virus checking as Xansa will not accept any liability whatsoever.
>
> This email and any files transmitted with it are confidential and protected by client privilege. It is solely for the use of the intended recipient.
> Please delete it and notify the sender if you have received it in
> error. Unauthorised use is prohibited.
>
> Any opinions expressed in this email are those of the individual and not
> necessarily the organisation.
>    Xansa, Registered Office: 420 Thames Valley Park Drive,
>    Thames Valley Park, Reading, RG6 1PU, UK.
>    Registered in England No.1000954.
>    t +44 (0)8702 416181
>    w www.xansa.com
> _______________________________________________
> To control your jdom-interest membership:
> http://www.jdom.org/mailman/options/jdom-interest/youraddr@(protected)
>
_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@(protected)
©2008 junlu.com - Jax Systems, LLC, U.S.A.