Sign In/My Account | View Cart  
advertisement

Article:
 Little Back Corners
Subject: default namespaces
Date: 2005-06-09 12:09:01
From: khote

I've been using CachedXPathAPI for lots of things lately (from Xalan, the 2.6.0 version in particular), as well as XMLUnit.


XMLUnit has the very nice: assertXPathExists, but this does NOT work if you are using a default namespace. You cannot xpath
for "//FeatureCollection" because FeatureCollection occurs in the default namespace
xmlns="http://mydomain/schemas"


Using an xpath string "//:FeatureCollection/gml:featureMember" does work in xalan-2.6.0's xpathapi, assuming you have a namespaceaware document or a node from a namespaceaware document.


I use //*[local-name()='featureMember'] to get past any particular namespace (or no namespace or default namespace .... catch my breath)


Previous Message Previous Message   Next Message No Next Message


Sponsored By: