3

I am wondering if I am missing something. I am exporting some records from an Oracle dB to a GML2 file using FME. When I validate the resulting XML using online validators I don't find any errors. However when I do the same in the FME validator I find an error. I am a bit surprised by this because the XSD and GML were created by FME. I am missing something?

This is the GML:

<?xml version="1.0" encoding="UTF-8"?>
<gml2:FeatureCollection xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:gml="http://www.opengis.net/gml" xmlns:gml2="http://www.safe.com/gml2"
    xsi:schemaLocation="http://www.safe.com/gml2 test150319.xsd">
    <gml:boundedBy>
        <gml:Box srsName="Belge72/b.Lambert72A">
            <gml:coordinates>147564.292837459,169483.720090068
                155018.586173778,170709.282900002</gml:coordinates>
        </gml:Box>
    </gml:boundedBy>
    <gml:featureMember>
        <gml2:Phase>
            <gml2:ID_WS>144867</gml2:ID_WS>
            <gml2:ID_PH>131287</gml2:ID_PH>
            <gml2:PHASE_NR>1</gml2:PHASE_NR>
            <gml2:PH_LABEL_FR>t</gml2:PH_LABEL_FR>
            <gml:polygonProperty>
                <gml:Polygon srsName="Belge72/b.Lambert72A">
                    <gml:outerBoundaryIs>
                        <gml:LinearRing>
                            <gml:coordinates>149341.165739052,170441.977127987
                                149338.619169854,170441.128271587 149339.603843277,170440.3473237
                                149340.690379468,170441.671539683
                                149341.165739052,170441.977127987</gml:coordinates>
                        </gml:LinearRing>
                    </gml:outerBoundaryIs>
                </gml:Polygon>
            </gml:polygonProperty>
        </gml2:Phase>
    </gml:featureMember>
    <gml:featureMember>
        <gml2:Phase>
            <gml2:ID_WS>144905</gml2:ID_WS>
            <gml2:ID_PH>131295</gml2:ID_PH>
            <gml2:PHASE_NR>1</gml2:PHASE_NR>
            <gml2:PH_LABEL_FR>tger</gml2:PH_LABEL_FR>
            <gml:multiPolygonProperty>
                <gml:MultiPolygon srsName="Belge72/b.Lambert72A">
                    <gml:polygonMember>
                        <gml:Polygon>
                            <gml:outerBoundaryIs>
                                <gml:LinearRing>
                                    <gml:coordinates>149482.636142112,169490.782575311
                                        149482.690468922,169490.741830204
                                        149482.704050624,169490.816529567
                                        149482.636142112,169490.782575311</gml:coordinates>
                                </gml:LinearRing>
                            </gml:outerBoundaryIs>
                        </gml:Polygon>
                    </gml:polygonMember>
                    <gml:polygonMember>
                        <gml:Polygon>
                            <gml:outerBoundaryIs>
                                <gml:LinearRing>
                                    <gml:coordinates>149478.035889741,169488.583083256
                                        149480.395161218,169488.032280577
                                        149480.055618658,169489.084862512
                                        149481.481697409,169489.933718911
                                        149481.685422945,169488.643457185
                                        149482.500325088,169487.930417809
                                        149481.413788897,169490.443032751
                                        149482.432416576,169491.020255103
                                        149483.518952768,169491.80120299
                                        149483.41709,169490.307215727
                                        149482.90777616,169490.578849775
                                        149482.690468922,169490.741830204
                                        149482.364508064,169488.949045488
                                        149489.732581611,169493.804504092
                                        149482.64411965,169492.338844664
                                        149478.035889741,169488.583083256</gml:coordinates>
                                </gml:LinearRing>
                            </gml:outerBoundaryIs>
                        </gml:Polygon>
                    </gml:polygonMember>
                </gml:MultiPolygon>
            </gml:multiPolygonProperty>
        </gml2:Phase>
    </gml:featureMember>
    <gml:featureMember>
        <gml2:Phase>
            <gml2:ID_WS>145047</gml2:ID_WS>
            <gml2:ID_PH>131477</gml2:ID_PH>
            <gml2:PHASE_NR>1</gml2:PHASE_NR>
            <gml2:PH_LABEL_FR>bt</gml2:PH_LABEL_FR>
            <gml:multiPolygonProperty>
                <gml:MultiPolygon srsName="Belge72/b.Lambert72A">
                    <gml:polygonMember>
                        <gml:Polygon>
                            <gml:outerBoundaryIs>
                                <gml:LinearRing>
                                    <gml:coordinates>148630.413144067,169672.936644896
                                        148629.493986715,169669.916556453
                                        148630.504645902,169669.242048637
                                        148631.098116079,169672.479158694
                                        148630.413144067,169672.936644896</gml:coordinates>
                                </gml:LinearRing>
                            </gml:outerBoundaryIs>
                        </gml:Polygon>
                    </gml:polygonMember>
                    <gml:polygonMember>
                        <gml:Polygon>
                            <gml:outerBoundaryIs>
                                <gml:LinearRing>
                                    <gml:coordinates>148628.224700298,169670.763670515
                                        148630.239169926,169673.052840547
                                        148629.500478037,169673.546205736
                                        148627.748993945,169671.081154052
                                        148628.224700298,169670.763670515</gml:coordinates>
                                </gml:LinearRing>
                            </gml:outerBoundaryIs>
                        </gml:Polygon>
                    </gml:polygonMember>
                </gml:MultiPolygon>
            </gml:multiPolygonProperty>
        </gml2:Phase>
    </gml:featureMember>
    <gml:featureMember>
        <gml2:Phase>
            <gml2:ID_WS>144860</gml2:ID_WS>
            <gml2:ID_PH>131270</gml2:ID_PH>
            <gml2:PHASE_NR>1</gml2:PHASE_NR>
            <gml2:PH_LABEL_FR>testAF</gml2:PH_LABEL_FR>
            <gml:polygonProperty>
                <gml:Polygon srsName="Belge72/b.Lambert72A">
                    <gml:outerBoundaryIs>
                        <gml:LinearRing>
                            <gml:coordinates>147564.292837459,170636.967730531
                                147603.579599999,170594.487799998 147603.497599997,170593.274799999
                                147603.4146,170592.061799999 147603.063000001,170591.742600001
                                147615.469400004,170586.535999998 147623.342600003,170593.627799999
                                147638.200599998,170607.011799999 147639.613600001,170606.9758
                                147641.026600003,170606.9408 147666.318599999,170578.777800001
                                147656.088233674,170569.489371012 147668.280400001,170564.372699998
                                147683.421599999,170578.073800001 147649.792599998,170614.812800001
                                147649.841600001,170616.175799999 147649.890600003,170617.538800001
                                147678.325599998,170643.090799998 147679.848099999,170643.451000001
                                147674.349317636,170654.737969355 147672.519599997,170654.349800002
                                147655.899599999,170638.899799999 147651.129600003,170634.619800001
                                147642.4058,170626.818100002 147640.928000003,170627.262699999
                                147639.740099996,170627.6208 147638.294500001,170634.9307
                                147637.403499998,170639.260299999 147636.056000002,170645.519200001
                                147635.1549,170650.096500002 147634.123400003,170654.904399998
                                147633.228299998,170659.438499998 147632.270400003,170664.0317
                                147631.2918,170668.772100002 147629.355899997,170678.0539
                                147627.791900001,170685.541499998 147625.239,170697.345199998
                                147624.014200002,170703.137899999 147623.041900001,170707.736699998
                                147622.715000004,170709.282900002
                                147564.292837459,170636.967730531</gml:coordinates>
                        </gml:LinearRing>
                    </gml:outerBoundaryIs>
                    <gml:innerBoundaryIs>
                        <gml:LinearRing>
                            <gml:coordinates>147573.808499999,170645.205600001
                                147573.847099997,170646.543900002 147573.889600001,170648.019499999
                                147577.029600002,170650.835000001 147580.429700002,170653.878899999
                                147583.851300001,170656.967999998 147588.773199998,170661.469300002
                                147594.347199999,170666.545699999 147598.875100002,170670.6402
                                147603.443999998,170674.703899998 147613.197499998,170683.7744
                                147614.529700004,170683.265700001 147616.013800003,170682.699099999
                                147618.750299998,170669.7619 147626.594800003,170633.180100001
                                147628.295199998,170625.3028 147630.197400004,170616.194600001
                                147615.269599997,170602.5898 147613.964599997,170602.639800001
                                147612.659599997,170602.689800002
                                147573.808499999,170645.205600001</gml:coordinates>
                        </gml:LinearRing>
                    </gml:innerBoundaryIs>
                </gml:Polygon>
            </gml:polygonProperty>
        </gml2:Phase>
    </gml:featureMember>
    <gml:featureMember>
        <gml2:Phase>
            <gml2:ID_WS>144906</gml2:ID_WS>
            <gml2:ID_PH>131296</gml2:ID_PH>
            <gml2:PHASE_NR>1</gml2:PHASE_NR>
            <gml2:PH_LABEL_FR>kkkk</gml2:PH_LABEL_FR>
            <gml:multiPolygonProperty>
                <gml:MultiPolygon srsName="Belge72/b.Lambert72A">
                    <gml:polygonMember>
                        <gml:Polygon>
                            <gml:outerBoundaryIs>
                                <gml:LinearRing>
                                    <gml:coordinates>149477.641683782,169484.750925945
                                        149487.698810674,169487.368833162
                                        149501.599112927,169498.703068288
                                        149502.601244624,169499.848361656
                                        149502.932587541,169499.790376645 149504.2196,169500.8398
                                        149504.024037521,169501.128303063
                                        149477.641683782,169484.750925945</gml:coordinates>
                                </gml:LinearRing>
                            </gml:outerBoundaryIs>
                        </gml:Polygon>
                    </gml:polygonMember>
                    <gml:polygonMember>
                        <gml:Polygon>
                            <gml:outerBoundaryIs>
                                <gml:LinearRing>
                                    <gml:coordinates>149477.203461157,169484.63685498
                                        149475.981107942,169483.720090068
                                        149477.641683782,169484.750925945
                                        149477.203461157,169484.63685498</gml:coordinates>
                                </gml:LinearRing>
                            </gml:outerBoundaryIs>
                        </gml:Polygon>
                    </gml:polygonMember>
                </gml:MultiPolygon>
            </gml:multiPolygonProperty>
        </gml2:Phase>
    </gml:featureMember>
    <gml:featureMember>
        <gml2:Phase>
            <gml2:ID_WS>145102</gml2:ID_WS>
            <gml2:ID_PH>131544</gml2:ID_PH>
            <gml2:PHASE_NR>1</gml2:PHASE_NR>
            <gml2:PH_LABEL_FR>Travaux de voirie et d'infrastructure Rue Velle</gml2:PH_LABEL_FR>
            <gml:polygonProperty>
                <gml:Polygon srsName="Belge72/b.Lambert72A">
                    <gml:outerBoundaryIs>
                        <gml:LinearRing>
                            <gml:coordinates>155015.37335602,170641.183474167
                                155017.000166853,170641.319040978 155017.219893597,170641.653026962
                                155018.586173778,170643.913977923 155017.542434096,170644.098169703
                                155015.37335602,170641.183474167</gml:coordinates>
                        </gml:LinearRing>
                    </gml:outerBoundaryIs>
                </gml:Polygon>
            </gml:polygonProperty>
        </gml2:Phase>
    </gml:featureMember>
</gml2:FeatureCollection>

and the XSD:

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns:gml2="http://www.safe.com/gml2" 
    xmlns:xlink="http://www.w3.org/1999/xlink" 
    xmlns:gml="http://www.opengis.net/gml" xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.safe.com/gml2" elementFormDefault="qualified">
    <import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengis.net/gml/2.1.2/feature.xsd"/>
    <element name="FeatureCollection" type="gml2:FeatureCollectionType" substitutionGroup="gml:_FeatureCollection"/>
    <element name="Phase" type="gml2:PhaseType" substitutionGroup="gml:_Feature"/>   
    <complexType name="FeatureCollectionType">
        <complexContent>
            <extension base="gml:AbstractFeatureCollectionType">
            </extension>
        </complexContent>
    </complexType>
    <complexType name="PhaseType">
        <complexContent>
            <extension base="gml:AbstractFeatureType">
                <sequence>
                    <element name="ID_WS" type="long"/>
                    <element name="ID_PH" type="long"/>
                    <element name="PHASE_NR" type="long"/>
                    <element name="PH_LABEL_FR">
                        <simpleType>
                            <restriction base="string">
                                <maxLength value="500"/>
                            </restriction>
                        </simpleType></element>
                    <choice>
                        <element ref="gml:polygonProperty"/>
                        <element ref="gml:multiPolygonProperty"/>
                    </choice>
                </sequence>
            </extension>
        </complexContent>
    </complexType>
</schema>

And this is the error I have:

Feature Type    Inspector_2
Coordinate System    Unknown
Dimension    2D
Number of Vertices    0
Min Extents    nan, nan
Max Extents    nan, nan
Attributes (19)
    _creation_instance (32 bit unsigned integer)    0
    _xml_error{0}.col (string)    41
    _xml_error{0}.desc (string)    no declaration found for element 'gml:Box'
    _xml_error{0}.file (string)    C:\Users\Me\Desktop\GML\test150319.gml
    _xml_error{0}.line (string)    4
    _xml_error{0}.type (string)    Error
    _xml_error{1}.col (string)    41
    _xml_error{1}.desc (string)    attribute 'srsName' is not declared for element 'gml:Box'
    _xml_error{1}.file (string)    C:\Users\Me\Desktop\GML\test150319.gml
    _xml_error{1}.line (string)    4
    _xml_error{1}.type (string)    Error
    _xml_error{2}.col (string)    17
    _xml_error{2}.desc (string)    element 'gml:Box' is not allowed for content model '((Envelope|Null))'
    _xml_error{2}.file (string)    C:\Users\Me\Desktop\GML\test150319.gml
    _xml_error{2}.line (string)    5
    _xml_error{2}.type (string)    Error
    fme_feature_type (string)    Creator
    fme_geometry (string)    fme_undefined
    fme_type (string)    fme_no_geom
IFMENull
  • XML instance is valid against that schema when testing in oXygen – nmtoken Mar 18 at 14:02
  • Coordinate System = Unknown place a CoordinateSystemSetter Transformer and set it too Belge72/b.Lambert72A – Mapperz Mar 18 at 14:10
  • What if you change the location of the referenced schema test150319.xsd to a full path – nmtoken Mar 18 at 14:10
2

Right, if I understand this correctly, this is a false error created (partly) by an FME problem.

The latest GML version is v3.1.1 but you're writing v2.1.2. Both versions use the same namespace, so following the header links gets you to the v3 schema online. It should be backwards compatible, but (I believe) is somehow incomplete.

FME gets around that problem by using its own modified version of the schema for validation. We added what we thought was missing but somehow missed gml:Box.

In short, I think your data is fine. The structure/syntax is certainly correct. Any errors are a result of your data being validated against a bad schema. I'm told it's an easy fix, so we'll fix that schema and get a revised version out asap.

  • If you want to check in with the development team at Safe, the reference number for the issue is FMEENGINE-59490 – Mark Ireland Mar 18 at 19:52
  • Fixed in FME2019.1 (build 19536 or greater). – Mark Ireland Apr 1 at 17:32
  • Thank you. Anychance you can tell me what declaration do I have to add (manually) to my xsd in order to make the document valid? – Lay Apr 3 at 12:08
  • The document you're creating IS valid, it's just the validation process that's a little off. If you really want I can tell you what files to edit in the FME installation to have the validation pass, but I can't say I recommend that as a course of action. – Mark Ireland Apr 3 at 15:41
1

I saved your data (data.xml) and schema (schema.xsd) and ogrinfo did not have any difficulties with resolving everything. The GMLAS driver https://gdal.org/drv_gmlas.html is pretty strict so I think that your GML is valid.

ogrinfo GMLAS:data.xml -oo xsd=schema.xsd -al -so
INFO: Open of `GMLAS:data.xml'
      using driver `GMLAS' successful.

Layer name: phase
Geometry (polygonproperty): Polygon
Geometry (multipolygonproperty): Multi Polygon
Feature Count: 6
Extent (polygonproperty): (147564.292837, 170440.347324) - (155018.586174, 170709.282900)
Extent (multipolygonproperty): (148627.748994, 169483.720090) - (149504.219600, 169673.546206)
SRS WKT (polygonproperty):
(unknown)
SRS WKT (multipolygonproperty):
(unknown)
Geometry Column 1 = polygonproperty
Geometry Column 2 = multipolygonproperty
ogr_pkid: String (0.0) NOT NULL
fid: String (0.0)
description: String (0.0)
name: String (0.0)
id_ws: Integer64 (0.0) NOT NULL
id_ph: Integer64 (0.0) NOT NULL
phase_nr: Integer64 (0.0) NOT NULL
ph_label_fr: String (500.0) NOT NULL

I believe that you have some issue in how to use the FME validator or with your network so that the GML 2 schemas can't be accessed.

0

[more an extended comment with image]

Using the gml and xsd file above and the projection from https://epsg.io/1048

This can be loaded into FME 2018.1 without error

enter image description here

Is this what you are expecting?

  • 1
    I can read it back too. I think it's more the FME validation that is throwing an error for reasons unknown. It's the schema file that does it (validating the GML syntax is fine) so I wonder if it's following the wrong path? I'll investigate some more. – Mark Ireland Mar 18 at 15:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.