Hi Bjorn
The problem is that "GetAllPackagesResponse" is actually namespace
qualified! xmlns="http://einhugur.com/KeyServer/" changes the
namespace so to find this element, you would have to treat the
element as if it actually looked like: <x:GetAllPackagesResponse
xmlns:x="http://einhugur.com/KeyServer/">
Therefor
body.xql("GetAllPackagesResponse") will not actually find the node
since it is not in the default namespace of body.
What you have to do is tell the XQL what namespace that element is
located in before it will find it, something like:
Const PREFIX = "somePrefix"
dim ns as new XMLNamespaces()
// the prefix used ("somePrefix" in this case) is not important
// it just has to be the same in ns and in the query
ns.URI(PREFIX)="http://einhugur.com/KeyServer/"
nodelist = body.xql(PREFIX+":"+"GetAllPackagesResponse", ns) // this
will find your node!
-jason
On Mar 23, 2006, at 8:54 AM, Björn Eiríksson wrote:
On 23.3.2006, at 15:24, Stephen Tallent wrote:
By fails then I mean it just does not return the node that it is
supposed to do.
Hi Bjorn. Can you post some code consuming these two functions
that illustrates the issue? I did a quick test in 2k6r1 and these
two functioned identically as they should.
Hello Stephen
Here is the XML:
<soap:Body xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:soap="http://schemas.xmlsoap.org/soap/
envelope/"><GetAllPackagesResponse xmlns="http://einhugur.com/
KeyServer/"><GetAllPackagesResult><anyType
xsi:type="Package"><ID>1</ID><Name>default</Name><IsDefault>true</
IsDefault></anyType></GetAllPackagesResult></
GetAllPackagesResponse></soap:Body>
And here is the code that fails
Dim xml as XmlDocument
Dim responseNode as XmlNode
xml = new XmlDocument(sr.body.ToString())
responseNode = xml.DocumentElement.Node
("GetAllPackagesResponse") // I get nil here when using the XQL code
The Xql code:
Function Node(extends element as XmlNode,name as String) As XmlNode
dim nodelist as xmlnodeList
nodelist = element.Xql(name)
if nodelist.length > 0 then
return nodelist.item(0)
end if
return nil
exception e as xmlException
End Function
The non Xql code:
Function Node(extends element as XmlNode,name as String) As XmlNode
Dim i as Integer
for i = 0 to element.ChildCount-1
if element.Child(i).Name = name then
return element.Child(i)
end if
next
return nil
End Function
--
______________________________________________________________________
Björn Eiríksson [EMAIL PROTECTED]
Einhugur Software
http://www.einhugur.com/
______________________________________________________________________
Einhugur Software has sold its products in 52 countries world wide.
______________________________________________________________________
For support: [EMAIL PROTECTED]
To post on the maillist: [EMAIL PROTECTED]
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>