You need to call it as
URI must be the namespace URI of the attribute, localName the part of the name after the namespace prefix.


Michael Kay

From: Geet Gangwar []
Sent: 30 March 2010 13:01
To: Mailing list for the SAXON XSLT and XQuery processor
Subject: Re: [saxon] NodeInfo object returning null for getAttributeValuemethod

Hi michael

what should be value of uri in Navigator.getAttributeValue(element, uri, localName).

I have passed the values like this: Navigator.getAttributeValue(nodeLine, "", "xlink:type" ) but it is returning me null.



On Tue, Mar 30, 2010 at 4:14 PM, Michael Kay <> wrote:
XQJ doesn't give you much help with this - the only mechanism it provides is to convert the node to a DOM node, which can be rather expensive.
But once you've got a Saxon NodeInfo (which you seem to have achieved successfully), the simplest way to get an attribute value is probably to use the helper method in
Navigator.getAttributeValue(element, uri, localName)
If you want to iterate over all the attributes without knowing their names, use
You can find the line number of an element using node.getLineNumber(), provided line numbers were maintained when building the tree. Line numbers for individual attributes are not maintained.


Michael Kay

From: Geet Gangwar []
Sent: 30 March 2010 10:44
Subject: [saxon] NodeInfo object returning null for getAttributeValue method

Can anybody tell me how can I get the attributes of the node returned.

I have an xml file which contains node named

 <link:schemaRef xlink:type="simple" xlink:href="bvf-20081231.xsd" />
  <link:schemaRef xlink:href="bvf1111-20081231.xsd" xlink:type="tuple"/>

Now i have written a xQuery which return me both the nodes, code is mentioned below:

XQResultSequence xqs = xqe.executeQuery("for $x in /xbrli:xbrl/link:schemaRef return $x");
            SchemaRef objSchemaRef = new SchemaRef();
            SaxonXQItem item = null;
            while ( {
                item = (SaxonXQItem) xqs.getItem();
                if (item.getSaxonItem() instanceof NodeInfo) {
                    NodeInfo node = (NodeInfo) item.getSaxonItem();

How can I get the attributes of the node, even I want to fetch the line numbers also.



Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
saxon-help mailing list archived at