Re: [xml] xmlCopyNode that doesn't copy a namespace?
- From: Theodore H.Smith <delete elfdata com>
- To: xml gnome org
- Subject: Re: [xml] xmlCopyNode that doesn't copy a namespace?
- Date: Sun, 1 Jan 2006 17:09:10 +0000
On 1 Jan 2006, at 11:30, Daniel Veillard wrote:
On Fri, Dec 30, 2005 at 03:10:08PM +0000, Theodore H. Smith wrote:
Hi people,
I still haven't got an answer on my question to the XPath problem I
was having. In the meantime I've written my own Xpath query function,
which is actually more faster and simple to use than the standard
XPath.
What you implemented is NOT XPath. You break the XPath semantic.
//foo CANNOT select a node which has a namespace even if it's a
default namespace. This is the #1 question of all XPath beginners, not
only you felt in the trap, apparently you didn't checked archives and
decided to implemnent a broken implementation instead, sounds
positively
awful !
If it's the number one question, then maybe that's tell you something
about your implementation. If you get an xpath context from a
document, shouldn't that xpath context have a default namespace which
is the document's default name space?
My function works and yours didn't, how is that broken? Mine is also
simpler to use and faster.
XML isn't the only language with namespaces. C++ has them, Java has
them and even a class can be considered to be a "name space". In both
these languages I don't need to explicitly state the full name. Why
should XML be different?
In C++ I can do this:
string s = "hello";
Or:
std::string s = "hello";
But you think you know more about how name spaces should be used than
the makers of Java and C++?
OK then.
I'd still like an answer on the XPath problem I posted here,
though. Because I'd like to use the standard tools whereever possible
instead of having to write my own alternatives.
So, I got this problem with xmlCopyNode, it's putting a namespace
into the XML, when I don't actually want one there.
You copy a namespaced element node you gate a namespaced element
node
the namespace is as important as the element name in a processor
conformant
to XML namespace. You're asking to create a different element, not
a copy !
Except that it is a copy, because it's going into a document with the
same name space.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]