Infopath入门到精通系列-3 Infopath manifest.xsf文件 解析

1、Infopath 介绍

Infopath工具保存后默认生成xsn格式的文件。
在这里插入图片描述
将上图中的文件后缀名修改为全国面上广告申请.zip 并进行解压。如下图所示:
在这里插入图片描述
效果图如下:
在这里插入图片描述

2、manifest.xsf文件说明

manifest.xsf文件内容如下:

<?xml version="1.0" encoding="UTF-8"?>
<!--
此文件由 Microsoft InfoPath 自动创建和修改。
如果在 InfoPath 中修改表单模板,则在 InfoPath 以外对文件所做的更改可能会丢失。
-->
<xsf:xDocumentClass trustSetting="automatic" trustLevel="restricted" solutionFormatVersion="15.0.0.0" publishUrl="C:\Users\Administrator\Desktop\全国面上广告申请.xsn" solutionVersion="1.0.0.10" name="urn:schemas-microsoft-com:office:infopath:XmR-o-cg:-myXSD-2021-08-11T07-06-00" productVersion="15.0.0" xmlns:xsf="http://schemas.microsoft.com/office/infopath/2003/solutionDefinition" xmlns:xsf2="http://schemas.microsoft.com/office/infopath/2006/solutionDefinition/extensions" xmlns:xsf3="http://schemas.microsoft.com/office/infopath/2009/solutionDefinition/extensions" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:xd="http://schemas.microsoft.com/office/infopath/2003" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xdUtil="http://schemas.microsoft.com/office/infopath/2003/xslt/Util" xmlns:xdXDocument="http://schemas.microsoft.com/office/infopath/2003/xslt/xDocument" xmlns:xdMath="http://schemas.microsoft.com/office/infopath/2003/xslt/Math" xmlns:xdDate="http://schemas.microsoft.com/office/infopath/2003/xslt/Date" xmlns:xdExtension="http://schemas.microsoft.com/office/infopath/2003/xslt/extension" xmlns:xdEnvironment="http://schemas.microsoft.com/office/infopath/2006/xslt/environment" xmlns:xdUser="http://schemas.microsoft.com/office/infopath/2006/xslt/User" xmlns:xdServerInfo="http://schemas.microsoft.com/office/infopath/2009/xslt/ServerInfo" xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2021-08-11T07:06:00">
	<xsf:package>
		<xsf:files>
			<xsf:file name="myschema.xsd">
				<xsf:fileProperties>
					<xsf:property name="namespace" type="string" value="http://schemas.microsoft.com/office/infopath/2003/myXSD/2021-08-11T07:06:00"></xsf:property>
					<xsf:property name="editability" type="string" value="full"></xsf:property>
					<xsf:property name="rootElement" type="string" value="myFields"></xsf:property>
					<xsf:property name="useOnDemandAlgorithm" type="string" value="yes"></xsf:property>
				</xsf:fileProperties>
			</xsf:file>
			<xsf:file name="template.xml"></xsf:file>
			<xsf:file name="sampledata.xml">
				<xsf:fileProperties>
					<xsf:property name="fileType" type="string" value="sampleData"></xsf:property>
				</xsf:fileProperties>
			</xsf:file>
			<xsf:file name="view1.xsl">
				<xsf:fileProperties>
					<xsf:property name="lang" type="string" value="2052"></xsf:property>
					<xsf:property name="componentId" type="string" value="46"></xsf:property>
					<xsf:property name="xmlToEditName" type="string" value="46"></xsf:property>
				</xsf:fileProperties>
			</xsf:file>
			<xsf:file name="upgrade.xsl"></xsf:file>
		</xsf:files>
	</xsf:package>
	<xsf:importParameters enabled="yes"></xsf:importParameters>
	<xsf:documentVersionUpgrade>
		<xsf:useTransform transform="upgrade.xsl" minVersionToUpgrade="0.0.0.0" maxVersionToUpgrade="1.0.0.9"></xsf:useTransform>
	</xsf:documentVersionUpgrade>
	<xsf:extensions>
		<xsf:extension name="SolutionDefinitionExtensions">
			<xsf2:solutionDefinition runtimeCompatibility="client server">
				<xsf2:offline openIfQueryFails="yes" cacheQueries="yes"></xsf2:offline>
				<xsf2:server formLocale="zh-CN" isPreSubmitPostBackEnabled="no" isMobileEnabled="no"></xsf2:server>
			</xsf2:solutionDefinition>
		</xsf:extension>
	</xsf:extensions>
	<xsf:views default="视图 1">
		<xsf:view name="视图 1" caption="视图 1">
			<xsf:mainpane transform="view1.xsl"></xsf:mainpane>
			<xsf:editing>
				<xsf:xmlToEdit name="组2_46" item="/my:myFields/my:组1/my:组2" container="/my:myFields">
					<xsf:editWith caption="组2" xd:autogeneration="template" component="xCollection">
						<xsf:fragmentToInsert>
							<xsf:chooseFragment innerFragment="my:组1/my:组2">
								<my:组1>
									<my:组2>
										<my:行项目号></my:行项目号>
										<my:费用类型></my:费用类型>
										<my:媒体大类></my:媒体大类>
										<my:媒体小类></my:媒体小类>
										<my:活动形式></my:活动形式>
										<my:推广品牌id></my:推广品牌id>
										<my:推广品牌></my:推广品牌>
										<my:数量></my:数量>
										<my:单位></my:单位>
										<my:申请金额></my:申请金额>
										<my:厂方支持比例></my:厂方支持比例>
										<my:考核大区></my:考核大区>
										<my:考核比例></my:考核比例>
										<my:考核金额></my:考核金额>
										<my:审核金额></my:审核金额>
									</my:组2>
								</my:组1>
							</xsf:chooseFragment>
						</xsf:fragmentToInsert>
					</xsf:editWith>
				</xsf:xmlToEdit>
			</xsf:editing>
			<xsf:menuArea name="msoStructuralEditingContextMenu">
				<xsf:button action="xCollection::insertBefore" xmlToEdit="组2_46" caption="在前面插入 组2" showIf="immediate"></xsf:button>
				<xsf:button action="xCollection::insertAfter" xmlToEdit="组2_46" caption="在后面插入 组2" showIf="immediate"></xsf:button>
				<xsf:button action="xCollection::remove" xmlToEdit="组2_46" caption="删除 组2" showIf="immediate"></xsf:button>
				<xsf:button action="xCollection::insert" xmlToEdit="组2_46" caption="插入 组2" showIf="immediate"></xsf:button>
			</xsf:menuArea>
		</xsf:view>
	</xsf:views>
	<xsf:applicationParameters application="InfoPath Design Mode">
		<xsf:solutionProperties lastOpenView="view1.xsl" fullyEditableNamespace="http://schemas.microsoft.com/office/infopath/2003/myXSD/2021-08-11T07:06:00" lastVersionNeedingTransform="1.0.0.9"></xsf:solutionProperties>
	</xsf:applicationParameters>
	<xsf:documentSchemas>
		<xsf:documentSchema rootSchema="yes" location="http://schemas.microsoft.com/office/infopath/2003/myXSD/2021-08-11T07:06:00 myschema.xsd"></xsf:documentSchema>
	</xsf:documentSchemas>
	<xsf:fileNew>
		<xsf:initialXmlDocument caption="全国面上广告申请" href="template.xml"></xsf:initialXmlDocument>
	</xsf:fileNew>
</xsf:xDocumentClass>

3、manifest.xsf文件属性

manifest.xsf文件内容有如下几个标签构成:
xDocumentClass 标签,记录如下几个比较核心的属性:

solutionVersion: 方案版本
name:名称
productVersion: infopath客户端的版本15.0.0 是infpth2010后的版本。
publishUrl:发布地址
xmlns:my: 命名空间,系统自动生成。http://schemas.microsoft.com/office/infopath/2003/myXSD/+保存的时间

4、manifest.xsf文件 package标签

package维其他文件的路径,包含files和file。
记录myschema.xsd、template.xml、sampledata.xml、view1.xsl(可能是多个视图)、upgrade.xsl

  <xsf:package>
        <xsf:files>
            <xsf:file name="myschema.xsd">
                <xsf:fileProperties>
                    <xsf:property name="namespace" type="string"
                                  value="http://schemas.microsoft.com/office/infopath/2003/myXSD/2021-08-11T07:06:00"></xsf:property>
                    <xsf:property name="editability" type="string" value="full"></xsf:property>
                    <xsf:property name="rootElement" type="string" value="myFields"></xsf:property>
                    <xsf:property name="useOnDemandAlgorithm" type="string" value="yes"></xsf:property>
                </xsf:fileProperties>
            </xsf:file>
            <xsf:file name="template.xml"></xsf:file>
            <xsf:file name="sampledata.xml">
                <xsf:fileProperties>
                    <xsf:property name="fileType" type="string" value="sampleData"></xsf:property>
                </xsf:fileProperties>
            </xsf:file>
            <xsf:file name="view1.xsl">
                <xsf:fileProperties>
                    <xsf:property name="lang" type="string" value="2052"></xsf:property>
                    <xsf:property name="componentId" type="string" value="46"></xsf:property>
                    <xsf:property name="xmlToEditName" type="string" value="46"></xsf:property>
                </xsf:fileProperties>
            </xsf:file>
            <xsf:file name="upgrade.xsl"></xsf:file>
        </xsf:files>
    </xsf:package>

4、manifest.xsf文件extensions标签

extensions标签主要是记录是否进行了文件的国际化操作。

 <xsf:extensions>
        <xsf:extension name="SolutionDefinitionExtensions">
            <xsf2:solutionDefinition runtimeCompatibility="client server">
                <xsf2:offline openIfQueryFails="yes" cacheQueries="yes"></xsf2:offline>
                <xsf2:server formLocale="zh-CN" isPreSubmitPostBackEnabled="no" isMobileEnabled="no"></xsf2:server>
            </xsf2:solutionDefinition>
        </xsf:extension>
    </xsf:extensions>

5、manifest.xsf文件documentVersionUpgrade标签

documentVersionUpgrade标签记录当前文件是infopath哪个版本绘制的(minVersionToUpgrade),并可能使用的最新的infopath版本(maxVersionToUpgrade)。

 <xsf:documentVersionUpgrade>
        <xsf:useTransform transform="upgrade.xsl" minVersionToUpgrade="0.0.0.0"
                          maxVersionToUpgrade="1.0.0.9"></xsf:useTransform>
    </xsf:documentVersionUpgrade>

6、manifest.xsf文件views标签

views 通俗的理解就是infopath最终生成的html文件名称和位置、元数据信息等。
name 视图名称,一个文件可以有多个视图。每一个视图就是一个html文件,里面包含了元数据信息等。

  <xsf:view name="视图 1" caption="视图 1">
            <xsf:mainpane transform="view1.xsl"></xsf:mainpane>
            <xsf:editing>
                <xsf:xmlToEdit name="组2_46" item="/my:myFields/my:组1/my:组2" container="/my:myFields">
                    <xsf:editWith caption="组2" xd:autogeneration="template" component="xCollection">
                        <xsf:fragmentToInsert>
                            <xsf:chooseFragment innerFragment="my:组1/my:组2">
                                <my:组1>
                                    <my:组2>
                                        <my:行项目号></my:行项目号>
                                        <my:费用类型></my:费用类型>
                                        <my:媒体大类></my:媒体大类>
                                        <my:媒体小类></my:媒体小类>
                                        <my:活动形式></my:活动形式>
                                        <my:推广品牌id></my:推广品牌id>
                                        <my:推广品牌></my:推广品牌>
                                        <my:数量></my:数量>
                                        <my:单位></my:单位>
                                        <my:申请金额></my:申请金额>
                                        <my:厂方支持比例></my:厂方支持比例>
                                        <my:考核大区></my:考核大区>
                                        <my:考核比例></my:考核比例>
                                        <my:考核金额></my:考核金额>
                                        <my:审核金额></my:审核金额>
                                    </my:组2>
                                </my:组1>
                            </xsf:chooseFragment>
                        </xsf:fragmentToInsert>
                    </xsf:editWith>
                </xsf:xmlToEdit>
            </xsf:editing>
            <xsf:menuArea name="msoStructuralEditingContextMenu">
                <xsf:button action="xCollection::insertBefore" xmlToEdit="组2_46" caption="在前面插入 组2"
                            showIf="immediate"></xsf:button>
                <xsf:button action="xCollection::insertAfter" xmlToEdit="组2_46" caption="在后面插入 组2"
                            showIf="immediate"></xsf:button>
                <xsf:button action="xCollection::remove" xmlToEdit="组2_46" caption="删除 组2"
                            showIf="immediate"></xsf:button>
                <xsf:button action="xCollection::insert" xmlToEdit="组2_46" caption="插入 组2"
                            showIf="immediate"></xsf:button>
            </xsf:menuArea>
        </xsf:view>

7、manifest.xsf文件java解析

下面代码包含上述代码结构中属性的解析
String fManifest = loadResource("manifest.xsf");
 public String loadResource(String aResourceName) {
        if (this.fResourceProvider != null) {
            return this.fResourceProvider.loadResource(aResourceName);
        }
        return null;
    }
         try {
            Document xsfdocument = DocumentHelper.parseText(fManifest);

            PaseXMLMain(xsfdocument.getRootElement());
            convertViewList(getViewList());
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
            throw new BusinessException(e.getMessage());
        }
           for (Iterator<Attribute> a = aelement.attributeIterator(); a.hasNext(); ) {
            Attribute tattribute = a.next();
            if (tattribute.getName().equals("publishUrl")) {
                this.publishUrl = fCurrentCharSet.selfXML2JDK(tattribute.getValue());
                continue;
            }
            if (tattribute.getName().equals("solutionVersion")) {

                this.solutionVersion = fCurrentCharSet.selfXML2JDK(tattribute
                        .getValue());
                continue;
            }
            if (tattribute.getName().equals("productVersion")) {

                this.productVersion = fCurrentCharSet.selfXML2JDK(tattribute
                        .getValue());
                continue;
            }
            if (tattribute.getName().equals("solutionFormatVersion")) {
                this.solutionFormatVersion = fCurrentCharSet.selfXML2JDK(tattribute
                        .getValue());
            }
        }
    

infopath地址:https://gitee.com/pangu-dm/infopath

上面文章来自盘古BPM研究院:http://vue.pangubpm.com/
文章翻译提交:https://github.com/qiudaoke/flowable-userguide
了解更多文章可以关注微信公众号:
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值