473,472 Members | 1,727 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Xalan using generic DOM structures..

Hi All,

I am planning to use Xalan to transform XML data by applying xls
stylesheets.

Here tricky part is, Xalan provides several C++ APIs, which are very
much useful if our requirement is just inputting a file and getting a
file. Or giving a xerces dom and get a new xerces dom.

I would like to know whether any of you tried with their own custom
made DOM structures and used Xalan to transform them ?

I would like to know, is there any way, by which one of the methods
like transform throw SAX events by which we can build our DOM
structures ? And in the same way input also using SAX events. (insteas
of taking certain formatted DOMs and returning fixed DOM structures).

If any of you tried Xalan for such requirements, I request you to
throw some pointers on this topic. I appreciate your help in this
regards.

Thanks
Ganesh
Jul 20 '05 #1
7 2115
Ganesh Gella wrote:
Hi All,

I am planning to use Xalan to transform XML data by applying xls
stylesheets.

Here tricky part is, Xalan provides several C++ APIs, which are very
much useful if our requirement is just inputting a file and getting a
file. Or giving a xerces dom and get a new xerces dom.

I would like to know whether any of you tried with their own custom
made DOM structures and used Xalan to transform them ?

I would like to know, is there any way, by which one of the methods
like transform throw SAX events by which we can build our DOM
structures ? And in the same way input also using SAX events. (insteas
of taking certain formatted DOMs and returning fixed DOM structures).

If any of you tried Xalan for such requirements, I request you to
throw some pointers on this topic. I appreciate your help in this
regards.

Thanks
Ganesh


I do not really understand your question.

You want XML to be transformed with an XSL to an other XML format?
is that right?

Xalan can do the transformation process for you,
i do not see what the problem is.

I think you mean, you want to have some control over the transformation
process, am i right?

Give an example please.
Jul 20 '05 #2
Hi,

Thanks for your reply.
Let me try to explain the problem in some detail now.

Yes, my intention is to xonvert one XML document to another using XLS.
And Xalan has some C++ APIs for it.

Xalan accepts a xml file, a stream and a xerces dom object also (using
parserliason,domsupport classes) as an input and gives the result in
XSLTResultTarget class.

Here my problem is, our code is already having it's own DOM object
(different from xerces DOM) which is constructed based on SAX events.

I wanted to know how to plug-in this DOM object to Xalan's transform
methods so that I can use it's transform capabilities.

It has built-in methods to transform, xerces doms, I wanted to know is
there any way we can plug in our own DOM objects and get the output in
may be xerces dom or in the same format that we need.

Or in other words, my question can be phrased like this,

Do xalan transform methods always require a already built-in DOM objects
? Can transform methods accept SAX events ? such that it itself creates
the dom and throws us resultant sax events ? (Once it throws the sax
events, we can build our own DOM (like xerces DOM).

Your inputs and ideas are highly appreciated in this regard.

Thanks and Regards
Ganesh Gella

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #3
Hi,

Thanks for your reply.
Let me try to explain the problem in some detail now.

Yes, my intention is to xonvert one XML document to another using XLS.
And Xalan has some C++ APIs for it.

Xalan accepts a xml file, a stream and a xerces dom object also (using
parserliason,domsupport classes) as an input and gives the result in
XSLTResultTarget class.

Here my problem is, our code is already having it's own DOM object
(different from xerces DOM) which is constructed based on SAX events.

I wanted to know how to plug-in this DOM object to Xalan's transform
methods so that I can use it's transform capabilities.

It has built-in methods to transform, xerces doms, I wanted to know is
there any way we can plug in our own DOM objects and get the output in
may be xerces dom or in the same format that we need.

Or in other words, my question can be phrased like this,

Do xalan transform methods always require a already built-in DOM objects
? Can transform methods accept SAX events ? such that it itself creates
the dom and throws us resultant sax events ? (Once it throws the sax
events, we can build our own DOM (like xerces DOM).

Your inputs and ideas are highly appreciated in this regard.

Thanks and Regards
Ganesh Gella

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #4
Ganesh Gella wrote:
Hi,

Thanks for your reply.
Let me try to explain the problem in some detail now.

Yes, my intention is to xonvert one XML document to another using XLS.
And Xalan has some C++ APIs for it.
I'm not excellent C++ programmer,
but i know java well, and object oriented design principles,
so i think i can help.

Xalan accepts a xml file, a stream and a xerces dom object also (using
parserliason,domsupport classes) as an input and gives the result in
XSLTResultTarget class.

Here my problem is, our code is already having it's own DOM object
(different from xerces DOM) which is constructed based on SAX events.
Ok, so: you have your own Node classes?
Your own Element classes?

Is that right?

I wanted to know how to plug-in this DOM object to Xalan's transform
methods so that I can use it's transform capabilities.
Well, if you have your own Dom (Node, Element,Attribute) classes
then that is impossible *i think*.

Unless:

first, why do you have your own Dom classes?
Probably to give some extended functionality.

But if you want to give Dom classes extended functionality,
you should subclass the XalanNode classes [ XalanElement etc]
wich you want to have more functionality.
It has built-in methods to transform, xerces doms, I wanted to know is
there any way we can plug in our own DOM objects and get the output in
may be xerces dom or in the same format that we need.

Then *i think* you can transform it using Xalan XSLT processor.
You get a Xerces dom in return.

Or in other words, my question can be phrased like this,

Do xalan transform methods always require a already built-in DOM objects
? Can transform methods accept SAX events ? such that it itself creates
the dom and throws us resultant sax events ? (Once it throws the sax
events, we can build our own DOM (like xerces DOM).
I do not know much about events in xalan, so i cant help you there.

Your inputs and ideas are highly appreciated in this regard.

Thanks and Regards
Ganesh Gella

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 20 '05 #5
Ganesh Gella wrote:
Hi,

Thanks for your reply.
Let me try to explain the problem in some detail now.

Yes, my intention is to xonvert one XML document to another using XLS.
And Xalan has some C++ APIs for it.

Xalan accepts a xml file, a stream and a xerces dom object also (using
parserliason,domsupport classes) as an input and gives the result in
XSLTResultTarget class.

Here my problem is, our code is already having it's own DOM object
(different from xerces DOM) which is constructed based on SAX events.

I wanted to know how to plug-in this DOM object to Xalan's transform
methods so that I can use it's transform capabilities.

Take a look at how the Xerces-C DOM is wrapped by looking at the
"wrapper" classes in the XercesParserLiaison source directory. However,
it's not a trivial undertaking, that's for sure. If your "DOM" is close
to a standard DOM, you can probably do a "cut-and-paste" approach, and
have your wrapper working pretty quickly.
It has built-in methods to transform, xerces doms, I wanted to know is
there any way we can plug in our own DOM objects and get the output in
may be xerces dom or in the same format that we need.

Or in other words, my question can be phrased like this,

Do xalan transform methods always require a already built-in DOM objects
? Can transform methods accept SAX events ? such that it itself creates
the dom and throws us resultant sax events ? (Once it throws the sax
events, we can build our own DOM (like xerces DOM).
Xalan-C will either use its default source tree implementation, which
you can build by parsing a source file with the parser, or through
sending your own SAX2 events. See the DocumentBuilder sample for more
information on how you can do that. Xalan-C always works best with its
default source tree implementation, which is optimized for XSLT.
Xalan-C always builds the entire tree into memory.

As for output, take a look at what you can provide to the constructor of
XSLTResultTarget. One of those things is a class called
FormatterListener, which is like a SAX DocumentHandler. If you want the
output as events, you can create your own derivative of that, and do
what you want with the events.

Your inputs and ideas are highly appreciated in this regard.


You should consider joining one of the Xalan-C mailing list and posting
your questions there. You will get far faster and more detailed replies
there.

Dave
Jul 20 '05 #6
Hi Dave,

Thanks for your reply. On the output side it is some what clear to me on
how to move ahead.
As you said, creating a new calss(in similare lines of
FormatterToXercesDOM) that implements FormatterListener is the way to
go.

Then my new class can be given to the constructor of XSLTResultTarget.

I will try to implement this and see how far I can get through.

On the input side, I am still having doubts on how I can pump the events
to xalan and ask it to do the transform from there on..

Let me first start with creating FormatterLister like class and then get
back to you with further questions.

Thanks
Ganesh

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #7
Hi All,

I started exploring on the output side and creating my own DOM
structure using Xalan's transform method.

As discussed in the group before, I am depending on XSLTResultTarget
class for this. This class accepts a FormatterToXercesDOM class in its
constructor. FormatterToXercesDOM is derived from an abstract class
FormatterLister, which is a class derived from DocumentHandler.

So here I created a new class that is derived from FormatterListener
and passes on the events to another clas that is derived from
ContentHandler. (The existing parser in my code is derived from
ContentHandler).

Here I came across following problem,

all parsers that derive from DocumentHandler are using AttributeList
objects and all those who derive from ContentHandler are using
Attributes class. The major difference is, Attributes does not have
URI,QName explicitely.

Now I need to bridge AttributeList class to Attributes class. I would
like to know whether any of you worked on a similar problem before and
have some clues on converting attributelist class to attributes ?

Any pointers and help is highly appreciated.

Thanks
Ganesh

Tjerk Wolterink <tj***@wolterinkwebdesign.com> wrote in message news:<41***********************@news.wanadoo.nl>.. .
Ganesh Gella wrote:
Hi,

Thanks for your reply.
Let me try to explain the problem in some detail now.

Yes, my intention is to xonvert one XML document to another using XLS.
And Xalan has some C++ APIs for it.


I'm not excellent C++ programmer,
but i know java well, and object oriented design principles,
so i think i can help.

Xalan accepts a xml file, a stream and a xerces dom object also (using
parserliason,domsupport classes) as an input and gives the result in
XSLTResultTarget class.

Here my problem is, our code is already having it's own DOM object
(different from xerces DOM) which is constructed based on SAX events.


Ok, so: you have your own Node classes?
Your own Element classes?

Is that right?

I wanted to know how to plug-in this DOM object to Xalan's transform
methods so that I can use it's transform capabilities.


Well, if you have your own Dom (Node, Element,Attribute) classes
then that is impossible *i think*.

Unless:

first, why do you have your own Dom classes?
Probably to give some extended functionality.

But if you want to give Dom classes extended functionality,
you should subclass the XalanNode classes [ XalanElement etc]
wich you want to have more functionality.

It has built-in methods to transform, xerces doms, I wanted to know is
there any way we can plug in our own DOM objects and get the output in
may be xerces dom or in the same format that we need.

Then *i think* you can transform it using Xalan XSLT processor.
You get a Xerces dom in return.

Or in other words, my question can be phrased like this,

Do xalan transform methods always require a already built-in DOM objects
? Can transform methods accept SAX events ? such that it itself creates
the dom and throws us resultant sax events ? (Once it throws the sax
events, we can build our own DOM (like xerces DOM).


I do not know much about events in xalan, so i cant help you there.

Your inputs and ideas are highly appreciated in this regard.

Thanks and Regards
Ganesh Gella

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 20 '05 #8

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

Similar topics

5
by: al dav | last post by:
Hi all ok i am not a java programmer I am a sys-admin, my users want xalan and have already got j2sdk_1.4.2 so i have downloaded it and set the CLASS_PATH export...
0
by: Guillaume Jeudy | last post by:
Hi, I'm trying to serialize a DOM constructed from the following URL which is subject to change very frequently: ...
1
by: Fisch von Gestern | last post by:
I have tried to run the extension function/element examples provided with the Xalan-J download. I believe that my classpath is correct, and that my versions are up-to-date. However, I can't get...
1
by: Jo | last post by:
Hello, What am I doing wrong ? I always end up with an exception regardless of the provided XML/XSLT (although to ensure the correctness of the provide input files I've used the ones which comes...
5
by: John | last post by:
I'm trying to generate HTML using a SAX TransformHandler. The problem I'm having is related to the xalan transformer using the shorthand notation when it writes out an empty textarea tag. My...
7
by: RC | last post by:
First, let me say I couldn't find a group discuss XML/XSLT. So I only choose the closest groups to post this message. Here is part of my *.xsl file <xsl:stylesheet...
0
by: terry.jeske | last post by:
Hello, I am trying to upgrade an application that was previously running on Xalan 1.4.2, to 2.7.0. I have worked out the build issues and now the application compiles with the new xalan and...
3
by: Avalon1178 | last post by:
Hi, I recently downloaded the xalan-c source code in http://mirrors.ccs.neu.edu/Apache/dist/xml/xalan-c I followed the instructions from the apache site on how to build it (I already have...
2
by: henribastien | last post by:
I'm trying to return an array from a xalan extension but so far I have made no progress. What I would like to return is something like that <entry id="red">201</entry> <entry...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.