:: Forum >>

Using Namespaces in XML Data Model

I'm getting the following error when trying to reference an xml element which has a namespace prefix:

Error: uncaught exception: [Exception... "An attempt was made to create or change an object in a way which is incorrect with regard to namespaces" code: "14" nsresult: "0x8053000e (NS_ERROR_DOM_NAMESPACE_ERR)" location: "http://localhost:8080/js/grid-runtime/lib/grid.js Line: 27"]

Here's the javascript code that defines the Xpath for the columns:

// set columns XPath
table.setColumns(["title", "link", "description", "ebay:startdate", "ebay:enddate", "ebay:buyitnowprice", "guid"]);

How can I reference an element with a namespace?

Thanks.
Todd
Wednesday, December 21, 2005
Update:

This XPath expression seems to work in Firefox:

*[local-name()='startdate']

But Internet Explorer (version 6) displays this error:

Error: Unknown method

*[-->local-name()<--='startdate']

Any ideas?
Todd
Wednesday, December 21, 2005
there is an example in /examples/grid/xml-array of records.htm
Basically you have to declare your namespace with setNamespace() method -

table.setNamespace("co", "http://tempuri.org/");

and then you can use namespace is XPath -

table.setColumns(["co:ticker", "co:name", "co:marketcap"]);
Alex (ActiveWidgets)
Wednesday, December 21, 2005

This topic is archived.


Back to support forum

Forum search