xml dom - create element with namespace (cross browser)
var xmlDoc; ////some code to load and initialize xmlDoc.. //create an element 'book', with prefix 'px' and namespace 'http://bookshop.com/schema' var bookelement; if (xmlDoc.createElementNS) { //for other browsers than ie bookelement = xmlDoc.createElementNS('px:book', 'http://bookshop.com/schema'); } else { //for ie bookelement = xmlDoc.createNode(1, 'px:book', 'http://bookshop.com/schema'); }
will create book element:
<px:book xmlns:px='http://bookshop.com/schema' />
Comments
Post a Comment