[xml] Rer: Re: XPath question
- From: "Erik F. Andersen" <ea ascott dk>
- To: rrichards ctindustries net
- Cc: xml gnome org
- Subject: [xml] Rer: Re: XPath question
- Date: Tue, 21 Nov 2006 14:54:25 +0100
Hi!
The prefix is not "nil". NIL is Delphi syntax for a NULL pointer in C. If you look at the definition for
xmlns in <DenDynamiskeBlanket> there is no prefix specified.
It is quite obvoius looking at the source in xpath.c why xmlXPathRegisterNs won't work with a NULL prefix. It
return -1. If I register the namespace with any prefix for instance xmlXPathRegisterNs("nil",
"http://www.medcom.dk/DenDynamiskeBlanket/2006-01-30/") XPath will work if I just remember to prefix my
queries witj "nil" as you suggest.
I just don't get it why it is necessary to register the namespace at all...
Regards,
Erik
Rob Richards<rrichards ctindustries net> 21.11.2006 14:29:39 >>>
Erik F. Andersen wrote:
Hello!
I use LibXML version 2.6.17 on Windows and I have a problem with an XML document where I cannot get XPath
to return any nodes.
The start of the XML looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<DenDynamiskeBlanket xmlns="http://www.medcom.dk/DenDynamiskeBlanket/2006-01-30/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.medcom.dk/DenDynamiskeBlanket/2006-01-30/
file:/C:/Documents%20and%20Settings/Jacob/workspace/Den%20Dynamiske%20Blanket%20Fremviser/xml/xsds/ddb.xsd">
<Form>
<Identifier></Identifier>
<SentDateTime>2002-02-02T23:23:23</SentDateTime>
<TypeCode>LÆ255</TypeCode>
<VersionCode></VersionCode>
<StatisticalCode></StatisticalCode>
<PageStock>A4</PageStock>
<Graphics>
My problem is that no matter what I do I cannot locate any nodes with XPath. I tried registering the
namespace using xmlXPathRegisterNs (the prefix is nil). Is there a problem with the XML above or am I doing
something wrong? If I remove the xmlns attribute I have no problems. I think the XML is wrong but I don't
know what it is...
Are you using the registered prefix in your query?
i.e. //nil:Form should return all the Form element nodes (assuming you
registered "http://www.medcom.dk/DenDynamiskeBlanket/2006-01-30/" with
the prefix "nil")
Rob
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]