Re: [xml] Change default namespace to prefixed namespace

On Wed, Nov 26, 2008 at 10:48:53AM +0100, Rüdiger Ranft wrote:
Hi all,

I need to transform the default namespace of a document to a prefixed
one. Is it ok to assign a string to the namespace, or do I need to
create a new namespace and replace it in the document?
              if ( NULL == nsp->prefix )
                      nsp->prefix = xmlMemoryStrdup( "hc" );

  xmlStrdup() instead, but yes that should work. Usually the parser
would allocate the prefix from the document dictionary if it has one
(doc->dict see dict.h on how to allocate from them), but a duplicated
string should still work.


Daniel Veillard      | libxml Gnome XML XSLT toolkit
daniel veillard com  | Rpmfind RPM search engine | virtualization library

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