You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Ovidiu Predescu <ov...@cup.hp.com> on 2001/05/30 23:16:13 UTC

Re: [Xalan2J PATCH] File, line, column number information for XML source document

Hi,

I know you guys are very busy, I just wanted to check whether you had
a chance to check out the patch I submitted. I would be interested in
your opinions.

Best regards,
-- 
Ovidiu Predescu <ov...@cup.hp.com>
http://orion.nsr.hp.com/ (inside HP's firewall only)
http://www.geocities.com/SiliconValley/Monitor/7464/ (GNU, Emacs, other stuff)

On Thu, 24 May 2001 12:03:08 -0700, Ovidiu Predescu <ov...@cup.hp.com> wrote:

> Hi,
> 
> The following patch adds file, line and column number information of
> XML source documents in Xalan2J.
> 
> This information is stored in a hash table and is generated only if
> Xalan is run with the -L option in the command line. It can also be
> setup programmatically by setting up a property on the TransformerImpl
> instance. There is no runtime or memory overhead if this property is
> not setup on a transformer.
> 
> There are two ways one can obtain XML source node information. The
> first is from within a stylesheet, like below:
> 
> <xsl:stylesheet
>   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>   xmlns:nodeinfo="xalan://org.apache.xalan.lib.NodeInfo"
>   version="1.0">
> 
> <xsl:template match="*">
>  //node <xsl:value-of select="name()"/>
>  //file <xsl:value-of select="nodeinfo:systemId()"/>
>  //line <xsl:value-of select="nodeinfo:lineNumber()"/>
>  //column <xsl:value-of select="nodeinfo:columnNumber()"/>
>  <xsl:apply-templates/>
> </xsl:template>
> 
> </xsl:stylesheet>
> 
> If no arguments are passed to the systemId(), lineNumber() or
> columnNumber() functions, the corresponding information of the current
> context node is returned. A node can be passed as argument to the
> above functions, in which case the corresponding information about
> that node is returned. If a node set containing multiple nodes is
> passed as argument, only the information of the first node in the set
> is returned.
> 
> The second way of obtaining the position information of a source node
> is programmatic. Given a Node instance, one could obtain the owner
> document, which is an instance of DocumentImpl, and invoke the
> getSourceLocatorFor() method. The following example extracted from the
> modified PrintTraceListener shows this:
> 
>       Node sourceNode = ev.m_sourceNode;
>       DocumentImpl owner = (DocumentImpl)sourceNode.getOwnerDocument();
>       SourceLocator locator = owner.getSourceLocatorFor(sourceNode);
> 
> 
> There are two patches attached. The first contains the changes to the
> Xalan2J source code relative to the CVS source code as of today. The
> second patch contains an XML and an XSL stylesheet test files.
> 
> Please let me know if you find any problems with the source code. Of
> course, I'm interested in seeing the code integrated with Xalan2 as I
> want to make use of it in two projects immediately.


Re: [Xalan2J PATCH] File, line, column number information for XML source document

Posted by Gary L Peskin <ga...@firstech.com>.
Ovidiu --

I looked over your changes last week and I am very impressed.  I was
going to go over things in detail but then my cvs authority got messed
up and then there was Memorial Day and then I ended up up(?)grading to
Win2k on my machine so I've been a little out of commission.

However, I'm back at full strength now.

I had a few smaller comments but the main problem that I see is that
stree is going away very, very soon in favor of the new DTM that Scott
et al have been working so hard on.

The stree package classes will probably be deprecated this week and then
will go away with the next release or so.  Therefore, it doesn't seem
like it would be appropriate to make these changes.  When the DTM stuff
gets merged onto the main branch, it would be the right time to review
these changes.

I feel badly because you obviously did a lot of work and I think that
this enhancement is badly needed for some situations and I'd like to
include the extension functions in the Xalan standard extensions.

I'd be happy to work with you in porting this over to the DTM model
and/or reviewing and committing the changes that you come up with.

Gary

Ovidiu Predescu wrote:
> 
> Hi,
> 
> I know you guys are very busy, I just wanted to check whether you had
> a chance to check out the patch I submitted. I would be interested in
> your opinions.
> 
> Best regards,
> --
> Ovidiu Predescu <ov...@cup.hp.com>
> http://orion.nsr.hp.com/ (inside HP's firewall only)
> http://www.geocities.com/SiliconValley/Monitor/7464/ (GNU, Emacs, other stuff)