Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > JAXB, XSLT comparison

Reply
Thread Tools

JAXB, XSLT comparison

 
 
Sony Antony
Guest
Posts: n/a
 
      07-17-2003
We have a situation wherin we should translate the incoming XML based
on one schema to the outgoing XML that is based on another schema.
Since both input and output are both XML, XSLT was the natural
preference.

But there was a requirement that demanded a part of the generated XML
to be different depending on whether an element was present or not in
the incoming XML. Since we were only beginning with XML, we couldn t
find the Xpath xsl:if combination that will generate this logic. ( Can
somebody help me here, though that is not the main topic of this
posting )

So somebody came up with JAXB. We changed the program so that the
incoming XML was converted to Java objects using JAXB. Then there was
the ‘if' statement in java and the result was converted to XML again
using JAXB.
At this time this was thought to be an inefficient ad hoc way of
getting the task done. But then I read more about JAXB and came to
know that JAXB generated code can be as fast as a SAX parser.
Now it appears to me that XSLT might be using DOM parser internally
and that it might be actually slower than the JAXB way.
I know I should do an actual performance comparison to reach any
conclusions. But can somebody theoretically compare which of these
methods will be faster.

Thanks a lot for reading
--sony
 
Reply With Quote
 
 
 
 
Arto V. Viitanen
Guest
Posts: n/a
 
      07-18-2003
>>>>> "Sony" == Sony Antony <> writes:

Sony> We have a situation wherin we should translate the incoming XML based
Sony> on one schema to the outgoing XML that is based on another schema.
Sony> Since both input and output are both XML, XSLT was the natural
Sony> preference.

Sony> But there was a requirement that demanded a part of the generated XML
Sony> to be different depending on whether an element was present or not in
Sony> the incoming XML. Since we were only beginning with XML, we couldn t
Sony> find the Xpath xsl:if combination that will generate this logic. ( Can
Sony> somebody help me here, though that is not the main topic of this
Sony> posting )

XSLT's xsl:if is not like ifs in general programming languages, since it does
not come with xsl:else. Instead, you should use xsl:choose, like

<xsl:choose>
<xsl:when test="nameoftheelement">
<!-- do what you need with the element -->
</xsl:when>
<xsltherwise>
<!-- element does not exist, do what is needed -->
</xsltherwise>
</xsl:choose>


--
Arto V. Viitanen
University of Tampere, Department of Computer and Information Sciences
Tampere, Finland http://www.cs.uta.fi/~av/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Comparison of 2 files and generating the output based on comparison Deepu Perl Misc 1 02-07-2011 03:09 PM
Price Comparison Service. Best Deal. Special Coupon atBest-Price-Comparison.com rapee Digital Photography 0 03-14-2008 06:46 AM
ANN: New low-cost XML Editor, XSLT Editor, XSLT Debugger, DTD/Schema Editor Stylus Studio Java 0 08-03-2004 03:53 PM
[XSLT]Passing values from Javascript to a XSLT variable Benjamin Hillsley XML 3 09-25-2003 04:50 AM
JAXB, XSLT comparison Sony Antony Java 1 07-18-2003 05:57 AM



Advertisments