[ops-user] String to XML

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[ops-user] String to XML

daniele.stroppa
[ops-user] String to XML

Hi all,

I'm getting some troubles in parsing a string into XML. I'm calling a web-service and the response I get looks like this

<ns4:getConfigurationXMLResponse xmlns:ns4="http://www.atkinsglobal.com/inform/configmanager/types">&lt;name&gt;JourneyTimeTrend&lt;/name&gt; &lt;name&gt;PersonalJourneyTimeTrend&lt;/name&gt;</ns4:getConfigurationXMLResponse>

What I need to get is

<ns4:getConfigurationXMLResponse>
        <name>JourneyTimeTrend</name>
        <name>PersonalJourneyTimeTrend</name>
</ns4:getConfigurationXMLResponse>

I've tried with different xsl transformations, the ones suggested in the FAQ and in the mailing list, but keep on getting this error:

The markup in the document following the root element must be well-formed.

Any help?

thanks

Daniele Stroppa
Graduate Software Engineer - Information Solutions Consultancy
Intelligent Transport Systems
Atkins Highways and Transportation

Woodcote Grove, Ashley Road, Espom, Surrey, KT18 5BW
Tel: +44 (0)1372 756726
Mob: +44 (0)7981 670012
E-mail: [hidden email]
www.atkinsglobal.com/its



This email and any attached files are confidential and copyright protected. If you are not the addressee, any dissemination of this communication is strictly prohibited. Unless otherwise expressly agreed in writing, nothing stated in this communication shall be legally binding.



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: [ops-user] String to XML

Alessandro  Vernet
Administrator
Hi Daniele,

I guess you are trying to call saxon:parse() from XSLT, which won't
work in this case, because you don't have a single root element in the
document. In cases like this you can concatenate a "<gaga>" before the
string and a </gaga> after the string before parsing. See an example
in the pipeline below:

<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
          xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
          xmlns:oxf="http://www.orbeon.com/oxf/processors">

    <p:param name="data" type="output"/>

    <p:processor name="oxf:xslt">
        <p:input name="data">
            <ns4:getConfigurationXMLResponse

xmlns:ns4="http://www.atkinsglobal.com/inform/configmanager/types">
                &lt;name&gt;JourneyTimeTrend&lt;/name&gt;
                &lt;name&gt;PersonalJourneyTimeTrend&lt;/name&gt;
            </ns4:getConfigurationXMLResponse>
        </p:input>
        <p:input name="config">
            <result xsl:version="2.0" xmlns:saxon="http://saxon.sf.net/">
                <xsl:copy-of select="saxon:parse(concat('&lt;gaga>',
/*, '&lt;/gaga>'))/gaga/*"/>
            </result>
        </p:input>
        <p:output name="data" ref="data"/>
    </p:processor>

</p:config>

I hope this helps,

Alex

On 8/8/06, Stroppa, Daniele <[hidden email]> wrote:

>
>
>
> Hi all,
>
> I'm getting some troubles in parsing a string into XML. I'm calling a
> web-service and the response I get looks like this
>
> <ns4:getConfigurationXMLResponse
> xmlns:ns4="http://www.atkinsglobal.com/inform/configmanager/types">&lt;name&gt;JourneyTimeTrend&lt;/name&gt;
> &lt;name&gt;PersonalJourneyTimeTrend&lt;/name&gt;</ns4:getConfigurationXMLResponse>
>
> What I need to get is
>
> <ns4:getConfigurationXMLResponse>
>         <name>JourneyTimeTrend</name>
>         <name>PersonalJourneyTimeTrend</name>
> </ns4:getConfigurationXMLResponse>
>
> I've tried with different xsl transformations, the ones suggested in the FAQ
> and in the mailing list, but keep on getting this error:
>
> The markup in the document following the root element must be well-formed.
>
> Any help?
>
> thanks
>
> Daniele Stroppa
> Graduate Software Engineer - Information Solutions Consultancy
> Intelligent Transport Systems
> Atkins Highways and Transportation
>
> Woodcote Grove, Ashley Road, Espom, Surrey, KT18 5BW
> Tel: +44 (0)1372 756726
> Mob: +44 (0)7981 670012
> E-mail: [hidden email]
> www.atkinsglobal.com/its
>
>
>
> This email and any attached files are confidential and copyright protected.
> If you are not the addressee, any dissemination of this communication is
> strictly prohibited. Unless otherwise expressly agreed in writing, nothing
> stated in this communication shall be legally binding.
>
> --
> You receive this message as a subscriber of the [hidden email]
> mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>
>
>

--
Blog (XML, Web apps, Open Source):
http://www.orbeon.com/blog/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet