HasAttributes - NameSpace
Chetan Raj <[email protected]> Thu, 12 May 2005 19:42:42 +0530
| Newsgroups | gmane.comp.gnome.gdome |
|---|---|
| Message-ID | <[email protected]> |
--===============1114274624== Content-Type: multipart/alternative; boundary="----=_Part_293_9907473.1115907162228" ------=_Part_293_9907473.1115907162228 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi All, I have ran into an another problem with namespaces while using gdome! If I parse an existing xml document with only namespace attribute in the=20 document element, and then call 'hasAttributes' on the document element, th= e=20 'hasAttributes' returns false. Namespaces are special attirbutes and should be ideally considered as=20 attributes itself. So 'hasAttributes' should have returned true.=20 If it is a conscious decision to support this behaviour, why was it designe= d=20 that way? The following code snippets will demonstrate the problem consider "college.xml" having the following data... <abc:college xmlns:abc=3D"*namespaceUri*"> <abc:principal>ram</abc:princi= pal > </abc:college> - <#> and I call hasAttributes as shown below on the document element GdomeException exc =3D 0; GdomeDOMImplementation *domimpl =3D gdome_di_mkref (); GdomeDocument *doc =3D gdome_di_createDocFromURI(domimpl,"college.xml ",GDOME_LOAD_PARSING,&exc); GdomeElement* elem =3D gdome_doc_documentElement(doc,&exc); GdomeBoolean b =3D gdome_el_hasAttributes(elem,&exc); The value of b obtained is FALSE. Thanks, Chetan Raj ------=_Part_293_9907473.1115907162228 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline <span style=3D"font-family: verdana; color: rgb(0, 0, 153);">Hi All,</span>= <br style=3D"font-family: verdana; color: rgb(0, 0, 153);"> <br style=3D"font-family: verdana; color: rgb(0, 0, 153);"> <span style=3D"font-family: verdana; color: rgb(0, 0, 153);">I have ran int= o an another problem with namespaces while using gdome!</span><br style=3D"= font-family: verdana; color: rgb(0, 0, 153);"> <br style=3D"font-family: verdana; color: rgb(0, 0, 153);"> <span style=3D"font-family: verdana; color: rgb(0, 0, 153);">If I parse an existing xml document with only namespace attribute in the document element, and then call 'hasAttributes' on the document element, the 'hasAttributes' returns false.</span><br style=3D"font-family: verdana; col= or: rgb(0, 0, 153);"> <br style=3D"font-family: verdana; color: rgb(0, 0, 153);"> <span style=3D"font-family: verdana; color: rgb(0, 0, 153);">Namespaces are special attirbutes and should be ideally considered as attributes itself. So 'hasAttributes' should have returned true. </span><br style=3D"f= ont-family: verdana; color: rgb(0, 0, 153);"> <br style=3D"font-family: verdana; color: rgb(0, 0, 153);"> <span style=3D"font-family: verdana; color: rgb(0, 0, 153);">If it is a con= scious decision to support this behaviour, why was it designed that way?</s= pan><br style=3D"font-family: verdana; color: rgb(0, 0, 153);"> <br style=3D"font-family: verdana; color: rgb(0, 0, 153);"> <span style=3D"font-family: verdana; color: rgb(0, 0, 153);">The following = code snippets will demonstrate the problem</span><br style=3D"font-family: = verdana; color: rgb(0, 0, 153);"> <br style=3D"font-family: verdana; color: rgb(0, 0, 153);"> <span style=3D"font-family: verdana; color: rgb(0, 0, 153);">consider "= ;college.xml" having the following data...</span><br style=3D"font-fam= ily: verdana; color: rgb(0, 0, 153);"> <span style=3D"font-family: verdana; color: rgb(0, 0, 153);" class=3D"m"><= br> <</span><span style=3D"font-family: verdana; color: rgb(0, 0, 153);" cla= ss=3D"t">abc:college</span><span style=3D"font-family: verdana; color: rgb(= 0, 0, 153);" class=3D"ns"> xmlns:abc</span><span style=3D"font-family: verd= ana; color: rgb(0, 0, 153);" class=3D"m"> =3D"</span><b style=3D"font-family: verdana; color: rgb(0, 0, 153);" c= lass=3D"ns">namespaceUri</b><span style=3D"font-family: verdana; color: rgb= (0, 0, 153);" class=3D"m">"></span> <div style=3D"font-family: verdana; color: rgb(0, 0, 153);"> <div class=3D"e"> <div style=3D"margin-left: 1em; text-indent: -2em;"><span class=3D"b"> = ; </span> <span class=3D"m"><</span><span class=3D"t"= >abc:principal</span><span class=3D"m">></span><span class=3D"tx">ram</s= pan><span class=3D"m"></</span> <span class=3D"t">abc:principal</span><span class=3D"m">></span></div></= div></div> <span style=3D"font-family: verdana; color: rgb(0, 0, 153);" class=3D"m">&l= t;/</span><span style=3D"font-family: verdana; color: rgb(0, 0, 153);" clas= s=3D"t">abc:college</span><span style=3D"font-family: verdana; color: rgb(0= , 0, 153);" class=3D"m"> ></span><br style=3D"font-family: verdana; color: rgb(0, 0, 153);"> <div class=3D"c" style=3D"margin-left: 1em; text-indent: -2em; font-family:= verdana; color: rgb(0, 0, 153);"><a class=3D"b" onfocus=3D"h()" onclick=3D= "return false" href=3D"#">-</a></div> <div style=3D"font-family: verdana; color: rgb(0, 0, 153);"><div class=3D"e= "><div style=3D"margin-left: 1em; text-indent: -2em;"><span class=3D"m"></s= pan><span class=3D"m"></span><span class=3D"m"></span><br> </div></div></div> <span style=3D"font-family: verdana; color: rgb(0, 0, 153);">and I call has= Attributes as shown below on the document element</span><br style=3D"font-f= amily: verdana; color: rgb(0, 0, 153);"> <br style=3D"font-family: verdana; color: rgb(0, 0, 153);"> <span style=3D"font-family: verdana; color: rgb(153, 51, 153);">  = ; GdomeException exc =3D 0;</span><br style=3D"font-family: verdana; = color: rgb(153, 51, 153);"> <span style=3D"font-family: verdana; color: rgb(153, 51, 153);">  = ; GdomeDOMImplementation *domimpl =3D gdome_di_mkref ();</span><br st= yle=3D"font-family: verdana; color: rgb(153, 51, 153);"> <br style=3D"font-family: verdana; color: rgb(153, 51, 153);"> <span style=3D"font-family: verdana; color: rgb(153, 51, 153);">  = ; GdomeDocument *doc =3D gdome_di_createDocFromURI(domimpl,"coll= ege.xml",GDOME_LOAD_PARSING,&exc);</span><br style=3D"font-family:= verdana; color: rgb(153, 51, 153);"> <span style=3D"font-family: verdana; color: rgb(153, 51, 153);">  = ; GdomeElement* elem =3D gdome_doc_documentElement(doc,&exc);</sp= an><br style=3D"font-family: verdana; color: rgb(153, 51, 153);"> <span style=3D"font-family: verdana; color: rgb(153, 51, 153);">  = ; GdomeBoolean b =3D gdome_el_hasAttributes(elem,&exc);</span><br= style=3D"font-family: verdana; color: rgb(204, 102, 204);"> <br style=3D"font-family: verdana; color: rgb(0, 0, 153);"> <span style=3D"font-family: verdana; color: rgb(0, 0, 153);">The value of b= obtained is FALSE.</span><br style=3D"font-family: verdana; color: rgb(0, = 0, 153);"> <br style=3D"font-family: verdana; color: rgb(0, 0, 153);"> <br style=3D"font-family: verdana; color: rgb(0, 0, 153);"> <span style=3D"font-family: verdana; color: rgb(0, 0, 153);">Thanks,</span>= <br style=3D"font-family: verdana; color: rgb(0, 0, 153);"> <span style=3D"font-family: verdana; color: rgb(0, 0, 153);">Chetan Raj</sp= an><br style=3D"font-family: verdana; color: rgb(0, 0, 153);"> ------=_Part_293_9907473.1115907162228-- --===============1114274624== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ gdome mailing list [email protected] http://mail.gnome.org/mailman/listinfo/gdome --===============1114274624==--