You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Phil Wright <ph...@gmail.com> on 2006/11/27 21:21:41 UTC

Forcing multiple line breaks in flowRoot/flowPara elements

I'm trying to force a blank line in a flowPara element with the following:

            fpara = document.createElementNS(svgNS, "flowPara");
            // other lines with content are added here
            Element fline = document.createElementNS(svgNS, "flowLine");
            fline.setAttributeNS(null,"xml:space","preserve");
            fline.appendChild(document.createTextNode("&#0x200B;"));
            fpara.appendChild(fline);
            // more content added here

However instead of getting a blank line I get all of the characters ie
"&#0x200B;".

Am I doing it wrong?

Is it because there isn't anything within my svg document associated with
the "xml:" prefix?  If so how do I fix that?

Thanks,

     Phil

-- 
Visit http://www.darkisle.com for photos of castles, cairns and other
historic sites in the British Isles.

Re: Forcing multiple line breaks in flowRoot/flowPara elements

Posted by Phil Wright <ph...@gmail.com>.
Thanks again!

Oh so slowly comprehension is sinking in.

   Phil


On 11/29/06, thomas.deweese@kodak.com <th...@kodak.com> wrote:
>
> Hi Phil,
>
> "Phil Wright" <ph...@gmail.com> wrote on 11/27/2006 03:21:41 PM:
>
> > I'm trying to force a blank line in a flowPara element with the
> following:
> >             fline.appendChild(document.createTextNode("&#0x200B;"));
>
>    This should probably be something like:
>         fline.appendChild(document.createTextNode("" + ((char)0x200B)));
>
> > However instead of getting a blank line I get all of the characters ie
> "&#0x200B;".
>
>    I'm not really sure what char 0x200B is but assuming it's some sort
> of zero width space, the above will generate a String with that character
> in
> it.  The basic problem is that XML entities/literals are handled by the
> XML parser, they don't exist and shouldn't be interpreted in the DOM
> strings.
>
> > Is it because there isn't anything within my svg document associated
> with the
> > "xml:" prefix?  If so how do I fix that?
>
>             fline.setAttributeNS(null,"xml:space","preserve");
>
>    This line also needs to be:
>         fline.setAttributeNS("http://www.w3.org/XML/1998/namespace",
>                            "xml:space", "preserve");
>
>    Once again in DOM you must provide the namespace it
> does not to prefix mapping, that is the parsers responsability.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
>


-- 
Visit http://www.darkisle.com for photos of castles, cairns and other
historic sites in the British Isles.

Re: Forcing multiple line breaks in flowRoot/flowPara elements

Posted by th...@kodak.com.
Hi Phil,

"Phil Wright" <ph...@gmail.com> wrote on 11/27/2006 03:21:41 PM:

> I'm trying to force a blank line in a flowPara element with the 
following:
>             fline.appendChild(document.createTextNode("&#0x200B;"));

   This should probably be something like: 
        fline.appendChild(document.createTextNode("" + ((char)0x200B)));

> However instead of getting a blank line I get all of the characters ie 
"&#0x200B;". 

   I'm not really sure what char 0x200B is but assuming it's some sort 
of zero width space, the above will generate a String with that character 
in
it.  The basic problem is that XML entities/literals are handled by the
XML parser, they don't exist and shouldn't be interpreted in the DOM 
strings.

> Is it because there isn't anything within my svg document associated 
with the 
> "xml:" prefix?  If so how do I fix that?

            fline.setAttributeNS(null,"xml:space","preserve"); 

   This line also needs to be:
        fline.setAttributeNS("http://www.w3.org/XML/1998/namespace", 
                           "xml:space", "preserve");

   Once again in DOM you must provide the namespace it 
does not to prefix mapping, that is the parsers responsability.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org