Hi Burak, thank you for the detailed analysis. If I understand correctly, we would have to add a third parameter to xml.Element.selectSingleNode and selectNodes that would be a map of namespace prefixes and their URIs that would be used to create a custom nsResolver for Mozilla or set the SelectionNamespaces property in IE, respectively. Would this solve the problem? If so, could you please open a bug report?
Regards, Daniel Burak Arslan schrieb: > Burak Arslan wrote: >> hi, >> >> what's the right way to get attribute values of xml elements ? the >> qx.xml namespace doesn't contain anything about attributes. currently >> i'm doing >> >> qx.xml.Element.selectSingleNode(node,"@type").value; >> >> to get the type attribute from an element. is this correct? is there a >> more preferred way? >> >> thanks, and best regards. >> burak >> > > hello again, > > i now know a lot more than i ever wanted to know about xml processing > within browsers. i also think that the qooxdoo xml api has to be > slightly modified. > > quoting http://www.w3.org/TR/xpath#node-tests: > > ========== > A QName <http://www.w3.org/TR/REC-xml-names#NT-QName> in the node test > is expanded into an expanded-name > <http://www.w3.org/TR/xpath#dt-expanded-name> using the namespace > declarations from the expression context. This is the same way expansion > is done for element type names in start and end-tags except that the > default namespace declared with |xmlns| is not used: if the QName > <http://www.w3.org/TR/REC-xml-names#NT-QName> does not have a prefix, > then the namespace URI is null (this is the same way attribute names are > expanded). It is an error if the QName > <http://www.w3.org/TR/REC-xml-names#NT-QName> has a prefix for which > there is no namespace declaration in the expression context. > ========== > > in other words, > > if one has declared a default namespace in the xml document (i.e. > xmlns="..."), one has to provide the xpath evaluator a namespace mapper > because xpath interprets qnames without prefixes to be in the null > namespace. by declaring a default namespace, your non-prefixed tags > shadow the ones from the null namespace, and xpath does not want to care > about your default namespace. instead, you must supply it with a > namespace mapper so that every namespace (including the default > namespace) is bound to a namespace prefix. > > for mozilla: > https://developer.mozilla.org/en/Using_XPath > > says: > =================== > Note however that |createNSResolver| should only be used if you are sure > the namespace prefixes in the XPath expression match those in the > document you want to query (and that no default namespace is being used > (though see DOM:document.createNSResolver > <https://developer.mozilla.org/en/DOM/document.createNSResolver> for a > workaround)). Otherwise, you have to provide your own implementation of > XPathNSResolver. > =================== > > here's how to do that: > https://developer.mozilla.org/en/Introduction_to_using_XPath_in_JavaScript#Implementing_a_User_Defined_Namespace_Resolver > > turns out it's pretty simple. > > for ie: > http://www.nczonline.net/blog/2009/04/04/xpath-in-javascript-part-3/ > > has a section about namespaces towards the end. > > http://msdn.microsoft.com/en-us/library/ms756048(VS.85).aspx > > documents the SelectionNamespaces property. > > so, what do we do? :) > > best regards, > burak > > > > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your > production scanning environment may not be a perfect world - but thanks to > Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 > Series Scanner you'll get full speed at 300 dpi even with all image > processing features enabled. http://p.sf.net/sfu/kodak-com > > > ------------------------------------------------------------------------ > > _______________________________________________ > qooxdoo-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel ------------------------------------------------------------------------------ The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your production scanning environment may not be a perfect world - but thanks to Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com _______________________________________________ qooxdoo-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
