baseURI of document built with BuildingContentHandler?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

baseURI of document built with BuildingContentHandler?

Jorge Williams-2
Hello all,

I’m using Saxon 9.7.0-8.  Trying to build a document via SAX by first creating a DocumentBuilder, then a BuildingContentHandler, then directing SAX events to that.   The resulting document needs to be processed by an XSLT after it’s built and  makes references to other external documents so it’s important that baseURI gets set correctly…but not sure how to do this.  I’ve tried:

1.  Setting baseURI on the DocumentBulider.
2.  Setting a DocumentLocator on BulidingContentHandler which returns the correct system id.
3.  Calling getDocumentNode().asSource and setting the SystemId on the source before processing

None of these techniques work.  What am I missing?


Thanks,

-jOrGe W.

------------------------------------------------------------------------------
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: baseURI of document built with BuildingContentHandler?

Michael Kay
I think that (1) should work, but it doesn't: raised as bug

https://saxonica.plan.io/issues/3032

I'm not sure about (2) because the DocumentLocator is about where the data comes from, which doesn't directly say anything about the document you are constructing.

As regards (3), it seems questionable because nodes should be immutable once created. But I haven't investigated what actually happens if you do this.

Michael Kay
Saxonica


> On 14 Nov 2016, at 21:17, Jorge Williams <[hidden email]> wrote:
>
> Hello all,
>
> I’m using Saxon 9.7.0-8.  Trying to build a document via SAX by first creating a DocumentBuilder, then a BuildingContentHandler, then directing SAX events to that.   The resulting document needs to be processed by an XSLT after it’s built and  makes references to other external documents so it’s important that baseURI gets set correctly…but not sure how to do this.  I’ve tried:
>
> 1.  Setting baseURI on the DocumentBulider.
> 2.  Setting a DocumentLocator on BulidingContentHandler which returns the correct system id.
> 3.  Calling getDocumentNode().asSource and setting the SystemId on the source before processing
>
> None of these techniques work.  What am I missing?
>
>
> Thanks,
>
> -jOrGe W.
>
> ------------------------------------------------------------------------------
> _______________________________________________
> saxon-help mailing list archived at http://saxon.markmail.org/
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/saxon-help


------------------------------------------------------------------------------
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Loading...