List Info

Thread: xpointer xmlns() scheme?




xpointer xmlns() scheme?
user name
2007-01-19 13:00:07
I'm a big fan of XInclude, and I use xmllint and xsltproc
extensively 
because they support the xpointer() scheme of XInclude.  I
recently tried 
to process some DocBook5 documents which are in the docbook
namespace, and 
I'm not having much luck.  It seems the xmlns() scheme must
be specified as 
part of the xpointer attribute for the include element, but
it doesn't seem 
to work in libxml2.

<xi:include href="booktest5.xml"
  xpointer="xmlns(db=http://docbook.org/ns/d
ocbook) 
xpointer(//db:dedication)"
  xmlnsi=&qu
ot;http://www
.w3.org/2001/XInclude"/>

Am I doing something wrong, or is xmlns() not supported with
the xpointer 
scheme?

Bob Stayton
Sagehill Enterprises
DocBook Consulting
bobssagehill.net



_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xmlgnome.org
http://mai
l.gnome.org/mailman/listinfo/xml

Re: xpointer xmlns() scheme?
user name
2007-01-19 14:20:09
On Fri, Jan 19, 2007 at 11:00:07AM -0800, Bob Stayton
wrote:
> I'm a big fan of XInclude, and I use xmllint and
xsltproc extensively 
> because they support the xpointer() scheme of XInclude.
 I recently tried 
> to process some DocBook5 documents which are in the
docbook namespace, and 
> I'm not having much luck.  It seems the xmlns() scheme
must be specified as 
> part of the xpointer attribute for the include element,
but it doesn't seem 
> to work in libxml2.
> 
> <xi:include href="booktest5.xml"
>   xpointer="xmlns(db=http://docbook.org/ns/d
ocbook) 
> xpointer(//db:dedication)"
>   xmlnsi=&qu
ot;http://www
.w3.org/2001/XInclude"/>
> 
> Am I doing something wrong, or is xmlns() not supported
with the xpointer 
> scheme?

  That looks right, and libxml2 has the xmlns() scheme
support compiled in
if xpointer. However I don't see any test in the regression
suite covering
xmlns(), the code in xpointer.c looks fine though, it
registers the binding
in the XPath context. If you could make a tiny example
showing the problem
with xmllint ...
  Might be broken though:

paphio:~/XML -> cat test.xml
<bar xmlns="http://foo/"/>
paphio:~/XML -> testXPath --xptr 'xmlns(foo=http://foo/)xpointer(//foo:bar)'
test.xml
Object is empty (NULL)
Object is a Node Set :
Set contains 0 nodes:
paphio:~/XML -> testXPath --xptr 'xpointer(//foo:bar)'
test.xml
XPath error : Undefined namespace prefix
Object is empty (NULL)
Object is a Node Set :
Set contains 0 nodes:
paphio:~/XML -> 

Daniel

-- 
Red Hat Virtualization group http://redhat.com/v
irtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillardredhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ |
Rpmfind RPM search engine  http://rpmfind.net/
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xmlgnome.org
http://mai
l.gnome.org/mailman/listinfo/xml

Re: xpointer xmlns() scheme?
user name
2007-01-19 14:38:53
Actually, it is working.  When I constructed a simple
example, it worked, 
so I went back to my original problem and found an error in
the XInclude 
expression.  Sorry for the noise.

Bob Stayton
Sagehill Enterprises
DocBook Consulting
bobssagehill.net


----- Original Message ----- 
From: "Daniel Veillard" <veillardredhat.com>
To: "Bob Stayton" <bobssagehill.net>
Cc: <xmlgnome.org>
Sent: Friday, January 19, 2007 12:20 PM
Subject: Re: [xml] xpointer xmlns() scheme?


> On Fri, Jan 19, 2007 at 11:00:07AM -0800, Bob Stayton
wrote:
>> I'm a big fan of XInclude, and I use xmllint and
xsltproc extensively
>> because they support the xpointer() scheme of
XInclude.  I recently 
>> tried
>> to process some DocBook5 documents which are in the
docbook namespace, 
>> and
>> I'm not having much luck.  It seems the xmlns()
scheme must be specified 
>> as
>> part of the xpointer attribute for the include
element, but it doesn't 
>> seem
>> to work in libxml2.
>>
>> <xi:include href="booktest5.xml"
>>   xpointer="xmlns(db=http://docbook.org/ns/d
ocbook)
>> xpointer(//db:dedication)"
>>   xmlnsi=&qu
ot;http://www
.w3.org/2001/XInclude"/>
>>
>> Am I doing something wrong, or is xmlns() not
supported with the 
>> xpointer
>> scheme?
>
>  That looks right, and libxml2 has the xmlns() scheme
support compiled in
> if xpointer. However I don't see any test in the
regression suite 
> covering
> xmlns(), the code in xpointer.c looks fine though, it
registers the 
> binding
> in the XPath context. If you could make a tiny example
showing the 
> problem
> with xmllint ...
>  Might be broken though:
>
> paphio:~/XML -> cat test.xml
> <bar xmlns="http://foo/"/>
> paphio:~/XML -> testXPath --xptr 
> 'xmlns(foo=http://foo/)xpointer(//foo:bar)'
test.xml
> Object is empty (NULL)
> Object is a Node Set :
> Set contains 0 nodes:
> paphio:~/XML -> testXPath --xptr
'xpointer(//foo:bar)' test.xml
> XPath error : Undefined namespace prefix
> Object is empty (NULL)
> Object is a Node Set :
> Set contains 0 nodes:
> paphio:~/XML ->
>
> Daniel
>
> -- 
> Red Hat Virtualization group http://redhat.com/v
irtualization/
> Daniel Veillard      | virtualization library  http://libvirt.org/
> veillardredhat.com  | libxml GNOME XML XSLT
toolkit  http://xmlsoft.org/
> http://veillard.com/
| Rpmfind RPM search engine  http://rpmfind.net/
>
> 


_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xmlgnome.org
http://mai
l.gnome.org/mailman/listinfo/xml

[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )