A
Antony Blackwell
I have loaded an XML document from a secondary source in Infopath Jscript
with SP1. The resulting GetDOM document no longer has the "InfoPath.Document"
PI in it.
I have tried to use insertBefore with a createProcessingInstruction but this
does not place the PI at the start of the document. It places it after the
first node with the namespaces in "<my:myFields....><mso-" at this stage the
PI is not read and is no use.
Also when trying to create the standard "xml" PI an error message is
generated 'MSXML5.DLL This operation cannot be performed with a Node of type
XMLDECL'
The complete XML minus PI's is passed sucessfully using newsoultionwithdata.
As the data store is Sharepoint the saved XML will not open with Infopath as
the PI is missing.
I have tried to insert the PI in the new document form_load section also
without success.
Does Anyone have a solution or is this a bug?
below is some of the code
var objXMLFileAdapter = XDocument.GetDOM("ptsdata");
objXMLFileAdapter.setProperty("SelectionNamespaces",
'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2004-05-29T08:53:22" xmlns:xd="http://schemas.microsoft.com/office/infopath/2003"');
var oOutputXML = objXMLFileAdapter.documentElement;
var oOutputPIXML = oOutputXML.childNodes.item(0);
var oPIText =
objXMLFileAdapter.createProcessingInstruction("mso-application",
"progid=\"InfoPath.Document\"");
oOutputXML.insertBefore(oPIText,oOutputPIXML);
var oPI = objXMLFileAdapter.createProcessingInstruction("xml",
"version=\"1.0\"");
oOutputXML.insertBefore(oPI, oOutputXML.documentElement);
with SP1. The resulting GetDOM document no longer has the "InfoPath.Document"
PI in it.
I have tried to use insertBefore with a createProcessingInstruction but this
does not place the PI at the start of the document. It places it after the
first node with the namespaces in "<my:myFields....><mso-" at this stage the
PI is not read and is no use.
Also when trying to create the standard "xml" PI an error message is
generated 'MSXML5.DLL This operation cannot be performed with a Node of type
XMLDECL'
The complete XML minus PI's is passed sucessfully using newsoultionwithdata.
As the data store is Sharepoint the saved XML will not open with Infopath as
the PI is missing.
I have tried to insert the PI in the new document form_load section also
without success.
Does Anyone have a solution or is this a bug?
below is some of the code
var objXMLFileAdapter = XDocument.GetDOM("ptsdata");
objXMLFileAdapter.setProperty("SelectionNamespaces",
'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2004-05-29T08:53:22" xmlns:xd="http://schemas.microsoft.com/office/infopath/2003"');
var oOutputXML = objXMLFileAdapter.documentElement;
var oOutputPIXML = oOutputXML.childNodes.item(0);
var oPIText =
objXMLFileAdapter.createProcessingInstruction("mso-application",
"progid=\"InfoPath.Document\"");
oOutputXML.insertBefore(oPIText,oOutputPIXML);
var oPI = objXMLFileAdapter.createProcessingInstruction("xml",
"version=\"1.0\"");
oOutputXML.insertBefore(oPI, oOutputXML.documentElement);