XML doesn't make sense - namespaces and such.
I've been working with XML for years now, provided the document doesn't get all "weird" on me - in particular, when it starts involving namespaces.
For example, I might have a document that has a root/mainNode/childNode set up.
The XPath in such a setting is easy - I wanna pull all the childNode elements, I just do //root/mainNode/childNode.
However, that suddenly doesn't work when someone throws a namespace on their root node - "xmlns='some url that doesn't exist' "
So I guess my main question is why do people use non-existing URLs as namespaces instead of a normal word? Why "http://blah.domain/xml/2/0/randomWord/banana" as opposed to a more simple and logical "customerDoc"? Why in a URL format, and why something that doesn't exist?
It confuses me because namespaces everywhere else are normal. In C# it's something like System.Net.Sockets. If I had to type "http://blah.domain/xml/2/0/randomWord/System.http://blah.domain/xml/2/0/randomWord/Net.http://blah.domain/xml/2/0/randomWord/Sockets", I would kill myself.
My next question is, if someone uses a namespace, why does XPath suddenly not work? I can take the same document, strip out the namespace declaration, save it locally, then try the XPath query on it and it works just fine. So how does this simple "xmlns=" attribute suddenly break whatever XPath engine I'm using?
__________________
I love lamp.
|