473,785 Members | 2,255 Online
Bytes | Software Development & Data Engineering Community
+ 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 2146
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,do msupport classes) as an input and gives the result in
XSLTResultTarge t 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,do msupport classes) as an input and gives the result in
XSLTResultTarge t 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,do msupport classes) as an input and gives the result in
XSLTResultTarge t 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,Attribu te) 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,do msupport classes) as an input and gives the result in
XSLTResultTarge t 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 XercesParserLia ison 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
XSLTResultTarge t. One of those things is a class called
FormatterListen er, 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
FormatterToXerc esDOM) that implements FormatterListen er is the way to
go.

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

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 XSLTResultTarge t
class for this. This class accepts a FormatterToXerc esDOM class in its
constructor. FormatterToXerc esDOM 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 FormatterListen er
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***@wolterin kwebdesign.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,do msupport classes) as an input and gives the result in
XSLTResultTarge t 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,Attribu te) 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
4031
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 CLASS_PATH=/usr/local/java/xalan-j_2_5_2/bin/xalan.jar:/usr/local/java/xalan -j_2_5_2/bin/xml-apis.jar:/usr/local/java/xalan-j_2_5_2/bin/xercesImpl.jar:/
0
1492
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: http://www.bbc.co.uk/syndication/feeds/news/ukfs_news/world/asia-pacific/rss091.xml I sometimes receive this error: java.lang.NullPointerException:
1
2309
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 past the following error. Any help, please? =========================================================================== C:\xalan>test C:\xalan>REM @echo off
1
2467
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 with the xalan samples). Is it a memory mishandling error ? I'm using Xerces 2.4 C++ / Xalan 1.7 C++ and VC6 to compile the code : #include <iostream>
5
1782
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 code works fine when xalan.jar is not in my classpath. But when xalan.jar is in the classpath, the generated html incorrectly uses the shorthand notation for writing out an empty textarea tag. Correct output: C:\test>java Test
7
4126
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 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xalan="http://xml.apache.org/xalan" xmlns:my-javascript-ext="my-ext1" extension-element-prefixes="my-javascript-ext"
0
1200
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 xerces. However, at runtime I get the following error when I try to do a transform: (Location of error unknown)org.xml.sax.SAXException: Can not resolve
3
1843
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 xerces downloaded and compiled), however, I'm getting quite a few compile errors. I downloaded and compiled xerces 2.6.0 and I downloaded xalan 1.9.0.
2
1514
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 id="green>55</entry> <entry id="blue">123</entry> so I could acces them with something like $returned. Problem is, I haven't figured out how to do that. I haven't found any
0
9481
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10341
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10155
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10095
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9954
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6741
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5383
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4054
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 we have to send another system
3
2881
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.