473,246 Members | 1,848 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,246 software developers and data experts.

JAXB, XSLT comparison

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
Jul 20 '05 #1
1 4236
>>>>> "Sony" == Sony Antony <so********@hotmail.com> 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>
<xsl:otherwise>
<!-- element does not exist, do what is needed -->
</xsl:otherwise>
</xsl:choose>
--
Arto V. Viitanen av@cs.uta.fi
University of Tampere, Department of Computer and Information Sciences
Tampere, Finland http://www.cs.uta.fi/~av/
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: jesper | last post by:
Hi I am currently following the tutorial from IBM (http://www-106.ibm.com/developerworks/xml/edu/x-dw-xjaxb-i.html) I have three problems at the moment. 1. It says else where that when the...
0
by: Mark | last post by:
I'm betting it me. Here is the simple schema I'm using: <?xml version="1.0"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"...
13
by: Christoph Brunner | last post by:
Hi, on the sun homepage i had submit to the bugparade a request for feature enhancement for the JAXB API. After a period of time sun called me to post my request to a newsgroup an get comments...
0
by: Brett Selleck | last post by:
We have an issue where the JAXB generated classes are creating an interface which references itself. The Schema is valid, and I have not seen this ran into before. The code is below. What is...
0
by: Mark | last post by:
I'm betting it me. Here is the simple schema I'm using: <?xml version="1.0"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"...
1
by: Sipayi | last post by:
'lo! Trying to use JAXB for my project. I did the following steps: a. Created xml/xsd/xjb, placed it under "com.foo.blah" b. xjc'd the xmls into "com.foo.blah.jaxb" c. Tried to unmarshal: --...
0
by: ciaran.mchale | last post by:
I used Google to find information about JAXB 2.0 and I ended up downloading a document called "The Java Architecture for XML Binding (JAXB) 2.0: Proposed Final Draft September 30, 2005". ...
0
by: mnsh | last post by:
Hello, I am new to JAXB. So I would like somebody to help me solve this problem. I have a class say Test which contains only a List which has some 6 to 7 user defined objects. I am able to...
0
by: malsh1358 | last post by:
Hi I need check required elements and attributes in JAXB java classes , if there are any value for them place it , otherwise place default value in xml file , because of it I upgrade JAXB2.0 to...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.