cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "J.Pietschmann" <j3322...@yahoo.de>
Subject Re: [Help]writing SAX Transformer
Date Fri, 27 Feb 2004 18:42:05 GMT
roy huang wrote:
...
> <root>
>     <a>
>         a
>     </a>
>     <b>
>         b
>     </b>
>     <c>
>         c
>     </c>
> </root> 
> if I delete <a> <b> using startRecording the source code turns into:
> <?xml version="1.0" encoding="utf-8"?>
> <root>
> 
> 
>     <c>
>         c
>     </c>
> </root>
> left many blank and tab. How to solve it or I am in the wrong way?
The whitespace is already there in the source (look
carefully). I don't think it hurts, and deleting it
selectively is not all that easy.

> Question 2:
> in the transformer I also and some xinclude tag,like:
>    attr.addAttribute(
>     "http://www.w3.org/2001/XInclude",
>     "href",
>     "href",
>     "CDATA",
>     flowUri);
>    super.startTransformingElement("", "include", "xi:include", attr);
>    super.endTransformingElement("", "include", "xi:include");
>    attr.clear();
> the xml is fine,but can't be transform by XInclude transformer,

I think you missed the namespace for the xi:include element, but
added the href attribute in the namespace instead. Try
    attr.addAttribute(
     "",
     "href",
     "href",
     "CDATA",
     flowUri);
    super.startTransformingElement("http://www.w3.org/2001/XInclude",
     "include", "xi:include", attr);
    super.endTransformingElement("http://www.w3.org/2001/XInclude",
     "include", "xi:include");
instead.
Dealing with namespaced elements and attributes in APIs is
tricky, study the topic carefully.

J.Pietschmann


Mime
View raw message