xml-point

This is a non-composite builder that construct one point geometry object.

builder type: non-composite.

geometry constructed: point geometry.

data parameters:

Data Name

Value

Required/
Optional

data-string

The string containing the coordinate data.

Range: String

Required

axis-order

Indicates the axis for a coordinate.

Range: A permutation of the numbers 1..N, where N is the number of dimensions.

Each number is separated by a comma “,”.

Default: “1,2,...,N”

Optional

dimension

The dimension of the coordinates.

Range: String representing a positive integer, or the “implicit” literal, which forces the dimension to be automaticallly determined even if axis-order is specified.

Default: When not specified the dimension will be automatically determined.

Optional

axis-separator

The string separating each axis of a coordinate in the data-string.

Range: String | “whitespace” this includes the tab, newline, and space characters.

Default: “,”

Optional

coord-separator

The string separating each coordinate in the data-string.

Range: String

Default:whitespace” this includes the tab, newline, and space characters.

Optional

decimal

The string representing the decimal point for each real number in the data-string.

Range: String

Default: “.”

Optional

coordinate-system

Specifies the coordinate system name. If the expression sequence for the coordinate-system evaluates to the empty string, then the coordinate system for the feature being built will not be set.

Range: String

Optional

name

Specifies the geometry’s name.

Range: String

Optional

The following sequence of examples illustrates the usage of the xml-point builder.

Example 1

The following xml_point1.xmp xfMap document maps a <point> element from the xml_point1.xml input XML document. Notice that the mapping rule matching the <point> element has a <geometry> element that specifies an xml-point geometry builder. We assume all the default values for the xml-point data parameters, so we only specify the required one, the data-string parameter.

xml_point1.xml

<?xml version="1.0"?>
<point id="0">0.945,78.970</point>

xml_point1.xmp

<?xml version="1.0"?>
<!DOCTYPE xfMap SYSTEM "xfMap.dtd">
<xfMap>
	<feature-map>
		<mapping match="point">
			<geometry activate="xml-point">
				<data name="data-string"> <extract expr="."/> </data>				
		  </geometry>
	     </mapping>
	</feature-map>
</xfMap>

FME feature constructed:

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Feature Type: '
Attribute: fme_geometry' has value fme_point'
Attribute: xml_type' has value xml_point'
Geometry Type: Point (1)
Number of Coordinates: 1 -- Coordinate Dimension: 2 -- Coordinate System: '
(0.945,78.97)
++========================================================================

Example 2

This is example is a little bit more complicated than the previous one. It illustrates several ways in which the xml-point data parameters may be used to map the information from the input XML elements into a point geometry. Please refer to the comments in the example for details.

xml_point2.xml

<?xml version="1.0"?>
<points>
	<point-A type="xy">8.8,2.5</point-A>	
	<point-A type="xyz">97.97,92.5,-35.8</point-A>
	<point-A type="yxz">29,-77.9,0.0</point-A>

	<point-B>89,07 89,06 89,05</point-B>

	<point-C x="10.0" y="5.0"/>
</points>

xml_point2.xmp

<?xml version="1.0"?>
<!DOCTYPE xfMap SYSTEM "xfMap.dtd">

<xfMap>
	<feature-map>
		<mapping match="point-A[@type=’xy’ or @type=’xyz’]">
		<!-- This mapping rule activates when the start-tag of a
			point-A element having a type of xy or xyz is read. -->
			<feature-type> 
				<literal expr="point-A-"/> <extract expr="@type"/>
			</feature-type>
			<!-- We use the default values for the other data parameters.
				Therefore we only need to supply the data-string parameter. -->
			<geometry activate="xml-point">
				<data name="data-string"> <extract expr="."/> </data>
			</geometry>
		</mapping>

		<mapping match="point-A[@type=’yxz’]">
			<!-- This mapping rule activates when the start-tag of a
			point-A element having a type yxz is read. -->
			<feature-type> <literal expr="point-A-yxz"/> </feature-type>
			<!-- The axis-order specifies the order of the axis of the 
				coordinates in the data-string back to x,y,z order. -->
			<geometry activate="xml-point">
				<data name="data-string"> <extract expr="."/> </data>
				<data name="axis-order"> <literal expr="2,1,3"/> </data>
			</geometry>
		</mapping>

		<mapping match="point-B">
			<!-- Match the point-B element. -->
			<feature-type> <literal expr="point-B"/> </feature-type>
			<!-- Notice that the point-B element has as its decimal the comma 
				character, and the axis separator is whitespace. We specify
				the dimension as well, because when the axis-separator
				and the coord-separator equal in value, then the dimension
				cannot be determine implicitly (both axis and 
				coord (the default value) separator are whitespace). -->
			<geometry activate="xml-point">
				<data name="data-string"> <extract expr="."/> </data>
				<data name="dimension"> <literal expr="3"/> </data>
				<data name="decimal"> <literal expr=","/> </data>
				<data name="axis-separator"> 
					<literal expr="whitespace"/> 
				</data>
			</geometry>
		</mapping>

		<mapping match="point-C">
			<!-- Match the point-C element. -->
			<feature-type> <literal expr="point-C"/> </feature-type>
			<geometry activate="xml-point">
				<!-- The xml-point builder parses a coordinate string. So 
					using an expression sequence we construct the coordinate 
					string such that it’s axis-separator is the comma (which is 
					default value), and we give this expression sequence as
					the value of the data-string parameter. -->
				<data name="data-string">
					<extract expr="@x"/> <literal expr=","/> <extract expr="@y"/>
				</data>
			</geometry>
		</mapping>
	</feature-map>
</xfMap>

FME features constructed:

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Feature Type: point-A-xy'
Attribute: fme_geometry' has value fme_point'
Attribute: xml_type' has value xml_point'
Geometry Type: Point (1)
Number of Coordinates: 1 -- Coordinate Dimension: 2 -- Coordinate System: '
(8.8,2.5)
==========================================================================
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Feature Type: point-A-xyz'
Attribute: fme_geometry' has value fme_point'
Attribute: xml_type' has value xml_point'
Geometry Type: Point (1)
Number of Coordinates: 1 -- Coordinate Dimension: 3 -- Coordinate System: '
(97.97,92.5,-35.8)
==========================================================================
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Feature Type: point-A-yxz'
Attribute: fme_geometry' has value fme_point'
Attribute: xml_type' has value xml_point'
Geometry Type: Point (1)
Number of Coordinates: 1 -- Coordinate Dimension: 3 -- Coordinate System: '
(-77.9,29,0)
==========================================================================
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Feature Type: point-B'
Attribute: fme_geometry' has value fme_point'
Attribute: xml_type' has value xml_point'
Geometry Type: Point (1)
Number of Coordinates: 1 -- Coordinate Dimension: 3 -- Coordinate System: '
(89.07,89.06,89.05)
==========================================================================
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Feature Type: point-C'
Attribute: fme_geometry' has value fme_point'
Attribute: xml_type' has value xml_point'
Geometry Type: Point (1)
Number of Coordinates: 1 -- Coordinate Dimension: 2 -- Coordinate System: '
(10,5)
==========================================================================