Samisa Abeysinghe wrote:
Aleksander Slominski wrote:
Samisa Abeysinghe wrote:
I am running into several problems while trying to implement the
XMLStreamWriter API for guththila.
Mainly, we need a stack (to push and pop elements), and a hash map
(to validate namespaces)
i think it is possible to implement the same functionality with just
few arrays to record positions for push/pop namespace context and do
linear scan of an array that has prefix->namespace mapping instead
of hashmap - also you do not need to implement StAX xml stream writer
instead use simpler XmlPull.org subset that is more C friendly - for
example see XPP3 (this should be very easy to translate into C - even
though code is in Java the impl uses arrays and it is just one class):
http://www.extreme.indiana.edu/viewcvs/~checkout~/XPP3/java/src/java/serializer_impl/org/xmlpull/mxp1_serializer/MXSerializer.java
Thanks for the tip. I was trying to do the the same yesterday and
realized that I would need to do realloc in case my array runs out of
space. Then after a while I realized instad of focusing on what needs
to be done in stream writer I was writing more hash/stack manipulation
code.
that code is in my MXSerializer already just replace System.arrayCopy
with little memcpy (should be even faster than in Java as no type slot
checking is done)
What I would do for the time being is to use APR because I need to
jump into serializing ASAP. We could revisit the implementation later
and replace APR containers with whatever desired containers.
if you do not use hashmaps you actually get faster and smaller memory
footprint serializer for typical usage when only few prefixes are
declared - no hashtable buckets needs to be allocated and lookup is fast
linear search - if interning/has is used when searching in arrays - this
is also already in MXSerializer which uses string interning - see
getPrefix() and how i can use == instead of equals() - this could be
also done with very fast very simple hashing to make very fast scan for
prefixes.
HTH,
alek
HTH,
alek
I cannot use the current stack defined in Guththila as I cannot
store generic data in it.
I have both stack (i.e. push/pop arrays) and hash map in APR, but I
am wondering if the use of APR in guththila would be a good idea.
Otherwise I would have to write a stack and a hash map (stack is
simple but not the hash map :( )
Is it OK if I use APR for Guththila XMLStreamWriter?
Thoughts please...
P.S. I am kind of stuck without XMLStreamWriter in Guththila as we
must have it to serialize OM.
Thanks,
Samisa...
Dinesh Premalal wrote:
Hi,
On 9/28/05, *Samisa Abeysinghe* <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>> wrote:
Hi Dinesh,
Any plans to implement the writer API in guththila?
We are very badly in need of a writer API for seralizing in
AXIOM
since writer api need for implement serializing in AXIOM I will
look on it.
thanks,
Dinesh
Thanks,
Samisa...
--
W.Dinesh Premalal
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
http://www.cse.mrt.ac.lk/~premalwd/
<http://www.cse.mrt.ac.lk/%7Epremalwd/>
--
The best way to predict the future is to invent it - Alan Kay