Hi Michael,

Thanks for your reply. To make it simple I am posting a small snippet that I tried.

Processor proc = new Processor(false);
XPathCompiler xpath = proc.newXPathCompiler();

DocumentBuilder builder = proc.newDocumentBuilder();
builder.setLineNumbering(true);
builder.setWhitespaceStrippingPolicy(WhitespaceStrippingPolicy.ALL);
XdmNode doc = builder.build(new File(file));
               
XPathSelector selector = xpath.compile("//Softcp/Infolink/Members[. = \"memberABC\"]").load();
selector.setContextItem(doc);
selector.evaluate();
               
for(XdmItem memberItem : selector) {
        XdmNode memberNode2 = (XdmNode) memberItem; //MemberNode is found here
        XPathSelector selector1 = xpath.compile("Name").load();
        selector.setContextItem(memberNode2);
        selector.evaluate();
       
        for(XdmItem NItem : selector1) {  //error comes here now
                        //do something
        }
}

I hope  DocumentBuilder used here is of same Processor. Also I get a new error :(
org.xml.sax.SAXParseException; systemId: file:/D:/PSCR/; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog
net.sf.saxon.s9api.SaxonApiUncheckedException: The context item for axis step child::Name is undefined

Am i missing something here?


Regards,
Rajath



From:        Michael Kay <mike@saxonica.com>
To:        saxon-help@lists.sourceforge.net
Date:        11/22/2012 05:04 PM
Subject:        Re: [saxon] Supplied node must be built using the same or a compatible Configuration





For "Configuration" here read "Processor", if everything is done using s9api. You should normally only create one Processor object. I strongly suspect that memberNode is built using a DocumentBuilder that belongs to a different Processor. The reason for the rule is that the Processor/Configuration owns the NamePool, and if your source document and XPath using different name pools, the matching of names will not work.

Michael Kay
Saxonica


On 22/11/2012 09:27, Rajath.Sakkari@continental-corporation.com wrote:
Hello,

I am facing this error
Supplied node must be built using the same or a compatible Configuration.

I am using saxon9 and I have not done any complications. Here is what I did.


My Xpath was like this ex: //Softcp/Infolink/Members


I wanted a specific node so I changed it to //Softcp/Infolink/Members[. = ]


Now i got node Members as


XdmNode
memberNode which will have following value Ex:

<Members>

       <
Name>abc</Name>
       .        

       .

       .

</Members>


Now when i try to set only this node as context to get <Name> node


Processor proc = new Processor(false);

XPathCompiler xpathC = proc.newXPathCompiler();

XPathSelector selector = xpathC.compile("
Name").load();
selector.setContextItem(
memberNode); //error come here

What would be the problem here?

or am I doing it right?


What ultimately I wanted to achieve is, I do not want to iterate among thousands of nodes to find one unique node. I want an direct xpath to get that node based on the node value.


Regards,

Rajath


------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov


_______________________________________________
saxon-help mailing list archived at
http://saxon.markmail.org/
saxon-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/saxon-help
------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov_______________________________________________
saxon-help mailing list archived at
http://saxon.markmail.org/
saxon-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/saxon-help