Re: [xml] Set Default Namespace



On 25/08/2008, Niels Van Hoef <niels vanhoef gmail com> wrote:

 I tried you suggestion even before posting this question but a small
 test program yields the following results:

 <?xml version="1.0" encoding="UTF-8"?>
 <site xmlns:="default">
  <node>element</node>
 </site>

This looks like you've passed a pointer to an empty string, rather
than a null pointer.

 Where as I would suspect:

 <?xml version="1.0" encoding="UTF-8"?>
 <site xmlns="default">
  <node>element</node>
 </site>

 I'm rather new to XML but I believe the proper declaration of the
 default name space should be without the double-colon, right?

Right, the first is not correct by the namespaces spec. Perhaps
libxml2 could be a little more polite by refusing to construct
namespaces that will lead to bad output.

I've written a short example (see simple.c attached) and the output it
should produce (see result.txt attached),

Martin

Attachment: simple.c
Description: Text Data

Attachment: result.txt
Description: Text document



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]