[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Passing XML Tree to a java method as String.

Subject: RE: Passing XML Tree to a java method as String.
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Sat, 15 Jul 2006 06:37:35 +0100
xml to string java
> I just wanted to mentioned, that I have tried the technique 
> below with Saxon, and it worked all right. Other processors 
> like Xalan-J might be using a different convention.

By saying it "worked all right", I think you mean it did something which
matched your guess as to what the OP wanted. In general though I don't think
that the effect of calling the Java toString() method on a Saxon node is
well-defined or predictable.

Michael Kay
http://www.saxonica.com/


> 
> Regards,
> Mukul
> 
> On 7/14/06, Mukul Gandhi <gandhi.mukul@xxxxxxxxx> wrote:
> > Hi Omar,
> >  Please try something like this:
> >
> > <xsl:stylesheet version="2.0"
> > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> > xmlns:String="http://www.sun.com/java.lang.String">
> >
> > <xsl:template match="/">
> >   <xsl:variable name="myxml">
> >      <xsl:copy-of select="env:Envelope/env:Body/*" />
> >   </xsl:variable>
> >   <xsl:value-of 
> > select="JavaClassRef:javaMethod(String:toString($myxml))" /> 
> > </xsl:template>
> >
> > </xsl:stylesheet>
> >
> > Regards,
> > Mukul
> >
> > On 7/14/06, Omar Saeed <omar.saeed.email@xxxxxxxxx> wrote:
> > > Hi,
> > >
> > > I have a SOAP Message in the XSL template and need to pass 
> > > everything inside the Body element to a java method that 
> takes a String.
> > >
> > > When I do the following:
> > > <xsl:template match="/">
> > >        <xsl:variable name="myxml">
> > >                <xsl:copy-of select="env:Envelope/env:Body/*" />
> > >        </xsl:variable>
> > >
> > >        <xsl:value-of select="JavaClassRef:javaMethod($myxml)" /> 
> > > </xsl:template>
> > >
> > > In the javaMethod I get only the values inside the 
> elements passed.
> > > How can I pass everything including the elements that are 
> inside the 
> > > Body element as String (the entire XML structure as String)? Do I 
> > > need to convert the XML to String?
> > > Or is it more a question of deserializing the XML ? How do I do 
> > > this, are there any libraries that provide this?
> > >
> > > Any help much appreciated.
> > > Omar

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.