Namespaces, Why Does It Always Have To Be Namespaces?

I’ll be honest, I LOATHE namespaces in XML.  I haven’t seen a case where I needed to use them to differentiate between identically-named elements in different contexts.  So often, the document declares a namespace at the top and never overrides it.  In that case, why use it? Why do I hate it? It breaks XPath…

0

Selecting an XML Element by #text value

This is actually just a wrapper for the [text()=’value’] XPATH attribute.  As I said in a previous post, this blog is my own knowledge base.  When I need this, and I’m sure I will, I’ll remember writing this entry, search my blog, and there it is! This will be used in a subsequent post about…

0

One-Liner: Case-Insensitive XML Queries

I’m a one-trick pony with XML.  I use $xml.SelectNodes(“//name[@attribute=’value’]”) and permutations thereof.  However, XML’s SelectNodes() and SelectSingleNode() methods are case-sensitive.  My coworker Keith Munson found this tidbit:  $xml.SelectNodes(“//element[translate(@AttributeName, ‘ABCDEFGHIJKLMNOPQRSTUVWXYZ’, ‘abcdefghijklmnopqrstuvwxyz’) =’AttributeValue’]”) This will return <element AttributeName=”attributevalue” /> as well as <element AttributeName=”AttributeValue” /> But it won’t work for <Element AttributeName=”AttributeValue” /> nor: <element attributename=”AttributeValue” />…

0