[Scilab-users] problem/bug with xmlNs

Calixte Denizet calixte.denizet at scilab-enterprises.com
Tue Jul 8 16:49:06 CEST 2014


Hello Stephane,

You are right: it is a kind of bug: 
http://bugzilla.scilab.org/show_bug.cgi?id=13509
I'm currently fixing it: when the second arg will be an empty matrix, 
then the prefix will empty.

Thanks

Calixte

On 08/07/2014 14:50, Stéphane Mottelet wrote:
> Hello,
>
> xmlNS is not able to create an XML namespace without a prefix, 
> although this is completely correct in XML, as it allows inheritance 
> of it. Example:
>
> <a xmlns="http://name.space">
>    <b>1</b>
> </a>
>
> here the "b" element is in the "http://name.space" namespace. The only 
> workaround I have found is the following :
>
> s = "<root><a xmlns=""http://name.space""/><b/></root>"
> doc = xmlReadStr(s)
> ns=xmlGetNsByHref(doc.root.children(1), "http://name.space")
> xmlAddNs(doc.root.children(2),ns);
> xmlDump(doc)
>
> Scilab (correct) output is :
>
>  ans  =
>
> !<?xml version="1.0"?>             !
> !                                  !
> !<root>                            !
> !                                  !
> !  <a xmlns="http://name.space"/>  !
> !                                  !
> !  <b xmlns="http://name.space"/>  !
> !                                  !
> !</root>                           !
>
>
> But if I use xmlNS, Scilab (incorrect) output is :
>
> s = "<root><a/><b/></root>"
> doc = xmlReadStr(s)
> ns=xmlNs(doc.root,"","http://name.space");
> xmlAddNs(doc.root.children(1),ns);
> xmlAddNs(doc.root.children(2),ns);
> xmlDump(doc)
>  ans  =
>
> !<?xml version="1.0"?>              !
> !                                   !
> !<root xmlns:="http://name.space">  !
> !                                   !
> !  <a xmlns:="http://name.space"/>  !
> !                                   !
> !  <b xmlns:="http://name.space"/>  !
> !                                   !
> !</root>
>
> xmlNs should interpret and empty string as prefix, as no prefix for 
> the namespace.
>
> S.
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users


-- 
Calixte Denizet
Software Development Engineer
-----------------------------------------------------------
Scilab Enterprises
143bis rue Yves Le Coz - 78000 Versailles, France
http://www.scilab-enterprises.com




More information about the users mailing list