axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ramesh Sakala" <rsak...@digev.com>
Subject RE: Replace SchemaUtils/DOM with JaxMe's Schema Parser?
Date Mon, 06 Oct 2003 06:47:02 GMT
Hi Srinath/Kalpesh,

If the requirement is to covert a DOM node and SAX events, it can be done with the following
three lines of code (highlighted below) if you have the luxury of using JAXP and a XSLT transformer.
I do not know about the performance impact of this solution, but I can imagine it is not much
worse than any other solution one can come up with.

// Step 1. Create a Transformer by using TransformerFactory.
TransformerFactory factory = TransformerFactory.getInstance();  //not thread-safe. So, has
to be done in the initialization code with a single thread calling this method at a time.
Transformer tr = factor.newTransformer();               // thread-safe. Creates a XSLT transformer
with empty XSLT.
// Step 2. By giving this transformer, A DOMSource and a SAXResult object, do the parse on
the transformer.
SAXResult result = new SAXResult(<content-handler-instance>);
DOMSource source = new DOMSource(<document-root-node or partial-subtree node>);
tr.parse(source, result);       // as part of this parse, Transformer walks thru the DOM tree
and generates the SAX events; which are available to Content handler.

In the below suggestion, Kalpesh Patel is asking to use a marshaller which generates the SAX
events by acting as SAXEventProducer. This Transformer is an example for this kind of a Marshaller.

I use the above technique whenever I need to convert from one form of XML object (stream,
DOM, SAX) to other forms of the same XML object (stream, DOM and SAX). Using this technique,
one can also generate an XMLSerializer which is a implementation-independent and one can change
the providers at run-time as explained in JAXP spec.

Thanks,
Ramesh.

-----Original Message-----
From: Kalpesh Patel [  <mailto:kalpesh@cistemsindia.com> mailto:kalpesh@cistemsindia.com]
Sent: Sunday, October 05, 2003 10:40 PM
To: axis-dev@ws.apache.org; hemapani@vijayaba.cse.mrt.ac.lk
Subject: RE: Replace SchemaUtils/DOM with JaxMe's Schema Parser?


Hi Srinath,

I have no idea of Jaxme but we had a similar requirement in our project. I
dont know how you would do it using Jaxme but can we do it like this.

Our requirement looks like this :-

1)For generating XML buffer from DOM obviously you will marshall
it(serialize it to buffer)
2)The JaxMe will then parse the generated XML and generate the SAX events.
3)the contenthandler will consume these events

Solution:
What if we use a Marshaller which instead of writing XML to a buffer can
directly generate SAX events i.e. work as a SAXEventProducer,the events
produced will then be consumed by the contenthandler.
So the Jaxme parser instead of taking a buffer/inputstream, can take an
EventProducer as an argument.

This is a wild guess as not used Jaxme but hope you can get what i am trying
to say.


Regards
Kalpesh Patel

-----Original Message-----
From: Srinath Perera [  <mailto:hemapani@vijayaba.cse.mrt.ac.lk> mailto:hemapani@vijayaba.cse.mrt.ac.lk]
Sent: Monday, October 06, 2003 11:04 AM
To: axis-dev@ws.apache.org
Subject: Re: Replace SchemaUtils/DOM with JaxMe's Schema Parser?


Hi All,

here is the high level picture of what we are planning to do to fix it.

We want to keep method signatures of SchemaUtils as they are and replace
the logic with jaxme parser.

Q1) is that ok. We do not change the functionality.

Here we want jaxme (it works on SAX) to parse a DOM node ??
We are planning to take a node and serialize it to buffer (add schema
tag's to start and end may be ..) then fed it to jaxme .....

We are using a longer way ... IS IT OK TO USE IT, this may not be the
smartest.
Any other suggestions ......  to fed node into the Jaxme.

we are expecting a answer to move on ...

Srinath



On Tue, 2003-09-30 at 18:52, Srinath Perera wrote:
> Hi All
>
> I think we can start with it ...
>
> I think this is what I understood
>
> 1)  we should get into code that parse DOM nodes in SchemaUtils.java and
> use schema parser to parse them cleanly.
> 2)  we can left the code that get the DOM nodes from the wsdl untouched.
> >> You replace all dom traversal stuff
> Only the parsing of DOM nodes we should worry about.
> 3) leave JaxMe untouched as much as possible
>
>
> we would start it by abut a week. will come back if help needed.
>
> thanks for directions
>
> Srianth
>
>
>
> On Tue, 2003-09-30 at 17:52, Davanum Srinivas wrote:
> > Here's a plan for you all:
> > - Get the latest CVS code for axis
> >   #1: make a copy/zip it up so that you know what you started with
> >   #2: run "ant clean all-tests" to make sure that nothing is broken
> > - Get the latest CVS code for JaxMe
> > - Iteratively make changes to axis's code (and if necessary JaxMe's
code) such that:
> >   #1: You replace all dom traversal stuff in
symbolTable\SchemaUtils.java and other files.
> >   #2: If you run "ant clean all-tests", it should NOT fail
> >   #3: If you compare the results of running "ant clean all-tests"
between the original code and
> > your modified code (do a windiff on build/work directory where all the
generated code is present)
> > they should be EXACTLY the same.
> > - When you are ready, we can create a CVS branch to let everyone review
your work before it gets
> > merged into the HEAD branch
> > - If you need changes to JaxMe stuff, you will need to submit bugzilla
patches as usual, i will
> > work with them to merge the changes needed into their source tree.
> >
> > How does this sound? Do you have enough to get going?
> >
> > Thanks,
> > dims
> >
> > --- Srinath Perera <hemapani@vijayaba.cse.mrt.ac.lk> wrote:
> > > Hi All
> > >
> > > we would like to give it a try. Knows it was bit of a challenge.
> > > Plus we have not work with JaxMe's schema parser. Yet will do our
best.
> > >
> > > How should we do it .. keeping our copy and work on it till we have
> > > something or have it somewhere in CVS so others can have look and help
> > > :). (quite sure help is necessary)
> > >
> > > If all goes well we could start work on it about a week by now.
> > >
> > > regards
> > >
> > > Srianth,Dimuthu,VTPavan,jkumaran
> > >
> > >
> > > On Thu, 2003-09-25 at 21:50, Davanum Srinivas wrote:
> > > > Given the # of bugs we have related to Schema's. Does anyone have
cycles to replace what we
> > > have
> > > > with JaxMe's Schema Parser?
(  <http://ws.apache.org/jaxme/xs/index.html> http://ws.apache.org/jaxme/xs/index.html).
This would involve
> > > fixing
> > > > both our code as well as JaxMe code (if necessary). The first
objective would be to remove all
> > > our
> > > > dependency on DOM parsing/walking (see
org\apache\axis\wsdl\symbolTable\SchemaUtils.java).
> > > This
> > > > work could be done in a separate branch till code is stable enough
so that our "ant clean
> > > > all-tests" works ok.
> > > >
> > > > Anyone up for it?
> > > >
> > > > Thanks,
> > > > dims
> > > >
> > > > =====
> > > > Davanum Srinivas -  <http://webservices.apache.org/~dims/> http://webservices.apache.org/~dims/
> > > >
> > >
> >
> >
> > =====
> > Davanum Srinivas -  <http://webservices.apache.org/~dims/> http://webservices.apache.org/~dims/
> >
>




Mime
View raw message