Article View: borland.public.delphi.xml
Article #53TXMLDocument with Multiple Namespaces
From: Chris Krohn
Date: Mon, 21 Apr 2008 19:56
Date: Mon, 21 Apr 2008 19:56
51 lines
2989 bytes
2989 bytes
I am trying to interface a small CodeGear Delphi 2007 app with a Microsoft Office
Sharepoint Server (MOSS). I am using the lists web service to return the XML of a
particular document on one of our subsites. When I try to parse this document with a
TXMLDcoument object, everything works great until I try and get the attributes or child
nodes. The XML looks like this:
<listitems xmlns="http://schemas.microsoft.com/sharepoint/soap/"
xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882"
xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
<rs:data ItemCount="1">
<z:row ows_BL_x0020_AWB_x0020_Number="7342128"
ows_DocLink="http://iserver/subsite/Documents%20for%20Review%2FTSCW%2DCL0214/7342128_BillofLading_6212457_2008102193356.pdf,
http://iserver/subsite/Documents%20for%20Review%2FTSCW%2DCL0214/7342128_BillofLading_6212457_2008102193356.pdf"
ows_MetaInfo="794;#"
ows__ModerationStatus="0"
ows__Level="1"
ows_ID="794"
ows_owshiddenversion="3"
ows_UniqueId="794;#{2FC479E5-9DA0-4ED5-A29F-27B826AAE6F9}"
ows_FSObjType="794;#0"
ows_Created="2008-04-12T00:33:55Z"
ows_FileRef="794;#docportal/Lists/Documentation Repository/794_.000"/>
</rs:data>
</listitems>
You will notice that the data node is in the rs namespace and the row node is in the z
namespace. When I try to get a node as such:
XMLDoc.XML.Text := XML;
XMLDoc.Active := True;
Node := XMLDoc.DocumentElement.ChildNodes['data'];
ItemCount := RootNode.attributes['ItemCount'].nodeValue;
It fails with an error saying that node 'data' not found. I have also tried using
ChildNodes['rs:data'] with the same result.
I assume that there must be some way to set which namespace you want to use prior to
accessing the attributes but I am unsure as to how to do this. Does anyone have any
ideas?
Thanks
Chris
---
Chris Krohn
IT Manager
Cayman Islands Port Authority
ckrohn at caymanport dot com
Technical Details
Message-ID:
<1qrp049smjmi0q6nkhrqkek84vo06uteod@4ax.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: f5d9b,452d7d6ec3e9d5ff,start X-Google-Attributes: gidf5d9b,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: Chris Krohn <ckrohn@caymanport.com> Newsgroups: borland.public.delphi.xml Subject: TXMLDocument with Multiple Namespaces Date: Mon, 21 Apr 2008 14:56:52 -0500 Organization: Cayman Islands Port Authority Message-ID: <1qrp049smjmi0q6nkhrqkek84vo06uteod@4ax.com> X-Newsreader: Forte Agent 3.0/32.763 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 208.157.149.189 X-Trace: newsgroups.borland.com 1208807827 208.157.149.189 (21 Apr 2008 12:57:07 -0700) Lines: 51 Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail