You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by buzzonus <bu...@yahoo.com> on 2001/05/02 00:49:43 UTC
validation and xpath problem
Hi,
I am using xerces 1.3.0 and am running into a problem where the XPathAPI.selectNodeList does
not return the expected nodes when I parse an xml file with ""http://xml.org/sax/features/validation" feature turned on. It works fine when this feature is disabled, i.e. set to false.Is this a know bug or I a missing something ?
Because if this problem, I now have to parse the file twice to get it into a dom..first with validation turned on and then with validation turned off (in the case when validation is a success)..this impact the the overall response time in my application.
here is what my test code look like :
....
DOMParser parser = new DOMParser();
parser.setFeature( "http://xml.org/sax/features/namespaces",
true);
parser.setFeature( "http://xml.org/sax/features/validation",
validation);
parser.setFeature( "http://apache.org/xml/features/validation/schema",
true );
parser.parse(pData2);
doc = parser.getDocument();
if (doc != null)
{
Element elm = doc.getDocumentElement();
if (el != null)
{
System.out.println("docs root element tag name ="+elm.getTagName());
try
{
NodeList nodes = XPathAPI.selectNodeList(doc,
new String("descendant::tiger"));
if (nodes == null)
{
System.out.println("did not find our tiger element");
}
else
System.out.println("found "+nodes.getLength()+" tiger elements");
}
.....
Here is the output for my sample xml:
1)with validation set to true:
docs root element tag name =abc
found 2 tiger elements
2)with validation set to false:
docs root element tag name =abc
found 0 tiger elements
any feedback would be appreciated.
thanks.
Re: validation and xpath problem
Posted by Christian Geuer-Pollmann <ma...@nue.et-inf.uni-siegen.de>.
Hi,
first, you should ask this to the Xalan Mailing List, because XPathAPI is a
Xalan object. From my point of view, XPathAPI has some problems (see
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=1425 )
Best regards,
Christian
--On Dienstag, 1. Mai 2001 18:49 -0400 buzzonus <bu...@yahoo.com> wrote:
>
> Hi,
> I am using xerces 1.3.0 and am running into a problem where the
> NodeList nodes = XPathAPI.selectNodeList(doc,
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org