G
George
Hi,
I created a secondary data connection to a webservice that I invoke in code
using Jscript and not when the form is opened. That process works fine
however I need parse the xml from the webservice and I cannot seem to get it
to work. I can load the dom object and view the xml in an alert window
however when I try to extract a node or nodes I get no xml. I am pretty sure
that my XPath location is correct. Below is the xml document and the jscript
code. Any ideas?
XML
<dfs:myFields
xmlns:dfs=\"http://schemas.microsoft.com/office/infopath/2003/dataFormSolution\" xmlns:tns=\"http://localhost/LinkService/LinkService.asmx\">
<dfs:queryFields>
<tns:GetDirectives></tns:GetDirectives>
</dfs:queryFields>
<dfs:dataFields>
<GetDirectivesResponse
xmlns=\"http://localhost/LinkService/LinkService.asmx\">
<GetDirectivesResult>
<Content>
<treeObjectID>2</treeObjectID>
<parentObjectID>0</parentObjectID>
<label>General Manual</label>
<contentItemID>0</contentItemID>
<fileID>0</fileID>
<citation>GM</citation>
<displayOrder>1</displayOrder>
<hidden>false</hidden>
<maxDisplay>10</maxDisplay>
<allowRollUp>false</allowRollUp>
</Content>
<Content>
....
Jscript
objWSAdapter = XDocument.DataObjects("GetDirectives").QueryAdapter;
objWSAdapter.Query();
domXML = XDocument.GetDOM("GetDirectives");
domXML.setProperty("SelectionNamespaces",
"xmlns:dfs='http://schemas.microsoft.com/office/infopath/2003/dataFormSolution' xmlns:tns='http://localhost/LinkService/LinkService.asmx'");
var objWorkflowNodes =
domXML.selectNodes("/dfs:myFields/dfs:dataFields/GetDirectivesResponse/GetDirectivesResult/Content");
XDocument.UI.Alert(objWorkflowNodes.xml);
I created a secondary data connection to a webservice that I invoke in code
using Jscript and not when the form is opened. That process works fine
however I need parse the xml from the webservice and I cannot seem to get it
to work. I can load the dom object and view the xml in an alert window
however when I try to extract a node or nodes I get no xml. I am pretty sure
that my XPath location is correct. Below is the xml document and the jscript
code. Any ideas?
XML
<dfs:myFields
xmlns:dfs=\"http://schemas.microsoft.com/office/infopath/2003/dataFormSolution\" xmlns:tns=\"http://localhost/LinkService/LinkService.asmx\">
<dfs:queryFields>
<tns:GetDirectives></tns:GetDirectives>
</dfs:queryFields>
<dfs:dataFields>
<GetDirectivesResponse
xmlns=\"http://localhost/LinkService/LinkService.asmx\">
<GetDirectivesResult>
<Content>
<treeObjectID>2</treeObjectID>
<parentObjectID>0</parentObjectID>
<label>General Manual</label>
<contentItemID>0</contentItemID>
<fileID>0</fileID>
<citation>GM</citation>
<displayOrder>1</displayOrder>
<hidden>false</hidden>
<maxDisplay>10</maxDisplay>
<allowRollUp>false</allowRollUp>
</Content>
<Content>
....
Jscript
objWSAdapter = XDocument.DataObjects("GetDirectives").QueryAdapter;
objWSAdapter.Query();
domXML = XDocument.GetDOM("GetDirectives");
domXML.setProperty("SelectionNamespaces",
"xmlns:dfs='http://schemas.microsoft.com/office/infopath/2003/dataFormSolution' xmlns:tns='http://localhost/LinkService/LinkService.asmx'");
var objWorkflowNodes =
domXML.selectNodes("/dfs:myFields/dfs:dataFields/GetDirectivesResponse/GetDirectivesResult/Content");
XDocument.UI.Alert(objWorkflowNodes.xml);