cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <sylv...@apache.org>
Subject Re: Generator to transformer question
Date Wed, 09 Nov 2005 15:59:54 GMT
Ross McDonald wrote:
>
> Hi Sylvain,
>
> by  'location of the xml source' I mean for example if I generate on a 
> file called test.xml,
> can I determine where this file resides, so is the fact that the file 
> was called test.xml (and it lived in testfolder) during generation 
> available to me in the transformer? Does that sound useful for looking 
> into the ContentHandler.setLocator() event?

Yes, that's definitely what you need.

In your transformer, implement setLocator(locator), keep that object in 
a member of the class, and use locator.getSystemId(), 
locator.getLineNumber(), etc.

Beware, though, that setLocator may be called zero, one or more times, 
as defined by the SAX specification.

Sylvain

-- 
Sylvain Wallez                        Anyware Technologies
http://people.apache.org/~sylvain     http://www.anyware-tech.com
Apache Software Foundation Member     Research & Technology Director


Mime
View raw message