XML.com: XML From the Inside Out

XML.comWebServices.XML.comO'Reilly Networkoreilly.com
  Articles | Weblogs | Newsletter | Safari Bookshelf
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:


Contact Us | Our Mission | Privacy Policy | Advertise With Us | | Submissions Guidelines
Copyright © 2008 O'Reilly Media, Inc. | (707) 827-7000 / (800) 998-9938