0
我需要更改什麼,以便FieldRef下的Name節點是FieldRef的屬性,而不是子節點?如何獲得一個值節點向上移動以成爲其父節點的屬性?
泡沫目前生成以下皁:
<ns0:query>
<ns0:Where>
<ns0:Eq>
<ns0:FieldRef>
<ns0:Name>_ows_ID</ns0:Name>
</ns0:FieldRef>
<ns0:Value>66</ns0:Value>
</ns0:Eq>
</ns0:Where>
</ns0:query>
我需要的是這樣的:通過從下面代碼泡沫生成
<ns0:query>
<ns0:Where>
<ns0:Eq>
<ns0:FieldRef Name="_ows_ID">
</ns0:FieldRef>
<ns0:Value>66</ns0:Value>
</ns0:Eq>
</ns0:Where>
</ns0:query>
第一XML結構。
q = c.factory.create('GetListItems.query')
q['Where']=InstFactory.object('Where')
q['Where']['Eq']=InstFactory.object('Eq')
q['Where']['Eq']['FieldRef']=InstFactory.object('FieldRef')
q['Where']['Eq']['FieldRef'].Name='_ows_ID'
q['Where']['Eq']['Value']='66'
和print(q)
結果
(query){
Where =
(Where){
Eq =
(Eq){
FieldRef =
(FieldRef){
Name = "_ows_ID"
}
Value = "66"
}
}
}
這裏,使WS調用創建SOAP請求
c = client.Client(url='https://community.site.edu/_vti_bin/Lists.asmx?WSDL',
transport=WindowsHttpAuthenticated(username='domain\user',
password='password')
)
ll= c.service.GetListItems(listName="{BD59F6D9-AB4B-474D-BCC7-E4B4BEA7EB27}",
viewName="{407A6AB9-97CF-4E1F-8544-7DD67CEA997B}",
query=q
)
所以這個問題到底是什麼?你不能第一個看起來像第二個? – Jack 2009-06-12 14:47:11