简体   繁体   English

动态数据从XML文件加载到InfoPath表单

[英]Dynamic data loading from a XML file to InfoPath form

I have a bunch of XML files (say: xml1.xml, xml2.xml, xml3.xml...etc.) 我有一堆XML文件(例如:xml1.xml,xml2.xml,xml3.xml ...等)

Note: All the xml files have same tags (but generated for different dates). 注意:所有xml文件都具有相同的标记(但生成的日期不同)。

I also have an Info Path form with the fields same as the tags in the above xml files. 我也有一个Info Path表单,其字段与上述xml文件中的标记相同。 All I need is to "dynamically" load or populate the form with the data present inside the above XML files. 我需要的是用上述XML文件中存在的数据“动态”加载或填充表单。

FYI: When ever we start this form it should fetch the data from the xml files dynamically. 仅供参考:每当我们启动此表单时,它都应该动态地从xml文件中获取数据。

I am using InfoPath2010. 我正在使用InfoPath2010。

The only solution (I know) for importing XML files, generated by another source, into InfoPath is by editing the XML file. 将另一个来源生成的XML文件导入InfoPath的唯一解决方案(我知道)是通过编辑XML文件。

1) Analyse a XML file, which is generated by InfoPath. 1)分析由InfoPath生成的XML文件。 After the xml definition there is a mso-infoPathSolution tag. 在xml定义之后,有一个mso-infoPathSolution标记。 The file should look something like this. 该文件应如下所示。

<?xml version="1.0" encoding="ISO-8859-1"?>
<?mso-infoPathSolution solutionVersion="1.0.0.71" productVersion="12.0.0" ...

2) Copy the mso-infoPathSolution tag into the XML which you want to open with your InfoPath form. 2)将mso-infoPathSolution标记复制到要使用InfoPath表单打开的XML中。 Make sure that you copy that tag after the XML definition. 确保在XML定义之后复制该标签。

3) Open the XML file with right click and "open with..." options. 3)右键单击XML文件,然后选择“使用...打开”。 Choose InfoPath or open InfoPath and open your XML file out of InfoPath. 选择InfoPath或打开InfoPath并从InfoPath中打开XML文件。 Ready. 准备。 The data of the XML file is inside the InfoPath form. XML文件的数据在InfoPath表单内。

The editing of the header is important, because without that information InfoPath don't know how it should render the XML. 标头的编辑很重要,因为没有这些信息,InfoPath不知道应如何呈现XML。 That step could be also solved via another script. 该步骤也可以通过另一个脚本解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM