Hi RP,
I tried that code. I got this error.
System.Xml.XmlException
Unexpected XML declaration. The XML declaration must be the first node in
the document, and no white space characters are allowed to appear before it.
Line 1, position 9.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
at System.Xml.XmlTextReaderImpl.ParsePI(BufferBuilder piInDtdStringBuilder)
at System.Xml.XmlTextReaderImpl.ParseElementContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlTextReader.Read()
at System.Xml.XPath.XPathDocument.LoadFromReader(XmlReader reader,
XmlSpace space)
at System.Xml.XPath.XPathDocument..ctor(XmlReader reader, XmlSpace space)
at System.Xml.Xsl.Runtime.XmlQueryContext.ConstructDocument(Object
dataSource, String uriRelative, Uri uriResolved)
at System.Xml.Xsl.Runtime.XmlQueryContext..ctor(XmlQueryRuntime runtime,
Object defaultDataSource, XmlResolver dataSources, XsltArgumentList argList,
WhitespaceRuleLookup wsRules)
at System.Xml.Xsl.Runtime.XmlQueryRuntime..ctor(XmlILCommand cmd, Object
defaultDataSource, XmlResolver dataSources, XsltArgumentList argList,
XmlSequenceWriter seqWrt)
at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument,
XmlResolver dataSources, XsltArgumentList argumentList, XmlSequenceWriter
results)
at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument,
XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer,
Boolean closeWriter)
at System.Xml.Xsl.XmlILCommand.Execute(XmlReader contextDocument,
XmlResolver dataSources, XsltArgumentList argumentList, TextWriter results)
at System.Xml.Xsl.XslCompiledTransform.Transform(XmlReader input,
XsltArgumentList arguments, TextWriter results)
at Microsoft.Office.InfoPath.MsxmlWriter.Close()
at System.Xml.XmlWellFormedWriter.Close()
at System.Xml.XPath.XPathNavigator.AppendChild(XmlReader newChild)
at System.Xml.XPath.XPathNavigator.AppendChild(String newChild)
at Microsoft.Office.InfoPath.MsxmlNavigator.set_InnerXml(String value)
at ListofNames.FormCode.FormEvents_Loading(Object sender,
LoadingEventArgs e)
at
Microsoft.Office.InfoPath.Internal.FormEventsHost.OnLoad(DocReturnEvent
pEvent)
at
Microsoft.Office.Interop.InfoPath.SemiTrust._XDocumentEventSink2_SinkHelper.OnLoad(DocReturnEvent pEvent)
Please help. Thanks
> Do the following on FormEvents_Loading event:
>
[quoted text clipped - 8 lines]
> Hth,
> RP
RP - 26 Jun 2007 17:50 GMT
It appears that we have to select the root node and have to transfer
XML.
Use the following steps in FormEvents_Loading:
XPathNavigator xpnA = DataSources["A"].CreateNavigator();
XPathNavigator xpnB = DataSources["B"].CreateNavigator();
XPathNavigator xpnARoot = xpnA.SelectSingleNode("/my:RootNode",
this.NamespaceManager);
XPathNavigator xpnBRoot = xpnB.SelectSingleNode("/my:RootNode",
this.NamespaceManager);
xpnARoot.InnerXml = xpnBRoot.InnerXml;
Also, make sure A and B follows the same schema.
Hth,
RP
Dotnetdev - 05 Jul 2007 14:10 GMT
Hi RP,
Still I'm having an error. The error is this - System.NullReferenceException
Object reference not set to an instance of an object.
at ListofNames.FormCode.FormEvents_Loading(Object sender,
LoadingEventArgs e)
at
Microsoft.Office.InfoPath.Internal.FormEventsHost.OnLoad(DocReturnEvent
pEvent)
at
Microsoft.Office.Interop.InfoPath.SemiTrust._XDocumentEventSink2_SinkHelper.OnLoad(DocReturnEvent pEvent)
Please help
Thank you very much
> It appears that we have to select the root node and have to transfer
> XML.
[quoted text clipped - 15 lines]
> Hth,
> RP