Re: XML Data Island

From: Joe Fawcett (joefawcett_at_newsgroups.nospam)
Date: 03/24/05


Date: Thu, 24 Mar 2005 15:59:18 -0000


"Brian Staff" <brianstaff@[NoSpam]cox.net> wrote in message
news:XcB0e.412$k57.279@fed1read07...
> OK...at my age, sometimes you need to be told things twice<g>
> Anyway, I am now using a pseudo data island with a javascript VARiable which
> is actually a copy of the returned responseXML for the XMLHTTP request.
>
> It all works...except, I am still having a problem with namespaces. The
> returned XML does have a declartion in it for the "ds" and "z" namespaces, but
> FF will not work with this type of code:
>
> rows = fieldXMLIsland.getElementsByTagName("z:row");
> IE does work
>
> FF does work with this:
> rows = fieldXMLIsland.getElementsByTagName("row");
> but then IE fails
>
> is there anywhere else I need to declare the namespace, apart from inside the
> XML structure.
>
> Thanks for your patience - Brian
If the returned XML deos not have dclarations for the ds and z namespace
prefixes then it's not XML.

In any case you'd be better off using XPath rather than DOM select methods. In
IE you set the namespace and prefix first:
objDom.setproperty("SelectionLanguage", "XPath");
objDom.setProperty("SelectionNamespaces", "xmlns:ds='<uri goes here>'
xmlns:z='<uri goes here>'");
var sXPath = "/*/z:row"; //This is probably wrong but I haven't seen your XML
var colNodes = objDom.selectNodes(sXPath);

You'll have to look at the comparable methoid for Mozilla XPath usage.
As I said using Sarissa relieves you of some of these headaches.

-- 
Joe (MVP - XML)
. 


Relevant Pages

  • Re: master / detail datagrid...
    ... Macromedia uses their prefix in the exact same way an XML ... A patent on the other hand can be obtained but unlike the paltry ... and an XML Namespace is the equivalent of a short musical ...
    (microsoft.public.dotnet.framework.aspnet)
  • RE: Root Namespace Prefix and OpenXml
    ... XML stream is passed into an Engine ... > - if you want to apply the namespace uri ... > - However if you keep the prefix declaration in your top level element ...
    (microsoft.public.sqlserver.xml)
  • Re: namespace?
    ... Namespaces are used in XML (which is the format that your web service ... an XML namespace should start with the ACTUAL URL of your ... Microsoft MSDN Online Support Lead ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: Referencing the xml: namespace in BTS2004
    ... namesace as any other namespace instead of the reserved namespace the W3C ... except for the "lang" attribute qualified to the special xml: ... > able to validate your xsd file and also xml.xsd and you should now be able ... > generated XSD was equivalent to the original DTD. ...
    (microsoft.public.biztalk.general)
  • RE: XmlDocument.SelectSingleNode XPathException
    ... The "xmlns:sns="http://www.test.org/sub"</a>;>" in the xml itself provides the ... > As for using XmlNamespaceManager to help executing XPATH in xmldocument ... > When there is namespace in an xml document to scope elements in different ... > name of an element is actually it's namespaceURI(not prefix) combined with ...
    (microsoft.public.dotnet.xml)