Re: namespacing fun(?)
| From: | Daniel Pupius | Date: | Fri, 30 Jan 2004 17:13:08 +0000 |
| Subject: | Re: namespacing fun(?) | ||
| References: | 1 2 | Groups: | php.xml.dev |
| Request: | Send a blank email to php-xml-dev+get-285@lists.php.net to get a copy of this message | ||
Oh, ok. I'll put something together on Monday.
Thanks for replying so fast
Dan
"Christian Stocker" <chregu@bitflux.ch> wrote in message
news:401A8F63.7040601@bitflux.ch...
> Hi
>
> please provide the shortest possible example of your code and/or file a
bug.
>
> this should actually work as you suggested. I don't think it's a PHP
> problem..
>
> chregu
>
>
> On 1/30/04 5:48 PM, Daniel Pupius wrote:
>
> > Hey there,
> >
> > I'm using the DOM XML and XPATH queries. My application has to accept
XML
> > formats based on an IMS standard, both generated in our company and
> > externally by others.
> >
> > Now the problem, most people use the same naming convensions for
namespaces,
> > but a couple of people do not. This causes the XPATH queries to fail.
> >
> > For example, consider the following XML documents:
> >
> >
> > <demo xmlns="http://somenamespace">
> > <node>
> > <child />
> > <child />
> > </node>
> > </demo>
> >
> > <ns:demo xmlns:ns="http://somenamespace">
> > <ns:node>
> > <ns:child />
> > <ns:child />
> > </ns:node>
> > </ns:demo>
> >
> > <fun:demo xmlns:fun="šFf0óçºÑ4
> > �pøØhttp://somenamespace">
> > <fun:node>
> > <fun:child />
> > <fun:child />
> > </fun:node>
> > </fun:demo>
> >
> >
> > They all represent the same structure, bound to the same namespace. And
are
> > thus all esentially equal to:
> > <http://somenamespace:demo>
> > .... etc ....
> > </http://somenamespace:demo>
> >
> >
> > When creating the XPATH queries, you'd register the namespace:
> > xpath_register_ns($xpath,"ns",
> > "http://somenamespace");
> >
> > And format your queries like so:
> > /ns:demo/ns:node/ns:child
> >
> > I'd expect this to match all the above xml files, since the "ns" in the
> > xpath query refers to the namespace rather than the textual abrieviation
of
> > the namespace. Am I correct in this assumption? Of course, it doens't
seem
> > to work with PHPs parser.
> >
> > I was therefore wondering if anyone had any ideas on how to get round
this
> > problem...
> >
> > Cheers
> >
> > Dan
> >
>
> --
> christian stocker | Bitflux GmbH | schoeneggstrasse 5 | ch-8004 zurich
> phone +41 1 240 56 70 | mobile +41 76 561 88 60 | fax +41 1 240 56 71
> http://www.bitflux.ch | chregu@bitflux.ch | gnupg-keyid
> 0x5CE1DECB