You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Sam Fuqua <sa...@gmail.com> on 2009/04/06 13:36:13 UTC

Problems with DOMSource

Hi,

I'm using fop .94.  I'm reading in a .fo file, which is then manipulated by
adding more fo that is generated to the flow "xsl-region-body".  When I try
to transform the DOMSource, I get two errors: that the root node is not a
valid root node and that it must be "fo:root", and that "fo:block" is not a
valid child of "block".  However, if I turn the DOMSource into a string,
everything works fine and I get no errors.  I really need to use as
DOMSource rather than a string, though.  Has anybody had a similar problem?


Sam Fuqua
ΣΝ ΘΗ 454

Re: Problems with DOMSource

Posted by Sam Fuqua <sa...@gmail.com>.
Thank you.  That worked perfectly.

On Mon, Apr 6, 2009 at 12:34 PM, Andreas Delmelle <
andreas.delmelle@telenet.be> wrote:

> On 06 Apr 2009, at 18:23, Sam Fuqua wrote:
>
> Hi Sam
>
>  Yes, I believe you're right, which would explain it not working from the
>> DOM, while it would work from the String.
>> I currently have:
>>
>> Node contentNode = printFeed.createElement("fo:block");
>>
>
> IIRC, then you would need:
> Node contentNode = printFeed.createElementNS("
> http://www.w3.org/1999/XSL/Format", "fo:block");
>
> Just checked in the DOM APIdocs, and there it is explicitly mentioned that
> setting the prefix alone does not influence the namespaceURI.
>
>
>
>
> HTH!
>
> Andreas
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
>


-- 
Sam Fuqua
ΣΝ ΘΗ 454

Re: Problems with DOMSource

Posted by Andreas Delmelle <an...@telenet.be>.
On 06 Apr 2009, at 18:23, Sam Fuqua wrote:

Hi Sam

> Yes, I believe you're right, which would explain it not working from  
> the DOM, while it would work from the String.
> I currently have:
>
> Node contentNode = printFeed.createElement("fo:block");

IIRC, then you would need:
Node contentNode = printFeed.createElementNS("http://www.w3.org/1999/XSL/Format 
", "fo:block");

Just checked in the DOM APIdocs, and there it is explicitly mentioned  
that setting the prefix alone does not influence the namespaceURI.



HTH!

Andreas

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


Re: Problems with DOMSource

Posted by Sam Fuqua <sa...@gmail.com>.
Andreas,

Yes, I believe you're right, which would explain it not working from the
DOM, while it would work from the String.
I currently have:

Node contentNode = printFeed.createElement("fo:block");

where I attach generated FO to contentNode.  How would you recommend doing
the proper namespacing?
Just for more information, printFeed is a Document created from reading an
FO file that has all of the proper namespacing in it.  It is from a
namespace-aware DocumentFactory.

Sam

On Mon, Apr 6, 2009 at 12:13 PM, Andreas Delmelle <
andreas.delmelle@telenet.be> wrote:

> On 06 Apr 2009, at 13:36, Sam Fuqua wrote:
>
> Hi
>
>  I'm using fop .94.  I'm reading in a .fo file, which is then manipulated
>> by adding more fo that is generated to the flow "xsl-region-body".  When I
>> try to transform the DOMSource, I get two errors: that the root node is not
>> a valid root node and that it must be "fo:root", and that "fo:block" is not
>> a valid child of "block".  However, if I turn the DOMSource into a string,
>> everything works fine and I get no errors.  I really need to use as
>> DOMSource rather than a string, though.  Has anybody had a similar problem?
>>
>
> Yes, in another (non-FO) context. Most likely this is related to
> namespaces. Are you adding the elements in the correct namespace, or do you
> just add the 'fo:' prefix and expect that this will magically take care of
> putting the node in the correct namespace?
> In the latter case, tough luck, I'm afraid. You have to take care that the
> additional nodes are added with the correct namespace /URI/ (the prefix
> should be irrelevant).
>
> HTH!
>
> Andreas
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
>


-- 
Sam Fuqua
ΣΝ ΘΗ 454

Re: Problems with DOMSource

Posted by Andreas Delmelle <an...@telenet.be>.
On 06 Apr 2009, at 13:36, Sam Fuqua wrote:

Hi

> I'm using fop .94.  I'm reading in a .fo file, which is then  
> manipulated by adding more fo that is generated to the flow "xsl- 
> region-body".  When I try to transform the DOMSource, I get two  
> errors: that the root node is not a valid root node and that it must  
> be "fo:root", and that "fo:block" is not a valid child of "block".   
> However, if I turn the DOMSource into a string, everything works  
> fine and I get no errors.  I really need to use as DOMSource rather  
> than a string, though.  Has anybody had a similar problem?

Yes, in another (non-FO) context. Most likely this is related to  
namespaces. Are you adding the elements in the correct namespace, or  
do you just add the 'fo:' prefix and expect that this will magically  
take care of putting the node in the correct namespace?
In the latter case, tough luck, I'm afraid. You have to take care that  
the additional nodes are added with the correct namespace /URI/ (the  
prefix should be irrelevant).

HTH!

Andreas

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