XMLSampleGenerator
This transformer generates an XML document based on an XML Schema (XSD) file.While the sample document may not pass a schema validation, it will provide a generate outline of what a valid XML document looks like. The XML generated by this transformer can be used as a base for an XML template used in theXMLTemplater变压器。
In addition to generating entire XML documents, this transformer may also be used to generate small portions of an XML document. All that is required is the path to the element which is to be generated.
需要注意的是,为了防止无限递归,变压器不会产生递归复杂类型或取代基团。递归类型和取代基团将产生一次,和嵌套类型/组将不会产生。
Input Ports
There are no special requirements for the input features of this transformer. If the Path to Element parameter is set to an attribute value, the attribute should contain a valid XML path expression.
产量Ports
Features output from this transformer will have an attribute containing an XML document that was generated from the XML schema file listed in the transformer parameters.
Parameters
Schema
This parameter specifies the location of the XSD file from which the XML will be generated. It is important that the file selected for this parameter contains the definition of the element to be generated. Since it is common for an XSD file to import other XSD files, the value of this parameter may differ depending on the desired output of the transformer.
If an entire document is to be generated, you should select the "base" XSD file. If a specific element is to be generated, you might have to select a different XSD file.
This parameter serves two purposes:
- First, for XSD files that contain more than one top-level element, you can use this parameter to specify which element is to be generated.
- 其次,你可以使用这个参数,指示变压器产生不是一个顶级元素的元素。要做到这一点,进入相应的元素作为参数值的路径。例如,下面的路径可以被用于生成从所述的Collada 1.4模式的动画元素:
/COLLADA/library_animations/animation
请注意,该路径必须是正确的命名空间。即,所使用的路径元素必须的XSD架构的目标命名空间相匹配。例如,为了生成在AIXM架构中的一个日期元件,可以使用下面的路径。
aixm:HoldingPatternTimeSlice/aixm:timeSliceMetadata/gmd:MD_Metadata/gmd:dateStamp/gco:Date
This parameter may be used to exclude elements from the generated XML. Multiple element names may be entered in a space separated list. As in the path parameter, the element names in this parameter must be namespace correct; the element names must use the same namespace prefixes as the XSD files. Wildcards may be used in the element names. For example, the following value will cause all elements in the gml namespace to be excluded, along with the gmd:dateStamp element.
gml:* gmd:dateStamp
If the generated XML is being annotated with comments, a comment will be inserted for each excluded element.
XML Generation
XML架构可以指定某些XML属性为可选。如果这个参数设置为Yes,可选属性将被包括在XML输出。如果这个参数设置为无,只有XML属性标记为“需要”将被包含在输出文件内。
一个XML schema may designate the minimum and maximum number of times an element may occur in a particular location. If this parameter is set to No, only elements whose minimum number of occurrences is greater than zero will be included in the output XML document. If this parameter is set to Yes, all elements will be included at least once in the output document.
此参数控制当XML架构包含抽象的取代基的输出。
- First Member Only: This is the default value for this parameter. Only the first member of the substitution group will be generated.
- All Members: All members of the substitution group will be generated. In general, an abstract substitution group should be substituted by a single member. This parameter may be used to examine all the possible substitution group members. Using this value may lead to an output document which is very large.
- 会员号:无替换组成员将会产生。相反,如果参数“与评论注释XML”被设置为“是”,则输出将包含注释上市路径替换组成员。这些路径可以然后在另一个XMLSampleGenerator被用来生成单个置换组成员。
该参数控制的output when the XML schema contains anxs:choice。一个xs:choicelists a number of possible elements which may appear in the output.
- First Option Only: This is the default value for this parameter. Only the first option in the choice will be generated.
- 所有选项:所有的选择方案将会产生。一般情况下,一个模式有效的文档将只包含一个选项。该参数值可以用来检查所有可能的选择方案。使用该值可能导致这是非常大的输出文档。
- 无选项:没有选择的选择将会产生。相反,如果参数“与评论注释XML”被设置为“是”,则输出将包含注释上市的路径选择选项。这些路径可以然后在另一使用XMLSampleGenerator生成个性化的选择方案。请注意,只有元素的路径将被列出。嵌套序列和选择,就不会产生任何的路径。
如果这个参数设置为Yes,输出将与XML头被开头。如果该参数设置为否,则输出将不包含XML头。
If this parameter is set to Yes, the output will contain XML comments describing the output.
These comments will describe what is required to convert the sample XML into an XML document that is valid according to the given schema. This includes warnings about recursive complex types and substitution groups, details on the acceptable multiplicity of elements and information on the data types that an element may contain.
IfYes, the output will contain annotation documentation and app information from within the XML schema document that is relevant to the XML sample. The annotation content is written to XML comments in the output sample.
Result
This parameter specifies the attribute to which the XML document will be written. The default is_result。
Editing Transformer Parameters
使用一组菜单选项,变压器参数可以通过引用在工作区中的其它元件来分配。更先进的功能,如高级编辑,算术编辑,也是一些变压器可用。要访问这些选项的菜单,点击适用的参数旁边。欲了解更多信息,请参阅Transformer Parameter Menu Options。
变压器分类
FME Licensing Level
FME Professional edition and above
Technical History
FME Factory Used: XSDSamplerFactory
Search FME Community
Search for samples and information about this transformer on theFME Community。