Tatu Saloranta wrote:
>After spending 3 days trying to figure out how to do
>simple
>outputting of namespaces using StAX API, I'm almost
>ready to give up. :-)
>Although the example in 1.0 specs seems
>straight-forward enough:
>
>
we do *need* to fix this!!!!
now the tricky part id if we can fix it by clarifying spec and RI or it
is hopeless?
>(a) call setPrefix() for all namespaces you need for
> the _next_ starting element
>(b) call writeStartElement()/writeEmptyElement()
>(c) output all namespaces with writeNamespace()
> (and/or writeDefaultNamespace()
>
>the problem is that RI, for example, does something
>quite different (it lacks step (c) for one; and
>that may be due to step (b) doing actual output...
>or something).
>
>Now, this is specifically WRT non-repairing mode:
>repairing mode has its own issues.
>
>What I'd like two know is answers to following
>questions:
>
>(a) Is calling setPrefix() AND writeNamespace() (plus
> alternatives for the default NS) always obligatory
> in non-repairing mode? Or is setPrefix(), for
>example
> only needed if automatic mapping of URI to prefix
> is needed, but not when 3 arg version is used?
>(b) Independent of how namespace mappings are created,
> what is the scope? Is it the CURRENT element (one
> that's open, ie. last for which writeStartElement
> was called), or the NEXT one (that will next get
> written out)? Sample seems to suggest NEXT (and
> I implemented it that way for Woodstox); this makes
> sense since otherwise there'll be extra work when
> trying to put the root element in a namespace.
>
>
this is place where we need to put clarifications, agree about and
implement in RI and all other StAX parser IMHO.
>I looked at xmlpull, and it is bit clearer in this
>respect. There are no prefix-AND-URI variations
>for writing elements and attributes; and namespace
>bindings always have to be declared before the
>start element. But StAX RI does not work this
>way -- perhaps this is a bug?
>
>In fact, I'm not quite sure what was the added value
>of trying to allow more than one way of doing things
>(in StAX API):
>it also looks like xmlpull basically allows both
>repairing and non-repairing operation, without
>separate modes (either call setPrefix(), to define
>binding, or omit it and binding will be automatically
>created).
>
>
as you mentioned XmlPull: sometimes is handy to have prefix explictly
selected for element if more than one prefix is avaliable fo rthe same
namespace (and this is actually criticial for XML security ...)
alek
--
The best way to predict the future is to invent it - Alan Kay
------------------------ Yahoo! Groups Sponsor --------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/2U_rlB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/xmlpull-dev/
<*> To unsubscribe from this group, send an email to:
xmlpull-dev-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|