Debian Codegraph @

ogr/ogrsf_frmts/gmlas/ogrgmlasschemaanalyzer.cpp

raw symbols SCIP
1 /******************************************************************************
2 * Project: OGR
3 * Purpose: OGRGMLASDriver implementation
4 * Author: Even Rouault, <even dot rouault at spatialys dot com>
5 *
6 * Initial development funded by the European Earth observation programme
7 * Copernicus
8 *
9 ******************************************************************************
10 * Copyright (c) 2016, Even Rouault, <even dot rouault at spatialys dot com>
11 *
12 * SPDX-License-Identifier: MIT
13 ****************************************************************************/
14
15 #include "xercesc_headers.h"cxx . . $ `<file>/ogr/ogrsf_frmts/gmlas/xercesc_headers.h`/
16
17 // Hack to avoid bool, possibly redefined to pedantic bool class, being later
18 // used
19 static XSModelcxx . . $ xercesc_3_2/XSModel# *getGrammarPoolcxx . . $ getGrammarPool(b9e9fa0c68f93097).(XMLGrammarPoolcxx . . $ xercesc_3_2/XMLGrammarPool# *pool)
20 {
21 bool changed;
22 return pool->getXSModelcxx . . $ xercesc_3_2/XMLGrammarPool#getXSModel(b984bf837f474ad2).(changed);
23 }
24
25 #include "ogr_gmlas.h"cxx . . $ `<file>/ogr/ogrsf_frmts/gmlas/ogr_gmlas.h`/
26 #include "ogr_pgdump.h"cxx . . $ `<file>/ogr/ogrsf_frmts/pgdump/ogr_pgdump.h`/
27
28 #include <algorithm>
29 #include <list>
30
31 static OGRwkbGeometryType GetOGRGeometryTypecxx . . $ GetOGRGeometryType(617150b046df1df4).(XSTypeDefinitioncxx . . $ xercesc_3_2/XSTypeDefinition# *poTypeDef);
32
33 /************************************************************************/
34 /* IsCompatibleOfArray() */
35 /************************************************************************/
36
37 static bool IsCompatibleOfArraycxx . . $ IsCompatibleOfArray(58f33dce0e756b8f).(GMLASFieldTypecxx . . $ GMLASFieldType# eType)
38 {
39 return eType == GMLAS_FT_STRINGcxx . . $ GMLAS_FT_STRING. || eType == GMLAS_FT_BOOLEANcxx . . $ GMLAS_FT_BOOLEAN. ||
40 eType == GMLAS_FT_SHORTcxx . . $ GMLAS_FT_SHORT. || eType == GMLAS_FT_INT32cxx . . $ GMLAS_FT_INT32. ||
41 eType == GMLAS_FT_INT64cxx . . $ GMLAS_FT_INT64. || eType == GMLAS_FT_FLOATcxx . . $ GMLAS_FT_FLOAT. ||
42 eType == GMLAS_FT_DOUBLEcxx . . $ GMLAS_FT_DOUBLE. || eType == GMLAS_FT_DECIMALcxx . . $ GMLAS_FT_DECIMAL. ||
43 eType == GMLAS_FT_ANYURIcxx . . $ GMLAS_FT_ANYURI.;
44 }
45
46 /************************************************************************/
47 /* GMLASPrefixMappingHander */
48 /************************************************************************/
49
50 class GMLASPrefixMappingHandercxx . . $ GMLASPrefixMappingHander# : public DefaultHandlercxx . . $ xercesc_3_2/DefaultHandler#
51 {
52 stdcxx . . $ std/::mapcxx . . $ std/map#<CPLString, CPLString> &m_oMapURIToPrefixcxx . . $ GMLASPrefixMappingHander#m_oMapURIToPrefix.;
53 const stdcxx . . $ std/::mapcxx . . $ std/map#<CPLString, CPLString> &m_oMapDocNSURIToPrefixcxx . . $ GMLASPrefixMappingHander#m_oMapDocNSURIToPrefix.;
54 CPLString &m_osGMLVersionFoundcxx . . $ GMLASPrefixMappingHander#m_osGMLVersionFound.;
55
56 public:
57 GMLASPrefixMappingHandercxx . . $ GMLASPrefixMappingHander#GMLASPrefixMappingHander(9e926316b03cb635).(
58 stdcxx . . $ std/::mapcxx . . $ std/map#<CPLString, CPLString> &oMapURIToPrefix,
59 const stdcxx . . $ std/::mapcxx . . $ std/map#<CPLString, CPLString> &oMapDocNSURIToPrefix,
60 CPLString &osGMLVersionFound)
61 : m_oMapURIToPrefixcxx . . $ GMLASPrefixMappingHander#m_oMapURIToPrefix.(oMapURIToPrefix),
62 m_oMapDocNSURIToPrefixcxx . . $ GMLASPrefixMappingHander#m_oMapDocNSURIToPrefix.(oMapDocNSURIToPrefix),
63 m_osGMLVersionFoundcxx . . $ GMLASPrefixMappingHander#m_osGMLVersionFound.(osGMLVersionFound)
64 {
65 }
66
67 virtual void startElementcxx . . $ GMLASPrefixMappingHander#startElement(7f3cd4db7904682f).(const XMLChcxx . . $ XMLCh# *const uri,
68 const XMLChcxx . . $ XMLCh# *const localname,
69 const XMLChcxx . . $ XMLCh# *const qname,
70 const Attributescxx . . $ xercesc_3_2/Attributes# &attrs) override;
71
72 virtual void startPrefixMappingcxx . . $ GMLASPrefixMappingHander#startPrefixMapping(9940ac167ec1465e).(const XMLChcxx . . $ XMLCh# *const prefix,
73 const XMLChcxx . . $ XMLCh# *const uri) override;
74 };
75
76 /************************************************************************/
77 /* startElement() */
78 /************************************************************************/
79
80 void GMLASPrefixMappingHandercxx . . $ GMLASPrefixMappingHander#::startElementcxx . . $ GMLASPrefixMappingHander#startElement(7f3cd4db7904682f).(const XMLChcxx . . $ XMLCh# *const uri,
81 const XMLChcxx . . $ XMLCh# *const localname,
82 const XMLChcxx . . $ XMLCh# *const /*qname*/,
83 const Attributescxx . . $ xercesc_3_2/Attributes# &attrs)
84 {
85 if (!m_osGMLVersionFoundcxx . . $ GMLASPrefixMappingHander#m_osGMLVersionFound..empty())
86 return;
87
88 const CPLString osURI(transcodecxx . . $ transcode(39fd9df5ac67f380).(uri));
89 const CPLString osLocalname(transcodecxx . . $ transcode(39fd9df5ac67f380).(localname));
90 if (osURI == szXS_URIcxx . . $ GMLASConstants/szXS_URI. && osLocalname == "schema")
91 {
92 bool bIsGML = false;
93 stdcxx . . $ std/::string osVersion;
94 for (unsigned int i = 0; i < attrs.getLengthcxx . . $ xercesc_3_2/Attributes#getLength(fe4d2d262d4164a8).(); i++)
95 {
96 const stdcxx . . $ std/::string osAttrLocalName(transcodecxx . . $ transcode(39fd9df5ac67f380).(attrs.getLocalNamecxx . . $ xercesc_3_2/Attributes#getLocalName(347ab3992694ee33).(i)));
97 if (osAttrLocalName == "targetNamespace")
98 {
99 bIsGML = transcodecxx . . $ transcode(39fd9df5ac67f380).(attrs.getValuecxx . . $ xercesc_3_2/Attributes#getValue(347ab3992694ee33).(i)) == szGML_URIcxx . . $ GMLASConstants/szGML_URI.;
100 }
101 else if (osAttrLocalName == "version")
102 {
103 osVersion = transcodecxx . . $ transcode(39fd9df5ac67f380).(attrs.getValuecxx . . $ xercesc_3_2/Attributes#getValue(347ab3992694ee33).(i));
104 }
105 }
106 if (bIsGML && !osVersion.empty())
107 {
108 m_osGMLVersionFoundcxx . . $ GMLASPrefixMappingHander#m_osGMLVersionFound. = stdcxx . . $ std/::move(osVersion);
109 }
110 }
111 }
112
113 /************************************************************************/
114 /* startPrefixMapping() */
115 /************************************************************************/
116
117 void GMLASPrefixMappingHandercxx . . $ GMLASPrefixMappingHander#::startPrefixMappingcxx . . $ GMLASPrefixMappingHander#startPrefixMapping(9940ac167ec1465e).(const XMLChcxx . . $ XMLCh# *const prefix,
118 const XMLChcxx . . $ XMLCh# *const uri)
119 {
120 const CPLString osURI(transcodecxx . . $ transcode(39fd9df5ac67f380).(uri));
121 CPLString osPrefix(transcodecxx . . $ transcode(39fd9df5ac67f380).(prefix));
122 if (osPrefix.empty())
123 {
124 const auto oIter = m_oMapDocNSURIToPrefixcxx . . $ GMLASPrefixMappingHander#m_oMapDocNSURIToPrefix..findcxx . . $ std/map#find(7b3585bb5da8f7d).(osURI);
125 if (oIter !=cxx . . $ std/`operator!=`(a84eb84a7a5e8237). m_oMapDocNSURIToPrefixcxx . . $ GMLASPrefixMappingHander#m_oMapDocNSURIToPrefix..endcxx . . $ std/map#end(b953fec338ad1a3b).())
126 {
127 osPrefix = oIter->cxx . . $ std/_Rb_tree_const_iterator#`operator->`(8e614c7de0b1573e).second;
128 }
129 }
130 if (!osPrefix.empty())
131 {
132 const auto oIter = m_oMapURIToPrefixcxx . . $ GMLASPrefixMappingHander#m_oMapURIToPrefix..findcxx . . $ std/map#find(36f8d56706583706).(osURI);
133 if (oIter ==cxx . . $ std/`operator==`(be6a71a859368080). m_oMapURIToPrefixcxx . . $ GMLASPrefixMappingHander#m_oMapURIToPrefix..endcxx . . $ std/map#end(7e4de33083b6e738).())
134 {
135 m_oMapURIToPrefixcxx . . $ GMLASPrefixMappingHander#m_oMapURIToPrefix.[cxx . . $ std/map#`operator[]`(bbd415b616967878).osURI] = osPrefix;
136 CPLDebug("GMLAS", "Registering prefix=%s for uri=%s",
137 osPrefix.c_str(), osURI.c_str());
138 }
139 else if (oIter->cxx . . $ std/_Rb_tree_iterator#`operator->`(34d6acfd341ba7ab).second != osPrefix)
140 {
141 CPLDebug("GMLAS",
142 "Existing prefix=%s for uri=%s (new prefix %s not used)",
143 oIter->cxx . . $ std/_Rb_tree_iterator#`operator->`(34d6acfd341ba7ab).second.c_str(), osURI.c_str(), osPrefix.c_str());
144 }
145 }
146 }
147
148 /************************************************************************/
149 /* CollectNamespacePrefixes() */
150 /************************************************************************/
151
152 static void CollectNamespacePrefixescxx . . $ CollectNamespacePrefixes(588e57ed2635fc35).(
153 const char *pszXSDFilename, const stdcxx . . $ std/::shared_ptr<VSIVirtualHandlecxx . . $ VSIVirtualHandle#> &fpXSD,
154 stdcxx . . $ std/::mapcxx . . $ std/map#<CPLString, CPLString> &oMapURIToPrefix,
155 const stdcxx . . $ std/::mapcxx . . $ std/map#<CPLString, CPLString> &oMapDocNSURIToPrefix,
156 CPLString &osGMLVersionFound)
157 {
158 GMLASInputSourcecxx . . $ GMLASInputSource# oSourcecxx . . $ GMLASInputSource#GMLASInputSource(69b4a96d98906063).(pszXSDFilename, fpXSD);
159 // This is a bit silly but the startPrefixMapping() callback only gets
160 // called when using SAX2XMLReader::parse(), and not when using
161 // loadGrammar(), so we have to parse the doc twice.
162 SAX2XMLReadercxx . . $ xercesc_3_2/SAX2XMLReader# *poReader = XMLReaderFactorycxx . . $ xercesc_3_2/XMLReaderFactory#::createXMLReadercxx . . $ xercesc_3_2/XMLReaderFactory#createXMLReader(f5a6df77139f5287).();
163
164 GMLASPrefixMappingHandercxx . . $ GMLASPrefixMappingHander# contentHandlercxx . . $ GMLASPrefixMappingHander#GMLASPrefixMappingHander(9e926316b03cb635).(
165 oMapURIToPrefix, oMapDocNSURIToPrefix, osGMLVersionFound);
166 poReader->setContentHandlercxx . . $ xercesc_3_2/SAX2XMLReader#setContentHandler(60605bef8b899db9).(&contentHandler);
167
168 GMLASErrorHandlercxx . . $ GMLASErrorHandler# oErrorHandlercxx . . $ GMLASErrorHandler#GMLASErrorHandler(49f6e7a06ebc5aa8).;
169 poReader->setErrorHandlercxx . . $ xercesc_3_2/SAX2XMLReader#setErrorHandler(999de779048ca95f).(&oErrorHandler);
170
171 poReader->setFeaturecxx . . $ xercesc_3_2/SAX2XMLReader#setFeature(82a578018e16270c).(XMLUnicxx . . $ xercesc_3_2/XMLUni#::fgXercesDisableDefaultEntityResolutioncxx . . $ xercesc_3_2/XMLUni#fgXercesDisableDefaultEntityResolution., true);
172
173 stdcxx . . $ std/::string osErrorMsg;
174 try
175 {
176 poReader->parsecxx . . $ xercesc_3_2/SAX2XMLReader#parse(163b7135a912a970).(oSource);
177 }
178 catch (const SAXExceptioncxx . . $ xercesc_3_2/SAXException# &e)
179 {
180 osErrorMsg += transcodecxx . . $ transcode(39fd9df5ac67f380).(e.getMessagecxx . . $ xercesc_3_2/SAXException#getMessage(b92850b821c2ebdb).());
181 }
182 catch (const XMLExceptioncxx . . $ xercesc_3_2/XMLException# &e)
183 {
184 osErrorMsg += transcodecxx . . $ transcode(39fd9df5ac67f380).(e.getMessagecxx . . $ xercesc_3_2/XMLException#getMessage(b92850b821c2ebdb).());
185 }
186 catch (const OutOfMemoryExceptioncxx . . $ xercesc_3_2/OutOfMemoryException# &e)
187 {
188 if (strstr(CPLGetLastErrorMsg(), "configuration option") == nullptr)
189 {
190 osErrorMsg += transcodecxx . . $ transcode(39fd9df5ac67f380).(e.getMessagecxx . . $ xercesc_3_2/OutOfMemoryException#getMessage(b92850b821c2ebdb).());
191 }
192 }
193 catch (const DOMExceptioncxx . . $ xercesc_3_2/DOMException# &e)
194 {
195 osErrorMsg += transcodecxx . . $ transcode(39fd9df5ac67f380).(e.getMessagecxx . . $ xercesc_3_2/DOMException#getMessage(b92850b821c2ebdb).());
196 }
197 if (!osErrorMsg.empty())
198 {
199 CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, "%s", osErrorMsg.c_str());
200 }
201 delete poReader;
202 }
203
204 /************************************************************************/
205 /* GMLASAnalyzerEntityResolver */
206 /************************************************************************/
207
208 class GMLASAnalyzerEntityResolvercxx . . $ GMLASAnalyzerEntityResolver# final : public GMLASBaseEntityResolvercxx . . $ GMLASBaseEntityResolver#
209 {
210 stdcxx . . $ std/::mapcxx . . $ std/map#<CPLString, CPLString> &m_oMapURIToPrefixcxx . . $ GMLASAnalyzerEntityResolver#m_oMapURIToPrefix.;
211 const stdcxx . . $ std/::mapcxx . . $ std/map#<CPLString, CPLString> &m_oMapDocNSURIToPrefixcxx . . $ GMLASAnalyzerEntityResolver#m_oMapDocNSURIToPrefix.;
212
213 public:
214 GMLASAnalyzerEntityResolvercxx . . $ GMLASAnalyzerEntityResolver#GMLASAnalyzerEntityResolver(c7fcbb3bcbc1a251).(
215 const CPLString &osBasePath,
216 stdcxx . . $ std/::mapcxx . . $ std/map#<CPLString, CPLString> &oMapURIToPrefix,
217 const stdcxx . . $ std/::mapcxx . . $ std/map#<CPLString, CPLString> &oMapDocNSURIToPrefix,
218 GMLASXSDCachecxx . . $ GMLASXSDCache# &oCache)
219 : GMLASBaseEntityResolvercxx . . $ GMLASBaseEntityResolver#(osBasePath, oCache),
220 m_oMapURIToPrefixcxx . . $ GMLASAnalyzerEntityResolver#m_oMapURIToPrefix.(oMapURIToPrefix),
221 m_oMapDocNSURIToPrefixcxx . . $ GMLASAnalyzerEntityResolver#m_oMapDocNSURIToPrefix.(oMapDocNSURIToPrefix)
222 {
223 }
224
225 void DoExtraSchemaProcessingcxx . . $ GMLASAnalyzerEntityResolver#DoExtraSchemaProcessing(513c0babd247b0d).(
226 const CPLString &osFilename,
227 const stdcxx . . $ std/::shared_ptr<VSIVirtualHandlecxx . . $ VSIVirtualHandle#> &fp) override;
228 };
229
230 /************************************************************************/
231 /* DoExtraSchemaProcessing() */
232 /************************************************************************/
233
234 void GMLASAnalyzerEntityResolvercxx . . $ GMLASAnalyzerEntityResolver#::DoExtraSchemaProcessingcxx . . $ GMLASAnalyzerEntityResolver#DoExtraSchemaProcessing(513c0babd247b0d).(
235 const CPLString &osFilename, const stdcxx . . $ std/::shared_ptr<VSIVirtualHandlecxx . . $ VSIVirtualHandle#> &fp)
236 {
237 CollectNamespacePrefixescxx . . $ CollectNamespacePrefixes(588e57ed2635fc35).(osFilename, fp, m_oMapURIToPrefixcxx . . $ GMLASAnalyzerEntityResolver#m_oMapURIToPrefix.,
238 m_oMapDocNSURIToPrefixcxx . . $ GMLASAnalyzerEntityResolver#m_oMapDocNSURIToPrefix., m_osGMLVersionFoundcxx . . $ GMLASBaseEntityResolver#m_osGMLVersionFound.);
239 fp->Seekcxx . . $ VSIVirtualHandle#Seek(80043dbc67a5f54c).(0, SEEK_SETcxx . . $ `<external>/232824719582829767/stdio.h:114:9`!);
240 }
241
242 /************************************************************************/
243 /* GMLASSchemaAnalyzer() */
244 /************************************************************************/
245
246 GMLASSchemaAnalyzercxx . . $ GMLASSchemaAnalyzer#::GMLASSchemaAnalyzercxx . . $ GMLASSchemaAnalyzer#GMLASSchemaAnalyzer(d8835c8af69d9b44).(
247 GMLASXPathMatchercxx . . $ GMLASXPathMatcher# &oIgnoredXPathMatcher,
248 GMLASXPathMatchercxx . . $ GMLASXPathMatcher# &oChildrenElementsConstraintsXPathMatcher,
249 const stdcxx . . $ std/::mapcxx . . $ std/map#<CPLString, stdcxx . . $ std/::vector<CPLString>>
250 &oMapChildrenElementsConstraints,
251 GMLASXPathMatchercxx . . $ GMLASXPathMatcher# &oForcedFlattenedXPathMatcher,
252 GMLASXPathMatchercxx . . $ GMLASXPathMatcher# &oDisabledFlattenedXPathMatcher)
253 : m_oIgnoredXPathMatchercxx . . $ GMLASSchemaAnalyzer#m_oIgnoredXPathMatcher.(oIgnoredXPathMatcher),
254 m_oChildrenElementsConstraintsXPathMatchercxx . . $ GMLASSchemaAnalyzer#m_oChildrenElementsConstraintsXPathMatcher.(
255 oChildrenElementsConstraintsXPathMatcher),
256 m_oForcedFlattenedXPathMatchercxx . . $ GMLASSchemaAnalyzer#m_oForcedFlattenedXPathMatcher.(oForcedFlattenedXPathMatcher),
257 m_oDisabledFlattenedXPathMatchercxx . . $ GMLASSchemaAnalyzer#m_oDisabledFlattenedXPathMatcher.(oDisabledFlattenedXPathMatcher),
258 m_oMapChildrenElementsConstraintscxx . . $ GMLASSchemaAnalyzer#m_oMapChildrenElementsConstraints.(oMapChildrenElementsConstraints),
259 m_bUseArrayscxx . . $ GMLASSchemaAnalyzer#m_bUseArrays.(true), m_bUseNullStatecxx . . $ GMLASSchemaAnalyzer#m_bUseNullState.(false),
260 m_bInstantiateGMLFeaturesOnlycxx . . $ GMLASSchemaAnalyzer#m_bInstantiateGMLFeaturesOnly.(true), m_nIdentifierMaxLengthcxx . . $ GMLASSchemaAnalyzer#m_nIdentifierMaxLength.(0),
261 m_bCaseInsensitiveIdentifiercxx . . $ GMLASSchemaAnalyzer#m_bCaseInsensitiveIdentifier.(CASE_INSENSITIVE_IDENTIFIER_DEFAULTcxx . . $ GMLASConstants/CASE_INSENSITIVE_IDENTIFIER_DEFAULT.),
262 m_bPGIdentifierLaunderingcxx . . $ GMLASSchemaAnalyzer#m_bPGIdentifierLaundering.(PG_IDENTIFIER_LAUNDERING_DEFAULTcxx . . $ GMLASConstants/PG_IDENTIFIER_LAUNDERING_DEFAULT.),
263 m_nMaximumFieldsForFlatteningcxx . . $ GMLASSchemaAnalyzer#m_nMaximumFieldsForFlattening.(MAXIMUM_FIELDS_FLATTENING_DEFAULTcxx . . $ GMLASConstants/MAXIMUM_FIELDS_FLATTENING_DEFAULT.),
264 m_bAlwaysGenerateOGRIdcxx . . $ GMLASSchemaAnalyzer#m_bAlwaysGenerateOGRId.(ALWAYS_GENERATE_OGR_ID_DEFAULTcxx . . $ GMLASConstants/ALWAYS_GENERATE_OGR_ID_DEFAULT.)
265 {
266 // A few hardcoded namespace uri->prefix mappings
267 m_oMapURIToPrefixcxx . . $ GMLASSchemaAnalyzer#m_oMapURIToPrefix.[cxx . . $ std/map#`operator[]`(da459db78e6e18a3).szXMLNS_URIcxx . . $ GMLASConstants/szXMLNS_URI.] = szXMLNS_PREFIXcxx . . $ GMLASConstants/szXMLNS_PREFIX.;
268 m_oMapURIToPrefixcxx . . $ GMLASSchemaAnalyzer#m_oMapURIToPrefix.[cxx . . $ std/map#`operator[]`(da459db78e6e18a3).szXSI_URIcxx . . $ GMLASConstants/szXSI_URI.] = szXSI_PREFIXcxx . . $ GMLASConstants/szXSI_PREFIX.;
269 }
270
271 /************************************************************************/
272 /* GetPrefix() */
273 /************************************************************************/
274
275 CPLString GMLASSchemaAnalyzercxx . . $ GMLASSchemaAnalyzer#::GetPrefixcxx . . $ GMLASSchemaAnalyzer#GetPrefix(385147141d89f498).(const CPLString &osNamespaceURI)
276 {
277 if (osNamespaceURI.empty())
278 return "";
279 const auto oIter = m_oMapURIToPrefixcxx . . $ GMLASSchemaAnalyzer#m_oMapURIToPrefix..findcxx . . $ std/map#find(36f8d56706583706).(osNamespaceURI);
280 if (oIter !=cxx . . $ std/`operator!=`(be6a71a859368080). m_oMapURIToPrefixcxx . . $ GMLASSchemaAnalyzer#m_oMapURIToPrefix..endcxx . . $ std/map#end(7e4de33083b6e738).())
281 return oIter->cxx . . $ std/_Rb_tree_iterator#`operator->`(34d6acfd341ba7ab).second;
282 else if (!osNamespaceURI.empty())
283 {
284 // If the schema doesn't define a xmlns:MYPREFIX=myuri, then forge a
285 // fake prefix for conveniency
286 CPLString osPrefix;
287 if (osNamespaceURI.find(szOPENGIS_URLcxx . . $ GMLASConstants/szOPENGIS_URL.) == 0)
288 osPrefix = osNamespaceURI.substr(strlen(szOPENGIS_URLcxx . . $ GMLASConstants/szOPENGIS_URL.));
289 else if (osNamespaceURI.find("http://") == 0)
290 osPrefix = osNamespaceURI.substr(strlen("http://"));
291 else
292 osPrefix = osNamespaceURI;
293 for (size_t i = 0; i < osPrefix.size(); i++)
294 {
295 if (!isalnum(static_cast<unsigned char>(osPrefix[i])))
296 osPrefix[i] = '_';
297 }
298 m_oMapURIToPrefixcxx . . $ GMLASSchemaAnalyzer#m_oMapURIToPrefix.[cxx . . $ std/map#`operator[]`(bbd415b616967878).osNamespaceURI] = osPrefix;
299 CPLDebug("GMLAS", "Cannot find prefix for ns='%s'. Forging %s",
300 osNamespaceURI.c_str(), osPrefix.c_str());
301 return osPrefix;
302 }
303 else
304 {
305 CPLDebug("GMLAS", "Cannot find prefix for ns='%s'.",
306 osNamespaceURI.c_str());
307 return "";
308 }
309 }
310
311 /************************************************************************/
312 /* MakeXPath() */
313 /************************************************************************/
314
315 CPLString GMLASSchemaAnalyzercxx . . $ GMLASSchemaAnalyzer#::MakeXPathcxx . . $ GMLASSchemaAnalyzer#MakeXPath(ba8f7a05030d6bc1).(const CPLString &osNamespaceURI,
316 const CPLString &osName)
317 {
318 const CPLString osPrefix(GetPrefixcxx . . $ GMLASSchemaAnalyzer#GetPrefix(385147141d89f498).(osNamespaceURI));
319 if (osPrefix.empty())
320 return osName;
321 return osPrefix + ":" + osName;
322 }
323
324 /************************************************************************/
325 /* GetNSOfLastXPathComponent() */
326 /************************************************************************/
327
328 // Return the namespace (if any) of the last component of the XPath
329 static CPLString GetNSOfLastXPathComponentcxx . . $ GetNSOfLastXPathComponent(385147141d89f498).(const CPLString &osXPath)
330 {
331 size_t nPos = osXPath.rfind('@');
332 if (nPos != stdcxx . . $ std/::string::npos)
333 nPos++;
334 else
335 {
336 nPos = osXPath.rfind('/');
337 if (nPos != stdcxx . . $ std/::string::npos)
338 nPos++;
339 else
340 nPos = 0;
341 }
342 size_t nPosColumn = osXPath.find(':', nPos);
343 if (nPosColumn == stdcxx . . $ std/::string::npos)
344 return CPLString();
345 return CPLString(osXPath.substr(nPos, nPosColumn - nPos));
346 }
347
348 /************************************************************************/
349 /* LaunderFieldNames() */
350 /************************************************************************/
351
352 // Make sure that field names are unique within the class
353 bool GMLASSchemaAnalyzercxx . . $ GMLASSchemaAnalyzer#::LaunderFieldNamescxx . . $ GMLASSchemaAnalyzer#LaunderFieldNames(f08b5a86932eefde).(GMLASFeatureClasscxx . . $ GMLASFeatureClass# &oClass)
354 {
355 stdcxx . . $ std/::vector<GMLASFieldcxx . . $ GMLASField#> &aoFields = oClass.GetFieldscxx . . $ GMLASFeatureClass#GetFields(9b2e6b53619bff0e).();
356
357 // Duplicates can happen if a class has both an element and an attribute
358 // with same name, and/or attributes/elements with same name in different
359 // namespaces.
360
361 // Detect duplicated field names
362 stdcxx . . $ std/::mapcxx . . $ std/map#<CPLString, stdcxx . . $ std/::listcxx . . $ std/__cxx11/list#<int>> oMapNameToFieldIndexcxx . . $ std/map#map(49f6e7a06ebc5aa8).;
363 for (int i = 0; i < static_cast<int>(aoFields.size()); i++)
364 {
365 if (aoFields[i].GetCategorycxx . . $ GMLASField#GetCategory(c4a5dfd59ad3a301).() == GMLASFieldcxx . . $ GMLASField#::REGULARcxx . . $ GMLASField#REGULAR.)
366 {
367 oMapNameToFieldIndex[cxx . . $ std/map#`operator[]`(bbd415b616967878).aoFields[i].GetNamecxx . . $ GMLASField#GetName(1b8c726d1b99eee0).()].push_backcxx . . $ std/__cxx11/list#push_back(77d9f17553126ecb).(i);
368 }
369 }
370
371 stdcxx . . $ std/::setcxx . . $ std/set#<CPLString> oSetDuplicatescxx . . $ std/set#set(49f6e7a06ebc5aa8).;
372 for (const auto &oIter : oMapNameToFieldIndex)
373 {
374 // Has it duplicates ?
375 const size_t nOccurrences = oIter.second.sizecxx . . $ std/__cxx11/list#size(c9b1e749b64d5edc).();
376 if (nOccurrences > 1)
377 {
378 oSetDuplicates.insertcxx . . $ std/set#insert(411a10a755068dfe).(oIter.first);
379 }
380 }
381
382 while (!oSetDuplicates.emptycxx . . $ std/set#empty(3482b152b9333168).())
383 {
384 // Iterate over the unique names
385 auto oIterSet = oSetDuplicates.begincxx . . $ std/set#begin(3220b82c0db6d2a1).();
386 while (oIterSet !=cxx . . $ std/`operator!=`(a84eb84a7a5e8237). oSetDuplicates.endcxx . . $ std/set#end(3220b82c0db6d2a1).())
387 {
388 auto oIterSetNext = oIterSet;
389 ++cxx . . $ std/_Rb_tree_const_iterator#operator++(9cb79ab07bb244bf).oIterSetNext;
390
391 auto oIterMap = oMapNameToFieldIndex.findcxx . . $ std/map#find(36f8d56706583706).(*cxx . . $ std/_Rb_tree_const_iterator#`operator*`(2042464fc1fea03e).oIterSet);
392 CPLAssertcxx . . $ `port/cpl_error.h:353:9`!(oIterMap != oMapNameToFieldIndex.end());
393 auto &list = oIterMap->cxx . . $ std/_Rb_tree_iterator#`operator->`(34d6acfd341ba7ab).second;
394
395 const CPLString oClassNS =
396 GetNSOfLastXPathComponentcxx . . $ GetNSOfLastXPathComponent(385147141d89f498).(oClass.GetXPathcxx . . $ GMLASFeatureClass#GetXPath(1b8c726d1b99eee0).());
397 bool bHasDoneRenamingForThatCase = false;
398
399 auto oIterList = list.begincxx . . $ std/__cxx11/list#begin(57ce810e58fbcab0).();
400
401 // Update oMapNameToFieldIndex and oSetDuplicates with the
402 // new field name, and removing the old one.
403 const auto updateSetAndMapWithNewName =
404 [&oIterList, &list, &oMapNameToFieldIndex,
405 &oSetDuplicates](int nFieldIdx, const stdcxx . . $ std/::string &osNewName)
406 {
407 list.erasecxx . . $ std/__cxx11/list#erase(aceec42672b9127f).(oIterListcxx . . $ std/_List_const_iterator#_List_const_iterator(2c469dd624388c9f).);
408 auto &newList = oMapNameToFieldIndex[cxx . . $ std/map#`operator[]`(da459db78e6e18a3).osNewName];
409 newList.push_backcxx . . $ std/__cxx11/list#push_back(77d9f17553126ecb).(nFieldIdx);
410 if (newList.sizecxx . . $ std/__cxx11/list#size(c9b1e749b64d5edc).() > 1)
411 oSetDuplicates.insertcxx . . $ std/set#insert(10916b2dbd511ba8).(osNewName);
412 };
413
414 while (oIterList !=cxx . . $ std/`operator!=`(2ff7fa6cf5bdfcad). list.endcxx . . $ std/__cxx11/list#end(57ce810e58fbcab0).())
415 {
416 auto oIterListNext = oIterList;
417 ++cxx . . $ std/_List_iterator#operator++(70483be15bedaca0).oIterListNext;
418
419 const int nFieldIdx = *cxx . . $ std/_List_iterator#`operator*`(d426bc7b625886b7).oIterList;
420 GMLASFieldcxx . . $ GMLASField# &oField = aoFields[nFieldIdx];
421 // CPLDebug("GMLAS", "%s", oField.GetXPath().c_str() );
422 const CPLString oNS(
423 GetNSOfLastXPathComponentcxx . . $ GetNSOfLastXPathComponent(385147141d89f498).(oField.GetXPathcxx . . $ GMLASField#GetXPath(1b8c726d1b99eee0).()));
424 // If the field has a namespace that is not the one of its
425 // class, then prefix its name with its namespace
426 if (!oNS.empty() && oNS != oClassNS &&
427 !STARTS_WITHcxx . . $ `port/cpl_port.h:541:9`!(oField.GetName(), (oNS + "_").c_str()))
428 {
429 bHasDoneRenamingForThatCase = true;
430 const auto osNewName = oNS + "_" + oField.GetNamecxx . . $ GMLASField#GetName(1b8c726d1b99eee0).();
431 oField.SetNamecxx . . $ GMLASField#SetName(42786403379ca8d8).(osNewName);
432 updateSetAndMapWithNewName(cxx . . $ GMLASSchemaAnalyzer#LaunderFieldNames(f08b5a86932eefde).$anonymous_type_0#`operator()`(8afd1a062aafdef8).nFieldIdx, osNewName);
433 break;
434 }
435 // If it is an attribute without a particular namespace,
436 // then suffix with _attr
437 else if (oNS.empty() &&
438 oField.GetXPathcxx . . $ GMLASField#GetXPath(1b8c726d1b99eee0).().find('@') != stdcxx . . $ std/::string::npos &&
439 oField.GetNamecxx . . $ GMLASField#GetName(1b8c726d1b99eee0).().find("_attr") == stdcxx . . $ std/::string::npos)
440 {
441 bHasDoneRenamingForThatCase = true;
442 const auto osNewName = oField.GetNamecxx . . $ GMLASField#GetName(1b8c726d1b99eee0).() + "_attr";
443 oField.SetNamecxx . . $ GMLASField#SetName(42786403379ca8d8).(osNewName);
444 updateSetAndMapWithNewName(cxx . . $ GMLASSchemaAnalyzer#LaunderFieldNames(f08b5a86932eefde).$anonymous_type_0#`operator()`(8afd1a062aafdef8).nFieldIdx, osNewName);
445 break;
446 }
447
448 oIterList =cxx . . $ std/_List_iterator#`operator=`(d17bad6162c5db3c). oIterListNext;
449 }
450
451 // If none of the above renaming strategies have worked, then
452 // append a counter to the duplicates.
453 if (!bHasDoneRenamingForThatCase)
454 {
455 int i = 0;
456 oIterList =cxx . . $ std/_List_iterator#`operator=`(f8298c91edf53360). list.begincxx . . $ std/__cxx11/list#begin(57ce810e58fbcab0).();
457 while (oIterList !=cxx . . $ std/`operator!=`(2ff7fa6cf5bdfcad). list.endcxx . . $ std/__cxx11/list#end(57ce810e58fbcab0).())
458 {
459 auto oIterListNext = oIterList;
460 ++cxx . . $ std/_List_iterator#operator++(70483be15bedaca0).oIterListNext;
461
462 const int nFieldIdx = *cxx . . $ std/_List_iterator#`operator*`(d426bc7b625886b7).oIterList;
463 GMLASFieldcxx . . $ GMLASField# &oField = aoFields[nFieldIdx];
464 if (i > 0)
465 {
466 const auto osNewName =
467 oField.GetNamecxx . . $ GMLASField#GetName(1b8c726d1b99eee0).() +
468 CPLSPrintf("%d", static_cast<int>(i) + 1);
469 oField.SetNamecxx . . $ GMLASField#SetName(42786403379ca8d8).(osNewName);
470 updateSetAndMapWithNewName(cxx . . $ GMLASSchemaAnalyzer#LaunderFieldNames(f08b5a86932eefde).$anonymous_type_0#`operator()`(8afd1a062aafdef8).nFieldIdx, osNewName);
471 }
472
473 ++i;
474 oIterList =cxx . . $ std/_List_iterator#`operator=`(d17bad6162c5db3c). oIterListNext;
475 }
476 }
477
478 // Update oSetDuplicates and oMapNameToFieldIndex if we have
479 // no longer duplicates for the current name
480 if (list.sizecxx . . $ std/__cxx11/list#size(c9b1e749b64d5edc).() <= 1)
481 {
482 if (list.emptycxx . . $ std/__cxx11/list#empty(3482b152b9333168).())
483 {
484 oMapNameToFieldIndex.erasecxx . . $ std/map#erase(9238c2f1608b9ba6).(oIterMap);
485 }
486 oSetDuplicates.erasecxx . . $ std/set#erase(36a7984e631cd3e9).(oIterSet);
487 }
488
489 oIterSet =cxx . . $ std/_Rb_tree_const_iterator#`operator=`(1cd737b2e0d8169). oIterSetNext;
490 }
491 }
492
493 #ifdef DEBUG
494 {
495 // Check that the above algorithm managed to deduplicate names
496 std::set<CPLString> oSetNames;
497 for (const auto &oField : aoFields)
498 {
499 if (oField.GetCategory() == GMLASField::REGULAR)
500 {
501 const auto &osName = oField.GetName();
502 CPLAssert(oSetNames.find(osName) == oSetNames.end());
503 oSetNames.insert(osName);
504 }
505 }
506 }
507 #endif
508
509 // Now check if we must truncate names
510 if (m_nIdentifierMaxLengthcxx . . $ GMLASSchemaAnalyzer#m_nIdentifierMaxLength. >= MIN_VALUE_OF_MAX_IDENTIFIER_LENGTHcxx . . $ GMLASConstants/MIN_VALUE_OF_MAX_IDENTIFIER_LENGTH.)
511 {
512 for (size_t i = 0; i < aoFields.size(); i++)
513 {
514 int nNameSize = static_cast<int>(aoFields[i].GetNamecxx . . $ GMLASField#GetName(1b8c726d1b99eee0).().size());
515 /* Somewhat arbitrary limitation to avoid performance issues in */
516 /* OGRGMLASTruncateIdentifier() */
517 if (nNameSize > 1024)
518 {
519 CPLError(CE_Failure, CPLE_NotSupportedcxx . . $ `port/cpl_error.h:118:9`!,
520 "Field name with excessive length (%d) found",
521 nNameSize);
522 return false;
523 }
524 if (nNameSize > m_nIdentifierMaxLengthcxx . . $ GMLASSchemaAnalyzer#m_nIdentifierMaxLength.)
525 {
526 aoFields[i].SetNamecxx . . $ GMLASField#SetName(42786403379ca8d8).(OGRGMLASTruncateIdentifiercxx . . $ OGRGMLASTruncateIdentifier(1ebbfc16f7b4d393).(
527 aoFields[i].GetNamecxx . . $ GMLASField#GetName(1b8c726d1b99eee0).(), m_nIdentifierMaxLengthcxx . . $ GMLASSchemaAnalyzer#m_nIdentifierMaxLength.));
528 }
529 }
530 }
531
532 if (m_bPGIdentifierLaunderingcxx . . $ GMLASSchemaAnalyzer#m_bPGIdentifierLaundering.)
533 {
534 for (size_t i = 0; i < aoFields.size(); i++)
535 {
536 char *pszLaundered =
537 OGRPGCommonLaunderNamecxx . . $ OGRPGCommonLaunderName(9d58d69f615a710a).(aoFields[i].GetNamecxx . . $ GMLASField#GetName(1b8c726d1b99eee0).(), "GMLAS", false);
538 aoFields[i].SetNamecxx . . $ GMLASField#SetName(42786403379ca8d8).(pszLaundered);
539 CPLFreecxx . . $ `port/cpl_conv.h:97:9`!(pszLaundered);
540 }
541 }
542
543 // Detect duplicated field names
544 stdcxx . . $ std/::mapcxx . . $ std/map#<CPLString, stdcxx . . $ std/::vector<int>> oSetNamescxx . . $ std/map#map(49f6e7a06ebc5aa8).;
545 for (int i = 0; i < static_cast<int>(aoFields.size()); i++)
546 {
547 if (aoFields[i].GetCategorycxx . . $ GMLASField#GetCategory(c4a5dfd59ad3a301).() == GMLASFieldcxx . . $ GMLASField#::REGULARcxx . . $ GMLASField#REGULAR.)
548 {
549 CPLString osName(aoFields[i].GetNamecxx . . $ GMLASField#GetName(1b8c726d1b99eee0).());
550 if (m_bCaseInsensitiveIdentifiercxx . . $ GMLASSchemaAnalyzer#m_bCaseInsensitiveIdentifier.)
551 osName.toupper();
552 oSetNames[cxx . . $ std/map#`operator[]`(bbd415b616967878).osName].push_back(i);
553 }
554 }
555
556 // Iterate over the unique names
557 for (const auto &oIter : oSetNames)
558 {
559 // Has it duplicates ?
560 const size_t nOccurrences = oIter.second.size();
561 if (nOccurrences > 1)
562 {
563 for (size_t i = 0; i < nOccurrences; i++)
564 {
565 GMLASFieldcxx . . $ GMLASField# &oField = aoFields[oIter.second[i]];
566 oField.SetNamecxx . . $ GMLASField#SetName(42786403379ca8d8).(OGRGMLASAddSerialNumbercxx . . $ OGRGMLASAddSerialNumber(1c946e2d7ec5b168).(
567 oField.GetNamecxx . . $ GMLASField#GetName(1b8c726d1b99eee0).(), static_cast<int>(i + 1), nOccurrences,
568 m_nIdentifierMaxLengthcxx . . $ GMLASSchemaAnalyzer#m_nIdentifierMaxLength.));
569 }
570 }
571 }
572
573 // Recursively process nested classes
574 stdcxx . . $ std/::vector<GMLASFeatureClasscxx . . $ GMLASFeatureClass#> &aoNestedClasses = oClass.GetNestedClassescxx . . $ GMLASFeatureClass#GetNestedClasses(825ee02b13fbc77f).();
575 for (size_t i = 0; i < aoNestedClasses.size(); i++)
576 {
577 if (!LaunderFieldNamescxx . . $ GMLASSchemaAnalyzer#LaunderFieldNames(f08b5a86932eefde).(aoNestedClasses[i]))
578 return false;
579 }
580 return true;
581 }
582
583 /************************************************************************/
584 /* CollectClassesReferences() */
585 /************************************************************************/
586
587 void GMLASSchemaAnalyzercxx . . $ GMLASSchemaAnalyzer#::CollectClassesReferencescxx . . $ GMLASSchemaAnalyzer#CollectClassesReferences(20bda630f5d8ccc2).(
588 GMLASFeatureClasscxx . . $ GMLASFeatureClass# &oClass, stdcxx . . $ std/::vector<GMLASFeatureClasscxx . . $ GMLASFeatureClass# *> &aoClasses)
589 {
590 aoClasses.push_back(&oClass);
591 stdcxx . . $ std/::vector<GMLASFeatureClasscxx . . $ GMLASFeatureClass#> &aoNestedClasses = oClass.GetNestedClassescxx . . $ GMLASFeatureClass#GetNestedClasses(825ee02b13fbc77f).();
592 for (size_t i = 0; i < aoNestedClasses.size(); i++)
593 {
594 CollectClassesReferencescxx . . $ GMLASSchemaAnalyzer#CollectClassesReferences(20bda630f5d8ccc2).(aoNestedClasses[i], aoClasses);
595 }
596 }
597
598 /************************************************************************/
599 /* LaunderClassNames() */
600 /************************************************************************/
601
602 void GMLASSchemaAnalyzercxx . . $ GMLASSchemaAnalyzer#::LaunderClassNamescxx . . $ GMLASSchemaAnalyzer#LaunderClassNames(49f6e7a06ebc5aa8).()
603 {
604 stdcxx . . $ std/::vector<GMLASFeatureClasscxx . . $ GMLASFeatureClass# *> aoClasses;
605 for (size_t i = 0; i < m_aoClassescxx . . $ GMLASSchemaAnalyzer#m_aoClasses..size(); i++)
606 {
607 CollectClassesReferencescxx . . $ GMLASSchemaAnalyzer#CollectClassesReferences(20bda630f5d8ccc2).(m_aoClassescxx . . $ GMLASSchemaAnalyzer#m_aoClasses.[i], aoClasses);
608 }
609
610 if (m_nIdentifierMaxLengthcxx . . $ GMLASSchemaAnalyzer#m_nIdentifierMaxLength. >= MIN_VALUE_OF_MAX_IDENTIFIER_LENGTHcxx . . $ GMLASConstants/MIN_VALUE_OF_MAX_IDENTIFIER_LENGTH.)
611 {
612 for (size_t i = 0; i < aoClasses.size(); i++)
613 {
614 int nNameSize = static_cast<int>(aoClasses[i]->GetNamecxx . . $ GMLASFeatureClass#GetName(1b8c726d1b99eee0).().size());
615 if (nNameSize > m_nIdentifierMaxLengthcxx . . $ GMLASSchemaAnalyzer#m_nIdentifierMaxLength.)
616 {
617 aoClasses[i]->SetNamecxx . . $ GMLASFeatureClass#SetName(42786403379ca8d8).(OGRGMLASTruncateIdentifiercxx . . $ OGRGMLASTruncateIdentifier(1ebbfc16f7b4d393).(
618 aoClasses[i]->GetNamecxx . . $ GMLASFeatureClass#GetName(1b8c726d1b99eee0).(), m_nIdentifierMaxLengthcxx . . $ GMLASSchemaAnalyzer#m_nIdentifierMaxLength.));
619 }
620 }
621 }
622
623 if (m_bPGIdentifierLaunderingcxx . . $ GMLASSchemaAnalyzer#m_bPGIdentifierLaundering.)
624 {
625 for (size_t i = 0; i < aoClasses.size(); i++)
626 {
627 char *pszLaundered =
628 OGRPGCommonLaunderNamecxx . . $ OGRPGCommonLaunderName(9d58d69f615a710a).(aoClasses[i]->GetNamecxx . . $ GMLASFeatureClass#GetName(1b8c726d1b99eee0).(), "GMLAS", false);
629 aoClasses[i]->SetNamecxx . . $ GMLASFeatureClass#SetName(42786403379ca8d8).(pszLaundered);
630 CPLFreecxx . . $ `port/cpl_conv.h:97:9`!(pszLaundered);
631 }
632 }
633
634 // Detect duplicated names. This should normally not happen in normal
635 // conditions except if you have classes like
636 // prefix_foo, prefix:foo, other_prefix:foo
637 // or if names have been truncated in the previous step
638 stdcxx . . $ std/::mapcxx . . $ std/map#<CPLString, stdcxx . . $ std/::vector<int>> oSetNamescxx . . $ std/map#map(49f6e7a06ebc5aa8).;
639 for (int i = 0; i < static_cast<int>(aoClasses.size()); i++)
640 {
641 CPLString osName(aoClasses[i]->GetNamecxx . . $ GMLASFeatureClass#GetName(1b8c726d1b99eee0).());
642 if (m_bCaseInsensitiveIdentifiercxx . . $ GMLASSchemaAnalyzer#m_bCaseInsensitiveIdentifier.)
643 osName.toupper();
644 oSetNames[cxx . . $ std/map#`operator[]`(bbd415b616967878).osName].push_back(i);
645 }
646
647 // Iterate over the unique names
648 for (const auto &oIter : oSetNames)
649 {
650 // Has it duplicates ?
651 const size_t nOccurrences = oIter.second.size();
652 if (nOccurrences > 1)
653 {
654 for (size_t i = 0; i < nOccurrences; i++)
655 {
656 GMLASFeatureClasscxx . . $ GMLASFeatureClass# *poClass = aoClasses[oIter.second[i]];
657 poClass->SetNamecxx . . $ GMLASFeatureClass#SetName(42786403379ca8d8).(OGRGMLASAddSerialNumbercxx . . $ OGRGMLASAddSerialNumber(1c946e2d7ec5b168).(
658 poClass->GetNamecxx . . $ GMLASFeatureClass#GetName(1b8c726d1b99eee0).(), static_cast<int>(i + 1), nOccurrences,
659 m_nIdentifierMaxLengthcxx . . $ GMLASSchemaAnalyzer#m_nIdentifierMaxLength.));
660 }
661 }
662 }
663 }
664
665 /************************************************************************/
666 /* GMLASUniquePtr() */
667 /************************************************************************/
668
669 // Poor-man std::unique_ptr
670 template <class T> class GMLASUniquePtrcxx . . $ GMLASUniquePtr#
671 {
672 T *m_pcxx . . $ GMLASUniquePtr#m_p.;
673
674 GMLASUniquePtrcxx . . $ GMLASUniquePtr#`GMLASUniquePtr<T>`(c9022c5c49ae9e11).(const GMLASUniquePtr &);
675 GMLASUniquePtr &operatorcxx . . $ GMLASUniquePtr#`operator=`(ceb4119c26e48312).=(const GMLASUniquePtr &);
676
677 public:
678 explicit GMLASUniquePtrcxx . . $ GMLASUniquePtr#`GMLASUniquePtr<T>`(ebd0a1552f8ce24f).(T *p) : m_pcxx . . $ GMLASUniquePtr#m_p.(p)
679 {
680 }
681
682 ~cxx . . $ GMLASUniquePtr#`~GMLASUniquePtr<T>`(49f6e7a06ebc5aa8).GMLASUniquePtr()
683 {
684 delete m_pcxx . . $ GMLASUniquePtr#m_p.;
685 }
686
687 T *operatorcxx . . $ GMLASUniquePtr#`operator->`(5a2a78a048fb49a8).->() const
688 {
689 CPLAssertcxx . . $ `port/cpl_error.h:353:9`!(m_p);
690 return m_pcxx . . $ GMLASUniquePtr#m_p.;
691 }
692
693 T *getcxx . . $ GMLASUniquePtr#get(5a2a78a048fb49a8).() const
694 {
695 return m_pcxx . . $ GMLASUniquePtr#m_p.;
696 }
697
698 T *releasecxx . . $ GMLASUniquePtr#release(155dc7f103cdb9db).()
699 {
700 T *ret = m_pcxx . . $ GMLASUniquePtr#m_p.;
701 m_pcxx . . $ GMLASUniquePtr#m_p. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:416:9`!;
702 return ret;
703 }
704 };
705
706 /************************************************************************/
707 /* GetTopElementDeclarationFromXPath() */
708 /************************************************************************/
709
710 XSElementDeclarationcxx . . $ xercesc_3_2/XSElementDeclaration# *
711 GMLASSchemaAnalyzercxx . . $ GMLASSchemaAnalyzer#::GetTopElementDeclarationFromXPathcxx . . $ GMLASSchemaAnalyzer#GetTopElementDeclarationFromXPath(36d74f5cbbead52).(const CPLString &osXPath,
712 XSModelcxx . . $ xercesc_3_2/XSModel# *poModel)
713 {
714 const char *pszTypename = osXPath.c_str();
715 const char *pszColon = strrchr(pszTypename, ':');
716 XSElementDeclarationcxx . . $ xercesc_3_2/XSElementDeclaration# *poEltDecl = nullptr;
717 if (pszColon != nullptr)
718 {
719 CPLString osNSPrefix = pszTypename;
720 osNSPrefix.resize(pszColon - pszTypename);
721 CPLString osName = pszColon + 1;
722 CPLString osNSURI;
723
724 for (const auto &oIterNS : m_oMapURIToPrefixcxx . . $ GMLASSchemaAnalyzer#m_oMapURIToPrefix.)
725 {
726 const CPLString &osIterNSURI(oIterNS.first);
727 const CPLString &osIterNSPrefix(oIterNS.second);
728 if (osNSPrefix == osIterNSPrefix)
729 {
730 osNSURI = osIterNSURI;
731 break;
732 }
733 }
734 XMLChcxx . . $ XMLCh# *xmlNS = nullptr;
735 XMLChcxx . . $ XMLCh# *xmlName = nullptr;
736 try
737 {
738 xmlNS = XMLStringcxx . . $ xercesc_3_2/XMLString#::transcodecxx . . $ xercesc_3_2/XMLString#transcode(2d9eebfe19c47a81).(osNSURI);
739 xmlName = XMLStringcxx . . $ xercesc_3_2/XMLString#::transcodecxx . . $ xercesc_3_2/XMLString#transcode(2d9eebfe19c47a81).(osName);
740 poEltDecl = poModel->getElementDeclarationcxx . . $ xercesc_3_2/XSModel#getElementDeclaration(4efad055e24904ff).(xmlName, xmlNS);
741 }
742 catch (const TranscodingExceptioncxx . . $ xercesc_3_2/TranscodingException# &e)
743 {
744 CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, "TranscodingException: %s",
745 transcodecxx . . $ transcode(39fd9df5ac67f380).(e.getMessagecxx . . $ xercesc_3_2/XMLException#getMessage(b92850b821c2ebdb).()).c_str());
746 }
747 XMLStringcxx . . $ xercesc_3_2/XMLString#::releasecxx . . $ xercesc_3_2/XMLString#release(f34b595fba37d7b5).(&xmlNS);
748 XMLStringcxx . . $ xercesc_3_2/XMLString#::releasecxx . . $ xercesc_3_2/XMLString#release(f34b595fba37d7b5).(&xmlName);
749 }
750 else
751 {
752 try
753 {
754 XMLChcxx . . $ XMLCh# *xmlName = XMLStringcxx . . $ xercesc_3_2/XMLString#::transcodecxx . . $ xercesc_3_2/XMLString#transcode(2d9eebfe19c47a81).(pszTypename);
755 poEltDecl = poModel->getElementDeclarationcxx . . $ xercesc_3_2/XSModel#getElementDeclaration(4efad055e24904ff).(xmlName, nullptr);
756 XMLStringcxx . . $ xercesc_3_2/XMLString#::releasecxx . . $ xercesc_3_2/XMLString#release(f34b595fba37d7b5).(&xmlName);
757 }
758 catch (const TranscodingExceptioncxx . . $ xercesc_3_2/TranscodingException# &e)
759 {
760 CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, "TranscodingException: %s",
761 transcodecxx . . $ transcode(39fd9df5ac67f380).(e.getMessagecxx . . $ xercesc_3_2/XMLException#getMessage(b92850b821c2ebdb).()).c_str());
762 }
763 }
764 return poEltDecl;
765 }
766
767 /************************************************************************/
768 /* IsEltCompatibleOfFC() */
769 /************************************************************************/
770
771 static XSComplexTypeDefinitioncxx . . $ xercesc_3_2/XSComplexTypeDefinition# *
772 IsEltCompatibleOfFCcxx . . $ IsEltCompatibleOfFC(6a0bd3739bd6039d).(XSElementDeclarationcxx . . $ xercesc_3_2/XSElementDeclaration# *poEltDecl)
773 {
774 XSTypeDefinitioncxx . . $ xercesc_3_2/XSTypeDefinition# *poTypeDef = poEltDecl->getTypeDefinitioncxx . . $ xercesc_3_2/XSElementDeclaration#getTypeDefinition(cdce5b073bfe8145).();
775 if (poTypeDef->getTypeCategorycxx . . $ xercesc_3_2/XSTypeDefinition#getTypeCategory(648f99a6da51541c).() == XSTypeDefinitioncxx . . $ xercesc_3_2/XSTypeDefinition#::COMPLEX_TYPEcxx . . $ xercesc_3_2/XSTypeDefinition#COMPLEX_TYPE. &&
776 transcodecxx . . $ transcode(39fd9df5ac67f380).(poEltDecl->getNamecxx . . $ xercesc_3_2/XSElementDeclaration#getName(b92850b821c2ebdb).()) != szFEATURE_COLLECTIONcxx . . $ GMLASConstants/szFEATURE_COLLECTION.)
777 {
778 XSComplexTypeDefinitioncxx . . $ xercesc_3_2/XSComplexTypeDefinition# *poCT =
779 reinterpret_cast<XSComplexTypeDefinitioncxx . . $ xercesc_3_2/XSComplexTypeDefinition# *>(poTypeDef);
780 XSComplexTypeDefinitioncxx . . $ xercesc_3_2/XSComplexTypeDefinition#::CONTENT_TYPEcxx . . $ xercesc_3_2/XSComplexTypeDefinition#CONTENT_TYPE# eContentType(
781 poCT->getContentTypecxx . . $ xercesc_3_2/XSComplexTypeDefinition#getContentType(1a89a1a4f3626ea7).());
782 if (eContentType == XSComplexTypeDefinitioncxx . . $ xercesc_3_2/XSComplexTypeDefinition#::CONTENTTYPE_ELEMENTcxx . . $ xercesc_3_2/XSComplexTypeDefinition#CONTENTTYPE_ELEMENT. ||
783 eContentType == XSComplexTypeDefinitioncxx . . $ xercesc_3_2/XSComplexTypeDefinition#::CONTENTTYPE_MIXEDcxx . . $ xercesc_3_2/XSComplexTypeDefinition#CONTENTTYPE_MIXED.)
784 {
785 return poCT;
786 }
787 }
788 return nullptr;
789 }
790
791 /************************************************************************/
792 /* DerivesFromGMLFeature() */
793 /************************************************************************/
794
795 bool GMLASSchemaAnalyzercxx . . $ GMLASSchemaAnalyzer#::DerivesFromGMLFeaturecxx . . $ GMLASSchemaAnalyzer#DerivesFromGMLFeature(46c8da582617711b).(XSElementDeclarationcxx . . $ xercesc_3_2/XSElementDeclaration# *poEltDecl)
796 {
797 XSElementDeclarationcxx . . $ xercesc_3_2/XSElementDeclaration# *poIter = poEltDecl;
798 while (true)
799 {
800 XSElementDeclarationcxx . . $ xercesc_3_2/XSElementDeclaration# *poSubstGroup =
801 poIter->getSubstitutionGroupAffiliationcxx . . $ xercesc_3_2/XSElementDeclaration#getSubstitutionGroupAffiliation(3e3b4197300ce601).();
802 if (poSubstGroup == nullptr)
803 break;
804 const CPLString osSubstNS(transcodecxx . . $ transcode(39fd9df5ac67f380).(poSubstGroup->getNamespacecxx . . $ xercesc_3_2/XSElementDeclaration#getNamespace(b92850b821c2ebdb).()));
805 const CPLString osSubstName(transcodecxx . . $ transcode(39fd9df5ac67f380).(poSubstGroup->getNamecxx . . $ xercesc_3_2/XSElementDeclaration#getName(b92850b821c2ebdb).()));
806 if (IsGMLNamespacecxx . . $ GMLASSchemaAnalyzer#IsGMLNamespace(86da8d82cde12b2b).(osSubstNS) && osSubstName == "_FeatureCollection")
807 {
808 return false;
809 }
810 if (IsGMLNamespacecxx . . $ GMLASSchemaAnalyzer#IsGMLNamespace(86da8d82cde12b2b).(osSubstNS) &&
811 (osSubstName == "AbstractFeature" || osSubstName == "_Feature"))
812 {
813 return true;
814 }
815 poIter = poSubstGroup;
816 }
817 return false;
818 }
819
820 /************************************************************************/
821 /* Analyze() */
822 /************************************************************************/
823
824 bool GMLASSchemaAnalyzercxx . . $ GMLASSchemaAnalyzer#::Analyzecxx . . $ GMLASSchemaAnalyzer#Analyze(8eec41451bb33db5).(GMLASXSDCachecxx . . $ GMLASXSDCache# &oCache,
825 const CPLString &osBaseDirname,
826 stdcxx . . $ std/::vector<PairURIFilenamecxx . . $ PairURIFilename#> &aoXSDs,
827 bool bSchemaFullChecking,
828 bool bHandleMultipleImports)
829 {
830 GMLASUniquePtrcxx . . $ GMLASUniquePtr#<XMLGrammarPoolcxx . . $ xercesc_3_2/XMLGrammarPool#> poGrammarPoolcxx . . $ GMLASUniquePtr#GMLASUniquePtr(ebd0a1552f8ce24f).(
831 (new XMLGrammarPoolImplcxx . . $ xercesc_3_2/XMLGrammarPoolImpl#XMLGrammarPoolImpl(9cd01e68ef111285).(XMLPlatformUtilscxx . . $ xercesc_3_2/XMLPlatformUtils#::fgMemoryManagercxx . . $ xercesc_3_2/XMLPlatformUtils#fgMemoryManager.)));
832
833 stdcxx . . $ std/::vector<CPLString> aoNamespaces;
834 GMLASAnalyzerEntityResolvercxx . . $ GMLASAnalyzerEntityResolver# oXSDEntityResolvercxx . . $ GMLASAnalyzerEntityResolver#GMLASAnalyzerEntityResolver(c7fcbb3bcbc1a251).(
835 CPLString(), m_oMapURIToPrefixcxx . . $ GMLASSchemaAnalyzer#m_oMapURIToPrefix., m_oMapDocNSURIToPrefixcxx . . $ GMLASSchemaAnalyzer#m_oMapDocNSURIToPrefix., oCache);
836
837 // In this first pass we load the schemas that are directly pointed by
838 // the user with the XSD open option, or that we found in the
839 // xsi:schemaLocation attribute The namespaces of those schemas are the
840 // "first choice" namespaces from which we will try to find elements to turn
841 // them into layers
842 aoNamespaces.push_back("");
843 for (size_t i = 0; i < aoXSDs.size(); i++)
844 {
845 const CPLString osURI(aoXSDs[i].first);
846 const CPLString osXSDFilename(aoXSDs[i].second);
847
848 GMLASUniquePtrcxx . . $ GMLASUniquePtr#<SAX2XMLReadercxx . . $ xercesc_3_2/SAX2XMLReader#> poParsercxx . . $ GMLASUniquePtr#GMLASUniquePtr(ebd0a1552f8ce24f).(
849 XMLReaderFactorycxx . . $ xercesc_3_2/XMLReaderFactory#::createXMLReadercxx . . $ xercesc_3_2/XMLReaderFactory#createXMLReader(f5a6df77139f5287).(XMLPlatformUtilscxx . . $ xercesc_3_2/XMLPlatformUtils#::fgMemoryManagercxx . . $ xercesc_3_2/XMLPlatformUtils#fgMemoryManager.,
850 poGrammarPool.getcxx . . $ GMLASUniquePtr#get(5a2a78a048fb49a8).()));
851
852 // Commonly useful configuration.
853 //
854 poParser->cxx . . $ GMLASUniquePtr#`operator->`(5a2a78a048fb49a8).setFeaturecxx . . $ xercesc_3_2/SAX2XMLReader#setFeature(82a578018e16270c).(XMLUnicxx . . $ xercesc_3_2/XMLUni#::fgSAX2CoreNameSpacescxx . . $ xercesc_3_2/XMLUni#fgSAX2CoreNameSpaces., true);
855 poParser->cxx . . $ GMLASUniquePtr#`operator->`(5a2a78a048fb49a8).setFeaturecxx . . $ xercesc_3_2/SAX2XMLReader#setFeature(82a578018e16270c).(XMLUnicxx . . $ xercesc_3_2/XMLUni#::fgSAX2CoreNameSpacePrefixescxx . . $ xercesc_3_2/XMLUni#fgSAX2CoreNameSpacePrefixes., true);
856 poParser->cxx . . $ GMLASUniquePtr#`operator->`(5a2a78a048fb49a8).setFeaturecxx . . $ xercesc_3_2/SAX2XMLReader#setFeature(82a578018e16270c).(XMLUnicxx . . $ xercesc_3_2/XMLUni#::fgSAX2CoreValidationcxx . . $ xercesc_3_2/XMLUni#fgSAX2CoreValidation., true);
857
858 // Enable validation.
859 //
860 poParser->cxx . . $ GMLASUniquePtr#`operator->`(5a2a78a048fb49a8).setFeaturecxx . . $ xercesc_3_2/SAX2XMLReader#setFeature(82a578018e16270c).(XMLUnicxx . . $ xercesc_3_2/XMLUni#::fgXercesSchemacxx . . $ xercesc_3_2/XMLUni#fgXercesSchema., true);
861
862 #ifndef __COVERITY__
863 // coverity[unsafe_xml_parse_config]
864 poParser->cxx . . $ GMLASUniquePtr#`operator->`(5a2a78a048fb49a8).setFeaturecxx . . $ xercesc_3_2/SAX2XMLReader#setFeature(82a578018e16270c).(XMLUnicxx . . $ xercesc_3_2/XMLUni#::fgXercesValidationErrorAsFatalcxx . . $ xercesc_3_2/XMLUni#fgXercesValidationErrorAsFatal., false);
865 #endif
866
867 // Use the loaded grammar during parsing.
868 //
869 poParser->cxx . . $ GMLASUniquePtr#`operator->`(5a2a78a048fb49a8).setFeaturecxx . . $ xercesc_3_2/SAX2XMLReader#setFeature(82a578018e16270c).(XMLUnicxx . . $ xercesc_3_2/XMLUni#::fgXercesUseCachedGrammarInParsecxx . . $ xercesc_3_2/XMLUni#fgXercesUseCachedGrammarInParse., true);
870
871 // Don't load schemas from any other source (e.g., from XML document's
872 // xsi:schemaLocation attributes).
873 //
874 poParser->cxx . . $ GMLASUniquePtr#`operator->`(5a2a78a048fb49a8).setFeaturecxx . . $ xercesc_3_2/SAX2XMLReader#setFeature(82a578018e16270c).(XMLUnicxx . . $ xercesc_3_2/XMLUni#::fgXercesLoadSchemacxx . . $ xercesc_3_2/XMLUni#fgXercesLoadSchema., false);
875
876 poParser->cxx . . $ GMLASUniquePtr#`operator->`(5a2a78a048fb49a8).setFeaturecxx . . $ xercesc_3_2/SAX2XMLReader#setFeature(82a578018e16270c).(XMLUnicxx . . $ xercesc_3_2/XMLUni#::fgXercesDisableDefaultEntityResolutioncxx . . $ xercesc_3_2/XMLUni#fgXercesDisableDefaultEntityResolution.,
877 true);
878
879 Grammarcxx . . $ xercesc_3_2/Grammar# *poGrammar = nullptr;
880 if (!GMLASReadercxx . . $ GMLASReader#::LoadXSDInParsercxx . . $ GMLASReader#LoadXSDInParser(41860aab4c7fac85).(
881 poParser.getcxx . . $ GMLASUniquePtr#get(5a2a78a048fb49a8).(), oCache, oXSDEntityResolver, osBaseDirname,
882 osXSDFilename, &poGrammar, bSchemaFullChecking,
883 bHandleMultipleImports))
884 {
885 return false;
886 }
887
888 // Some .xsd like
889 // http://www.opengis.net/gwml-main/2.1 ->
890 // https://wfspoc.brgm-rec.fr/constellation/WS/wfs/BRGM:GWML2?request=DescribeFeatureType&version=2.0.0&service=WFS&namespace=xmlns(ns1=http://www.opengis.net/gwml-main/2.1)&typenames=ns1:GW_Aquifer
891 // do not have a declared targetNamespace, so use the one of the
892 // schemaLocation if the grammar returns an empty namespace.
893 CPLString osGrammarURI(transcodecxx . . $ transcode(39fd9df5ac67f380).(poGrammar->getTargetNamespacecxx . . $ xercesc_3_2/Grammar#getTargetNamespace(b92850b821c2ebdb).()));
894 if (osGrammarURI.empty())
895 {
896 if (!osURI.empty())
897 osGrammarURI = osURI;
898 }
899 if (!osGrammarURI.empty())
900 {
901 // Patch back the aoXSDs element in case we didn't know the
902 // namespace URI initially
903 if (osURI.empty())
904 aoXSDs[i].first = osGrammarURI;
905 aoNamespaces.push_back(stdcxx . . $ std/::move(osGrammarURI));
906 }
907 }
908
909 m_osGMLVersionFoundcxx . . $ GMLASSchemaAnalyzer#m_osGMLVersionFound. = oXSDEntityResolver.GetGMLVersionFoundcxx . . $ GMLASBaseEntityResolver#GetGMLVersionFound(1b8c726d1b99eee0).();
910 m_oSetSchemaURLscxx . . $ GMLASSchemaAnalyzer#m_oSetSchemaURLs. =cxx . . $ std/set#`operator=`(7d6e6bfeb60e39ab). oXSDEntityResolver.GetSchemaURLScxx . . $ GMLASBaseEntityResolver#GetSchemaURLS(229a9feecadb4c0f).();
911
912 m_oIgnoredXPathMatchercxx . . $ GMLASSchemaAnalyzer#m_oIgnoredXPathMatcher..SetDocumentMapURIToPrefixcxx . . $ GMLASXPathMatcher#SetDocumentMapURIToPrefix(daae0e187f77ad85).(m_oMapURIToPrefixcxx . . $ GMLASSchemaAnalyzer#m_oMapURIToPrefix.);
913 m_oChildrenElementsConstraintsXPathMatchercxx . . $ GMLASSchemaAnalyzer#m_oChildrenElementsConstraintsXPathMatcher..SetDocumentMapURIToPrefixcxx . . $ GMLASXPathMatcher#SetDocumentMapURIToPrefix(daae0e187f77ad85).(
914 m_oMapURIToPrefixcxx . . $ GMLASSchemaAnalyzer#m_oMapURIToPrefix.);
915 m_oForcedFlattenedXPathMatchercxx . . $ GMLASSchemaAnalyzer#m_oForcedFlattenedXPathMatcher..SetDocumentMapURIToPrefixcxx . . $ GMLASXPathMatcher#SetDocumentMapURIToPrefix(daae0e187f77ad85).(m_oMapURIToPrefixcxx . . $ GMLASSchemaAnalyzer#m_oMapURIToPrefix.);
916 m_oDisabledFlattenedXPathMatchercxx . . $ GMLASSchemaAnalyzer#m_oDisabledFlattenedXPathMatcher..SetDocumentMapURIToPrefixcxx . . $ GMLASXPathMatcher#SetDocumentMapURIToPrefix(daae0e187f77ad85).(
917 m_oMapURIToPrefixcxx . . $ GMLASSchemaAnalyzer#m_oMapURIToPrefix.);
918
919 XSModelcxx . . $ xercesc_3_2/XSModel# *poModel = getGrammarPoolcxx . . $ getGrammarPool(b9e9fa0c68f93097).(poGrammarPool.getcxx . . $ GMLASUniquePtr#get(5a2a78a048fb49a8).());
920 CPLAssertcxx . . $ `port/cpl_error.h:353:9`!(poModel); // should not be null according to doc
921
922 #if 0
923 XSNamespaceItem* nsItem = poModel->getNamespaceItem(
924 loadedGrammar->getTargetNamespace());
925 if( nsItem == NULL )
926 {
927 CPLError(CE_Failure, CPLE_AppDefined,
928 "getNamespaceItem(%s) failed",
929 transcode(loadedGrammar->getTargetNamespace()).c_str());
930 return false;
931 }
932 #endif
933
934 bool bFoundGMLFeature = false;
935
936 // Second pass, in all namespaces, to figure out inheritance relationships
937 // and group models that have names
938 stdcxx . . $ std/::mapcxx . . $ std/map#<CPLString, CPLString> oMapURIToPrefixWithEmptycxx . . $ std/map#map(46e52724c94dff27).(m_oMapURIToPrefixcxx . . $ GMLASSchemaAnalyzer#m_oMapURIToPrefix.);
939 oMapURIToPrefixWithEmpty[cxx . . $ std/map#`operator[]`(da459db78e6e18a3).""] = "";
940 for (const auto &oIterNS : oMapURIToPrefixWithEmpty)
941 {
942 const CPLString &osNSURI(oIterNS.first);
943 if (osNSURI == szXS_URIcxx . . $ GMLASConstants/szXS_URI. || osNSURI == szXSI_URIcxx . . $ GMLASConstants/szXSI_URI. ||
944 osNSURI == szXMLNS_URIcxx . . $ GMLASConstants/szXMLNS_URI. || osNSURI == szXLINK_URIcxx . . $ GMLASConstants/szXLINK_URI.)
945 {
946 continue;
947 }
948
949 XMLChcxx . . $ XMLCh# *xmlNamespace = nullptr;
950 try
951 {
952 xmlNamespace = XMLStringcxx . . $ xercesc_3_2/XMLString#::transcodecxx . . $ xercesc_3_2/XMLString#transcode(2d9eebfe19c47a81).(osNSURI.c_str());
953 }
954 catch (const TranscodingExceptioncxx . . $ xercesc_3_2/TranscodingException# &e)
955 {
956 CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, "TranscodingException: %s",
957 transcodecxx . . $ transcode(39fd9df5ac67f380).(e.getMessagecxx . . $ xercesc_3_2/XMLException#getMessage(b92850b821c2ebdb).()).c_str());
958 return false;
959 }
960
961 XSNamedMapcxx . . $ xercesc_3_2/XSNamedMap#<XSObjectcxx . . $ xercesc_3_2/XSObject#> *poMapModelGroupDefinition =
962 poModel->getComponentsByNamespacecxx . . $ xercesc_3_2/XSModel#getComponentsByNamespace(ebad7544c2b570a2).(
963 XSConstantscxx . . $ xercesc_3_2/XSConstants#::MODEL_GROUP_DEFINITIONcxx . . $ xercesc_3_2/XSConstants#MODEL_GROUP_DEFINITION., xmlNamespace);
964
965 // Remember group models that have names
966 for (XMLSize_tcxx . . $ XMLSize_t# i = 0; poMapModelGroupDefinition != nullptr &&
967 i < poMapModelGroupDefinition->getLengthcxx . . $ xercesc_3_2/XSNamedMap#getLength(fe4d2d262d4164a8).();
968 i++)
969 {
970 XSModelGroupDefinitioncxx . . $ xercesc_3_2/XSModelGroupDefinition# *modelGroupDefinition =
971 reinterpret_cast<XSModelGroupDefinitioncxx . . $ xercesc_3_2/XSModelGroupDefinition# *>(
972 poMapModelGroupDefinition->itemcxx . . $ xercesc_3_2/XSNamedMap#item(60a54806b2015313).(i));
973 m_oMapModelGroupToMGDcxx . . $ GMLASSchemaAnalyzer#m_oMapModelGroupToMGD.[cxx . . $ std/map#`operator[]`(da459db78e6e18a3).modelGroupDefinition->getModelGroupcxx . . $ xercesc_3_2/XSModelGroupDefinition#getModelGroup(4782e22670138a8b).()] =
974 modelGroupDefinition;
975 }
976
977 CPLDebug("GMLAS", "Discovering substitutions of %s (%s)",
978 oIterNS.second.c_str(), osNSURI.c_str());
979
980 XSNamedMapcxx . . $ xercesc_3_2/XSNamedMap#<XSObjectcxx . . $ xercesc_3_2/XSObject#> *poMapElements = poModel->getComponentsByNamespacecxx . . $ xercesc_3_2/XSModel#getComponentsByNamespace(ebad7544c2b570a2).(
981 XSConstantscxx . . $ xercesc_3_2/XSConstants#::ELEMENT_DECLARATIONcxx . . $ xercesc_3_2/XSConstants#ELEMENT_DECLARATION., xmlNamespace);
982
983 for (XMLSize_tcxx . . $ XMLSize_t# i = 0;
984 poMapElements != nullptr && i < poMapElements->getLengthcxx . . $ xercesc_3_2/XSNamedMap#getLength(fe4d2d262d4164a8).(); i++)
985 {
986 XSElementDeclarationcxx . . $ xercesc_3_2/XSElementDeclaration# *poEltDecl =
987 reinterpret_cast<XSElementDeclarationcxx . . $ xercesc_3_2/XSElementDeclaration# *>(
988 poMapElements->itemcxx . . $ xercesc_3_2/XSNamedMap#item(60a54806b2015313).(i));
989 XSElementDeclarationcxx . . $ xercesc_3_2/XSElementDeclaration# *poSubstGroup =
990 poEltDecl->getSubstitutionGroupAffiliationcxx . . $ xercesc_3_2/XSElementDeclaration#getSubstitutionGroupAffiliation(3e3b4197300ce601).();
991 const CPLString osEltXPath(
992 MakeXPathcxx . . $ GMLASSchemaAnalyzer#MakeXPath(ba8f7a05030d6bc1).(transcodecxx . . $ transcode(39fd9df5ac67f380).(poEltDecl->getNamespacecxx . . $ xercesc_3_2/XSElementDeclaration#getNamespace(b92850b821c2ebdb).()),
993 transcodecxx . . $ transcode(39fd9df5ac67f380).(poEltDecl->getNamecxx . . $ xercesc_3_2/XSElementDeclaration#getName(b92850b821c2ebdb).())));
994 m_oMapXPathToEltDeclcxx . . $ GMLASSchemaAnalyzer#m_oMapXPathToEltDecl.[cxx . . $ std/map#`operator[]`(bbd415b616967878).osEltXPath] = poEltDecl;
995 if (poSubstGroup)
996 {
997 m_oMapParentEltToChildEltcxx . . $ GMLASSchemaAnalyzer#m_oMapParentEltToChildElt.[cxx . . $ std/map#`operator[]`(bbd415b616967878).poSubstGroup].push_back(poEltDecl);
998 #ifdef DEBUG_VERBOSE
999 CPLString osParentType(
1000 MakeXPath(transcode(poSubstGroup->getNamespace()),
1001 transcode(poSubstGroup->getName())));
1002 CPLDebug("GMLAS", "%s is a substitution for %s",
1003 osEltXPath.c_str(), osParentType.c_str());
1004 #endif
1005
1006 // Check if this element derives from
1007 // gml:_Feature/AbstractFeature
1008 if (!bFoundGMLFeature && m_bInstantiateGMLFeaturesOnlycxx . . $ GMLASSchemaAnalyzer#m_bInstantiateGMLFeaturesOnly. &&
1009 !IsGMLNamespacecxx . . $ GMLASSchemaAnalyzer#IsGMLNamespace(86da8d82cde12b2b).(osNSURI) &&
1010 DerivesFromGMLFeaturecxx . . $ GMLASSchemaAnalyzer#DerivesFromGMLFeature(46c8da582617711b).(poEltDecl))
1011 {
1012 CPLDebug("GMLAS",
1013 "Restricting (in first pass) top level "
1014 "elements to those deriving from "
1015 "gml:_Feature/gml:AbstractFeature (due "
1016 "to %s found)",
1017 osEltXPath.c_str());
1018 bFoundGMLFeature = true;
1019 }
1020 }
1021 }
1022
1023 XMLStringcxx . . $ xercesc_3_2/XMLString#::releasecxx . . $ xercesc_3_2/XMLString#release(f34b595fba37d7b5).(&xmlNamespace);
1024 }
1025
1026 // Check that we can find elements in the namespaces pointed in the
1027 // xsi:schemaLocation of the document, then fallback to namespaces
1028 // that might be indirectly imported by those first level namespaces
1029 bool bFoundElementsInFirstChoiceNamespaces = false;
1030 for (size_t iNS = 0;
1031 !bFoundElementsInFirstChoiceNamespaces && iNS < aoNamespaces.size();
1032 iNS++)
1033 {
1034 XMLChcxx . . $ XMLCh# *xmlNamespace = nullptr;
1035 try
1036 {
1037 xmlNamespace = XMLStringcxx . . $ xercesc_3_2/XMLString#::transcodecxx . . $ xercesc_3_2/XMLString#transcode(2d9eebfe19c47a81).(aoNamespaces[iNS].c_str());
1038 }
1039 catch (const TranscodingExceptioncxx . . $ xercesc_3_2/TranscodingException# &e)
1040 {
1041 CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, "TranscodingException: %s",
1042 transcodecxx . . $ transcode(39fd9df5ac67f380).(e.getMessagecxx . . $ xercesc_3_2/XMLException#getMessage(b92850b821c2ebdb).()).c_str());
1043 return false;
1044 }
1045
1046 XSNamedMapcxx . . $ xercesc_3_2/XSNamedMap#<XSObjectcxx . . $ xercesc_3_2/XSObject#> *poMapElements = poModel->getComponentsByNamespacecxx . . $ xercesc_3_2/XSModel#getComponentsByNamespace(ebad7544c2b570a2).(
1047 XSConstantscxx . . $ xercesc_3_2/XSConstants#::ELEMENT_DECLARATIONcxx . . $ xercesc_3_2/XSConstants#ELEMENT_DECLARATION., xmlNamespace);
1048 bFoundElementsInFirstChoiceNamespaces =
1049 poMapElements != nullptr && poMapElements->getLengthcxx . . $ xercesc_3_2/XSNamedMap#getLength(fe4d2d262d4164a8).() > 0;
1050 XMLStringcxx . . $ xercesc_3_2/XMLString#::releasecxx . . $ xercesc_3_2/XMLString#release(f34b595fba37d7b5).(&xmlNamespace);
1051 }
1052 if (!bFoundElementsInFirstChoiceNamespaces)
1053 {
1054 CPLDebug("GMLAS", "Did not find element in 'first choice' namespaces. "
1055 "Falling back to the namespaces they import");
1056 aoNamespaces.clear();
1057 for (const auto &oIterNS : oMapURIToPrefixWithEmpty)
1058 {
1059 const CPLString &osNSURI(oIterNS.first);
1060 if (osNSURI == szXS_URIcxx . . $ GMLASConstants/szXS_URI. || osNSURI == szXSI_URIcxx . . $ GMLASConstants/szXSI_URI. ||
1061 osNSURI == szXMLNS_URIcxx . . $ GMLASConstants/szXMLNS_URI. || osNSURI == szXLINK_URIcxx . . $ GMLASConstants/szXLINK_URI. ||
1062 osNSURI == szWFS_URIcxx . . $ GMLASConstants/szWFS_URI. || osNSURI == szWFS20_URIcxx . . $ GMLASConstants/szWFS20_URI. ||
1063 osNSURI == szGML_URIcxx . . $ GMLASConstants/szGML_URI. || osNSURI == szGML32_URIcxx . . $ GMLASConstants/szGML32_URI.)
1064 {
1065 // Skip all boring namespaces
1066 continue;
1067 }
1068 aoNamespaces.push_back(osNSURI);
1069 }
1070 }
1071
1072 // Find which elements must be top levels (because referenced several
1073 // times)
1074 stdcxx . . $ std/::setcxx . . $ std/set#<XSElementDeclarationcxx . . $ xercesc_3_2/XSElementDeclaration# *> oSetVisitedEltDeclcxx . . $ std/set#set(49f6e7a06ebc5aa8).;
1075 stdcxx . . $ std/::setcxx . . $ std/set#<XSModelGroupcxx . . $ xercesc_3_2/XSModelGroup# *> oSetVisitedModelGroupscxx . . $ std/set#set(49f6e7a06ebc5aa8).;
1076 stdcxx . . $ std/::vector<XSElementDeclarationcxx . . $ xercesc_3_2/XSElementDeclaration# *> oVectorEltsForTopClass;
1077
1078 // For some reason, different XSElementDeclaration* can point to the
1079 // same element, but we only want to instantiate a single class.
1080 // This is the case for base:SpatialDataSet in
1081 // inspire/geologicalunit/geologicalunit.gml test dataset.
1082 stdcxx . . $ std/::setcxx . . $ std/set#<CPLString> aoSetXPathEltsForTopClasscxx . . $ std/set#set(49f6e7a06ebc5aa8).;
1083
1084 // Third and fourth passes
1085 for (int iPass = 0; iPass < 2; ++iPass)
1086 {
1087 for (size_t iNS = 0; iNS < aoNamespaces.size(); iNS++)
1088 {
1089 XMLChcxx . . $ XMLCh# *xmlNamespace = nullptr;
1090 try
1091 {
1092 xmlNamespace = XMLStringcxx . . $ xercesc_3_2/XMLString#::transcodecxx . . $ xercesc_3_2/XMLString#transcode(2d9eebfe19c47a81).(aoNamespaces[iNS].c_str());
1093 }
1094 catch (const TranscodingExceptioncxx . . $ xercesc_3_2/TranscodingException# &e)
1095 {
1096 CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!,
1097 "TranscodingException: %s",
1098 transcodecxx . . $ transcode(39fd9df5ac67f380).(e.getMessagecxx . . $ xercesc_3_2/XMLException#getMessage(b92850b821c2ebdb).()).c_str());
1099 return false;
1100 }
1101
1102 XSNamedMapcxx . . $ xercesc_3_2/XSNamedMap#<XSObjectcxx . . $ xercesc_3_2/XSObject#> *poMapElements =
1103 poModel->getComponentsByNamespacecxx . . $ xercesc_3_2/XSModel#getComponentsByNamespace(ebad7544c2b570a2).(
1104 XSConstantscxx . . $ xercesc_3_2/XSConstants#::ELEMENT_DECLARATIONcxx . . $ xercesc_3_2/XSConstants#ELEMENT_DECLARATION., xmlNamespace);
1105
1106 for (XMLSize_tcxx . . $ XMLSize_t# i = 0;
1107 poMapElements != nullptr && i < poMapElements->getLengthcxx . . $ xercesc_3_2/XSNamedMap#getLength(fe4d2d262d4164a8).();
1108 i++)
1109 {
1110 XSElementDeclarationcxx . . $ xercesc_3_2/XSElementDeclaration# *poEltDecl =
1111 reinterpret_cast<XSElementDeclarationcxx . . $ xercesc_3_2/XSElementDeclaration# *>(
1112 poMapElements->itemcxx . . $ xercesc_3_2/XSNamedMap#item(60a54806b2015313).(i));
1113 XSComplexTypeDefinitioncxx . . $ xercesc_3_2/XSComplexTypeDefinition# *poCT = IsEltCompatibleOfFCcxx . . $ IsEltCompatibleOfFC(6a0bd3739bd6039d).(poEltDecl);
1114 if (!poEltDecl->getAbstractcxx . . $ xercesc_3_2/XSElementDeclaration#getAbstract(50ce9a9e25b4a850).() && poCT != nullptr)
1115 {
1116 CPLString osXPath(
1117 MakeXPathcxx . . $ GMLASSchemaAnalyzer#MakeXPath(ba8f7a05030d6bc1).(transcodecxx . . $ transcode(39fd9df5ac67f380).(poEltDecl->getNamespacecxx . . $ xercesc_3_2/XSElementDeclaration#getNamespace(b92850b821c2ebdb).()),
1118 transcodecxx . . $ transcode(39fd9df5ac67f380).(poEltDecl->getNamecxx . . $ xercesc_3_2/XSElementDeclaration#getName(b92850b821c2ebdb).())));
1119 if (!IsIgnoredXPathcxx . . $ GMLASSchemaAnalyzer#IsIgnoredXPath(86da8d82cde12b2b).(osXPath))
1120 {
1121 if (bFoundGMLFeature && m_bInstantiateGMLFeaturesOnlycxx . . $ GMLASSchemaAnalyzer#m_bInstantiateGMLFeaturesOnly. &&
1122 !DerivesFromGMLFeaturecxx . . $ GMLASSchemaAnalyzer#DerivesFromGMLFeature(46c8da582617711b).(poEltDecl))
1123 {
1124 // Do nothing
1125 }
1126 else if (iPass == 0)
1127 {
1128 #ifdef DEBUG_VERBOSE
1129 CPLDebug(
1130 "GMLAS",
1131 "%s (%s) must be exposed as "
1132 "top-level (is top level in imported schemas)",
1133 osXPath.c_str(),
1134 transcode(
1135 poEltDecl->getTypeDefinition()->getName())
1136 .c_str());
1137 #endif
1138 oSetVisitedEltDecl.insertcxx . . $ std/set#insert(411a10a755068dfe).(poEltDecl);
1139 if (aoSetXPathEltsForTopClass.findcxx . . $ std/set#find(f8922f46a681e6cc).(osXPath) ==cxx . . $ std/`operator==`(a84eb84a7a5e8237).
1140 aoSetXPathEltsForTopClass.endcxx . . $ std/set#end(3220b82c0db6d2a1).())
1141 {
1142 m_oSetEltsForTopClasscxx . . $ GMLASSchemaAnalyzer#m_oSetEltsForTopClass..insertcxx . . $ std/set#insert(411a10a755068dfe).(poEltDecl);
1143 oVectorEltsForTopClass.push_back(poEltDecl);
1144 aoSetXPathEltsForTopClass.insertcxx . . $ std/set#insert(10916b2dbd511ba8).(
1145 stdcxx . . $ std/::move(osXPath));
1146 }
1147 }
1148 else
1149 {
1150 bool bSimpleEnoughOut = true;
1151 int nSubCountSubEltOut = 0;
1152 auto poParticle = poCT->getParticlecxx . . $ xercesc_3_2/XSComplexTypeDefinition#getParticle(d23a6dcd2ef450a4).();
1153 if (poParticle)
1154 {
1155 CPL_IGNORE_RET_VAL(
1156 FindElementsWithMustBeToLevelcxx . . $ GMLASSchemaAnalyzer#FindElementsWithMustBeToLevel(7d42f8025f26bc9e).(
1157 osXPath,
1158 poParticle->getModelGroupTermcxx . . $ xercesc_3_2/XSParticle#getModelGroupTerm(4782e22670138a8b).(), 0,
1159 oSetVisitedEltDecl,
1160 oSetVisitedModelGroups,
1161 oVectorEltsForTopClass,
1162 aoSetXPathEltsForTopClass, poModel,
1163 bSimpleEnoughOut, nSubCountSubEltOut));
1164 }
1165 }
1166 }
1167 }
1168 }
1169
1170 XMLStringcxx . . $ xercesc_3_2/XMLString#::releasecxx . . $ xercesc_3_2/XMLString#release(f34b595fba37d7b5).(&xmlNamespace);
1171 }
1172 }
1173
1174 // Find ambiguous class names
1175 {
1176 for (const auto &oIter : m_oSetEltsForTopClasscxx . . $ GMLASSchemaAnalyzer#m_oSetEltsForTopClass.)
1177 {
1178 CPLString osName(transcodecxx . . $ transcode(39fd9df5ac67f380).(oIter->getNamecxx . . $ xercesc_3_2/XSElementDeclaration#getName(b92850b821c2ebdb).()));
1179 m_oMapEltNamesToInstanceCountcxx . . $ GMLASSchemaAnalyzer#m_oMapEltNamesToInstanceCount.[cxx . . $ std/map#`operator[]`(bbd415b616967878).osName]++;
1180 }
1181 }
1182
1183 // Instantiate all needed typenames
1184 for (const auto &poEltDecl : oVectorEltsForTopClass)
1185 {
1186 const CPLString osXPath(MakeXPathcxx . . $ GMLASSchemaAnalyzer#MakeXPath(ba8f7a05030d6bc1).(transcodecxx . . $ transcode(39fd9df5ac67f380).(poEltDecl->getNamespacecxx . . $ xercesc_3_2/XSElementDeclaration#getNamespace(b92850b821c2ebdb).()),
1187 transcodecxx . . $ transcode(39fd9df5ac67f380).(poEltDecl->getNamecxx . . $ xercesc_3_2/XSElementDeclaration#getName(b92850b821c2ebdb).())));
1188
1189 bool bError = false;
1190 bool bResolvedType =
1191 InstantiateClassFromEltDeclarationcxx . . $ GMLASSchemaAnalyzer#InstantiateClassFromEltDeclaration(81137cf09482b5d).(poEltDecl, poModel, bError);
1192 if (bError)
1193 {
1194 return false;
1195 }
1196 if (!bResolvedType)
1197 {
1198 CPLError(
1199 CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, "Couldn't resolve %s (%s)",
1200 osXPath.c_str(),
1201 transcodecxx . . $ transcode(39fd9df5ac67f380).(poEltDecl->getTypeDefinitioncxx . . $ xercesc_3_2/XSElementDeclaration#getTypeDefinition(cdce5b073bfe8145).()->getNamecxx . . $ xercesc_3_2/XSTypeDefinition#getName(b92850b821c2ebdb).()).c_str());
1202 return false;
1203 }
1204 }
1205
1206 LaunderClassNamescxx . . $ GMLASSchemaAnalyzer#LaunderClassNames(49f6e7a06ebc5aa8).();
1207
1208 return true;
1209 }
1210
1211 /************************************************************************/
1212 /* GetAnnotationDoc() */
1213 /************************************************************************/
1214
1215 static CPLString GetAnnotationDoccxx . . $ GetAnnotationDoc(29613dfbf7736e29).(const XSAnnotationcxx . . $ xercesc_3_2/XSAnnotation# *annotation)
1216 {
1217 if (!annotation)
1218 return CPLString();
1219 CPLString osAnnot(transcodecxx . . $ transcode(39fd9df5ac67f380).(annotation->getAnnotationStringcxx . . $ xercesc_3_2/XSAnnotation#getAnnotationString(b92850b821c2ebdb).()));
1220 CPLXMLNodecxx . . $ CPLXMLNode# *psRoot = CPLParseXMLString(osAnnot);
1221 CPLStripXMLNamespace(psRoot, nullptr, TRUEcxx . . $ `port/cpl_port.h:1184:9`!);
1222 CPLString osDoc(CPLGetXMLValue(psRoot, "=annotation.documentation", ""));
1223 CPLDestroyXMLNode(psRoot);
1224 return osDoc.Trim();
1225 }
1226
1227 /************************************************************************/
1228 /* GetAnnotationDoc() */
1229 /************************************************************************/
1230
1231 static CPLString GetAnnotationDoccxx . . $ GetAnnotationDoc(3a8e1e0d41b57fee).(const XSAnnotationListcxx . . $ xercesc_3_2/XSAnnotationList# *annotationList)
1232 {
1233 if (!annotationList)
1234 return CPLString();
1235 CPLString osRet;
1236 for (size_t i = 0; i < annotationList->sizecxx . . $ xercesc_3_2/BaseRefVectorOf#size(fe4d2d262d4164a8).(); ++i)
1237 {
1238 CPLString osDoc(GetAnnotationDoccxx . . $ GetAnnotationDoc(29613dfbf7736e29).(annotationList->elementAtcxx . . $ xercesc_3_2/BaseRefVectorOf#elementAt(4c851f551995ffc).(i)));
1239 if (!osDoc.empty())
1240 {
1241 if (!osRet.empty())
1242 osRet += "\n";
1243 osRet += osDoc;
1244 }
1245 }
1246 return osRet;
1247 }
1248
1249 /************************************************************************/
1250 /* GetAnnotationDoc() */
1251 /************************************************************************/
1252
1253 static CPLString GetAnnotationDoccxx . . $ GetAnnotationDoc(c42646b806debdc2).(const XSElementDeclarationcxx . . $ xercesc_3_2/XSElementDeclaration# *poEltDecl)
1254 {
1255 XSTypeDefinitioncxx . . $ xercesc_3_2/XSTypeDefinition# *poTypeDef = poEltDecl->getTypeDefinitioncxx . . $ xercesc_3_2/XSElementDeclaration#getTypeDefinition(cdce5b073bfe8145).();
1256 CPLString osDoc = GetAnnotationDoccxx . . $ GetAnnotationDoc(29613dfbf7736e29).(poEltDecl->getAnnotationcxx . . $ xercesc_3_2/XSElementDeclaration#getAnnotation(44ae4ca8aaeb5ed9).());
1257 XSAnnotationListcxx . . $ xercesc_3_2/XSAnnotationList# *list = nullptr;
1258 while (poTypeDef != nullptr)
1259 {
1260 if (poTypeDef->getTypeCategorycxx . . $ xercesc_3_2/XSTypeDefinition#getTypeCategory(648f99a6da51541c).() == XSTypeDefinitioncxx . . $ xercesc_3_2/XSTypeDefinition#::COMPLEX_TYPEcxx . . $ xercesc_3_2/XSTypeDefinition#COMPLEX_TYPE.)
1261 {
1262 XSComplexTypeDefinitioncxx . . $ xercesc_3_2/XSComplexTypeDefinition# *poCT =
1263 reinterpret_cast<XSComplexTypeDefinitioncxx . . $ xercesc_3_2/XSComplexTypeDefinition# *>(poTypeDef);
1264 list = poCT->getAnnotationscxx . . $ xercesc_3_2/XSComplexTypeDefinition#getAnnotations(5111b8e277f44362).();
1265 }
1266 else if (poTypeDef->getTypeCategorycxx . . $ xercesc_3_2/XSTypeDefinition#getTypeCategory(648f99a6da51541c).() == XSTypeDefinitioncxx . . $ xercesc_3_2/XSTypeDefinition#::SIMPLE_TYPEcxx . . $ xercesc_3_2/XSTypeDefinition#SIMPLE_TYPE.)
1267 {
1268 XSSimpleTypeDefinitioncxx . . $ xercesc_3_2/XSSimpleTypeDefinition# *poST =
1269 reinterpret_cast<XSSimpleTypeDefinitioncxx . . $ xercesc_3_2/XSSimpleTypeDefinition# *>(poTypeDef);
1270 list = poST->getAnnotationscxx . . $ xercesc_3_2/XSSimpleTypeDefinition#getAnnotations(5111b8e277f44362).();
1271 }
1272 if (list != nullptr)
1273 break;
1274 XSTypeDefinitioncxx . . $ xercesc_3_2/XSTypeDefinition# *poNewTypeDef = poTypeDef->getBaseTypecxx . . $ xercesc_3_2/XSTypeDefinition#getBaseType(13c19d6317d0eb59).();
1275 if (poNewTypeDef == poTypeDef)
1276 break;
1277 poTypeDef = poNewTypeDef;
1278 }
1279 CPLString osDoc2 = GetAnnotationDoccxx . . $ GetAnnotationDoc(3a8e1e0d41b57fee).(list);
1280 if (!osDoc.empty() && !osDoc2.empty())
1281 {
1282 osDoc += "\n";
1283 osDoc += osDoc2;
1284 }
1285 else if (!osDoc2.empty())
1286 osDoc = stdcxx . . $ std/::move(osDoc2);
1287 return osDoc;
1288 }
1289
1290 /************************************************************************/
1291 /* InstantiateClassFromEltDeclaration() */
1292 /************************************************************************/
1293
1294 bool GMLASSchemaAnalyzercxx . . $ GMLASSchemaAnalyzer#::InstantiateClassFromEltDeclarationcxx . . $ GMLASSchemaAnalyzer#InstantiateClassFromEltDeclaration(81137cf09482b5d).(
1295 XSElementDeclarationcxx . . $ xercesc_3_2/XSElementDeclaration# *poEltDecl, XSModelcxx . . $ xercesc_3_2/XSModel# *poModel, bool &bError)
1296 {
1297 bError = false;
1298 XSComplexTypeDefinitioncxx . . $ xercesc_3_2/XSComplexTypeDefinition# *poCT = IsEltCompatibleOfFCcxx . . $ IsEltCompatibleOfFC(6a0bd3739bd6039d).(poEltDecl);
1299 if (!poEltDecl->getAbstractcxx . . $ xercesc_3_2/XSElementDeclaration#getAbstract(50ce9a9e25b4a850).() && poCT != nullptr)
1300 {
1301 GMLASFeatureClasscxx . . $ GMLASFeatureClass# oClasscxx . . $ GMLASFeatureClass#GMLASFeatureClass(49f6e7a06ebc5aa8).;
1302 const CPLString osEltName(transcodecxx . . $ transcode(39fd9df5ac67f380).(poEltDecl->getNamecxx . . $ xercesc_3_2/XSElementDeclaration#getName(b92850b821c2ebdb).()));
1303 const CPLString osXPath(
1304 MakeXPathcxx . . $ GMLASSchemaAnalyzer#MakeXPath(ba8f7a05030d6bc1).(transcodecxx . . $ transcode(39fd9df5ac67f380).(poEltDecl->getNamespacecxx . . $ xercesc_3_2/XSElementDeclaration#getNamespace(b92850b821c2ebdb).()), osEltName));
1305
1306 if (IsIgnoredXPathcxx . . $ GMLASSchemaAnalyzer#IsIgnoredXPath(86da8d82cde12b2b).(osXPath))
1307 {
1308 #ifdef DEBUG_VERBOSE
1309 CPLDebug("GMLAS", "%s is in ignored xpaths", osXPath.c_str());
1310 #endif
1311 return false;
1312 }
1313
1314 if (m_oMapEltNamesToInstanceCountcxx . . $ GMLASSchemaAnalyzer#m_oMapEltNamesToInstanceCount.[cxx . . $ std/map#`operator[]`(bbd415b616967878).osEltName] > 1)
1315 {
1316 CPLString osLaunderedXPath(osXPath);
1317 osLaunderedXPath.replaceAll(':', '_');
1318 oClass.SetNamecxx . . $ GMLASFeatureClass#SetName(42786403379ca8d8).(osLaunderedXPath);
1319 }
1320 else
1321 oClass.SetNamecxx . . $ GMLASFeatureClass#SetName(42786403379ca8d8).(osEltName);
1322
1323 #ifdef DEBUG_VERBOSE
1324 CPLDebug("GMLAS", "Instantiating element %s", osXPath.c_str());
1325 #endif
1326 oClass.SetXPathcxx . . $ GMLASFeatureClass#SetXPath(42786403379ca8d8).(osXPath);
1327 oClass.SetIsTopLevelEltcxx . . $ GMLASFeatureClass#SetIsTopLevelElt(b45ddcbc8423892c).(
1328 GetTopElementDeclarationFromXPathcxx . . $ GMLASSchemaAnalyzer#GetTopElementDeclarationFromXPath(36d74f5cbbead52).(osXPath, poModel) != nullptr);
1329
1330 stdcxx . . $ std/::setcxx . . $ std/set#<XSModelGroupcxx . . $ xercesc_3_2/XSModelGroup# *> oSetVisitedModelGroupscxx . . $ std/set#set(49f6e7a06ebc5aa8).;
1331
1332 oClass.SetDocumentationcxx . . $ GMLASFeatureClass#SetDocumentation(42786403379ca8d8).(GetAnnotationDoccxx . . $ GetAnnotationDoc(c42646b806debdc2).(poEltDecl));
1333
1334 // might be NULL on swe:values for example
1335 if (poCT->getParticlecxx . . $ xercesc_3_2/XSComplexTypeDefinition#getParticle(d23a6dcd2ef450a4).() != nullptr)
1336 {
1337 stdcxx . . $ std/::mapcxx . . $ std/map#<CPLString, int> oMapCountOccurrencesOfSameNamecxx . . $ std/map#map(49f6e7a06ebc5aa8).;
1338 BuildMapCountOccurrencesOfSameNamecxx . . $ GMLASSchemaAnalyzer#BuildMapCountOccurrencesOfSameName(641bd252dfbd3c56).(
1339 poCT->getParticlecxx . . $ xercesc_3_2/XSComplexTypeDefinition#getParticle(d23a6dcd2ef450a4).()->getModelGroupTermcxx . . $ xercesc_3_2/XSParticle#getModelGroupTerm(4782e22670138a8b).(),
1340 oMapCountOccurrencesOfSameName);
1341
1342 OGRwkbGeometryType eGeomType = wkbUnknown;
1343 if (IsGMLNamespacecxx . . $ GMLASSchemaAnalyzer#IsGMLNamespace(86da8d82cde12b2b).(transcodecxx . . $ transcode(39fd9df5ac67f380).(poCT->getNamespacecxx . . $ xercesc_3_2/XSComplexTypeDefinition#getNamespace(b92850b821c2ebdb).())) &&
1344 (eGeomType = GetOGRGeometryTypecxx . . $ GetOGRGeometryType(617150b046df1df4).(poCT)) != wkbNone)
1345 {
1346 GMLASFieldcxx . . $ GMLASField# oFieldcxx . . $ GMLASField#GMLASField(49f6e7a06ebc5aa8).;
1347 oField.SetNamecxx . . $ GMLASField#SetName(42786403379ca8d8).("geometry");
1348 oField.SetMinOccurscxx . . $ GMLASField#SetMinOccurs(d4f767463ce0a6b3).(1);
1349 oField.SetMaxOccurscxx . . $ GMLASField#SetMaxOccurs(d4f767463ce0a6b3).(1);
1350 oField.SetTypecxx . . $ GMLASField#SetType(1457e335bf1abcdb).(GMLAS_FT_GEOMETRYcxx . . $ GMLAS_FT_GEOMETRY., szFAKEXS_GEOMETRYcxx . . $ GMLASConstants/szFAKEXS_GEOMETRY.);
1351 oField.SetGeomTypecxx . . $ GMLASField#SetGeomType(f47ce3f1fe923726).(eGeomType);
1352 oField.SetXPathcxx . . $ GMLASField#SetXPath(42786403379ca8d8).(osXPath + szMATCH_ALLcxx . . $ GMLASConstants/szMATCH_ALL.);
1353 oField.SetIncludeThisEltInBlobcxx . . $ GMLASField#SetIncludeThisEltInBlob(b45ddcbc8423892c).(true);
1354
1355 oClass.AddFieldcxx . . $ GMLASFeatureClass#AddField(18625785520e30ac).(oField);
1356 }
1357 else if (!ExploreModelGroupcxx . . $ GMLASSchemaAnalyzer#ExploreModelGroup(e6fd9903c30f114c).(
1358 poCT->getParticlecxx . . $ xercesc_3_2/XSComplexTypeDefinition#getParticle(d23a6dcd2ef450a4).()->getModelGroupTermcxx . . $ xercesc_3_2/XSParticle#getModelGroupTerm(4782e22670138a8b).(),
1359 poCT->getAttributeUsescxx . . $ xercesc_3_2/XSComplexTypeDefinition#getAttributeUses(485d41f626ab6abb).(), oClass, 0,
1360 oSetVisitedModelGroups, poModel,
1361 oMapCountOccurrencesOfSameName))
1362 {
1363 bError = true;
1364 return false;
1365 }
1366 }
1367 else
1368 {
1369 // TODO ?
1370 }
1371
1372 if (!LaunderFieldNamescxx . . $ GMLASSchemaAnalyzer#LaunderFieldNames(f08b5a86932eefde).(oClass))
1373 return false;
1374
1375 m_aoClassescxx . . $ GMLASSchemaAnalyzer#m_aoClasses..push_back(stdcxx . . $ std/::move(oClass));
1376 return true;
1377 }
1378 return false;
1379 }
1380
1381 /************************************************************************/
1382 /* SetFieldTypeAndWidthFromDefinition() */
1383 /************************************************************************/
1384
1385 /* static */
1386 void GMLASSchemaAnalyzercxx . . $ GMLASSchemaAnalyzer#::SetFieldTypeAndWidthFromDefinitioncxx . . $ GMLASSchemaAnalyzer#SetFieldTypeAndWidthFromDefinition(4c00e08a965847d4).(
1387 XSSimpleTypeDefinitioncxx . . $ xercesc_3_2/XSSimpleTypeDefinition# *poST, GMLASFieldcxx . . $ GMLASField# &oField)
1388 {
1389 int nMaxLength = 0;
1390 while (
1391 poST->getBaseTypecxx . . $ xercesc_3_2/XSSimpleTypeDefinition#getBaseType(13c19d6317d0eb59).() != poST &&
1392 poST->getBaseTypecxx . . $ xercesc_3_2/XSSimpleTypeDefinition#getBaseType(13c19d6317d0eb59).()->getTypeCategorycxx . . $ xercesc_3_2/XSTypeDefinition#getTypeCategory(648f99a6da51541c).() ==
1393 XSTypeDefinitioncxx . . $ xercesc_3_2/XSTypeDefinition#::SIMPLE_TYPEcxx . . $ xercesc_3_2/XSTypeDefinition#SIMPLE_TYPE. &&
1394 !XMLStringcxx . . $ xercesc_3_2/XMLString#::equalscxx . . $ xercesc_3_2/XMLString#equals(b769d9dd7e23d000).(poST->getNamespacecxx . . $ xercesc_3_2/XSSimpleTypeDefinition#getNamespace(b92850b821c2ebdb).(), PSVIUnicxx . . $ xercesc_3_2/PSVIUni#::fgNamespaceXmlSchemacxx . . $ xercesc_3_2/PSVIUni#fgNamespaceXmlSchema.))
1395 {
1396 const XMLChcxx . . $ XMLCh# *maxLength =
1397 poST->getLexicalFacetValuecxx . . $ xercesc_3_2/XSSimpleTypeDefinition#getLexicalFacetValue(9b5156274d2bb0de).(XSSimpleTypeDefinitioncxx . . $ xercesc_3_2/XSSimpleTypeDefinition#::FACET_LENGTHcxx . . $ xercesc_3_2/XSSimpleTypeDefinition#FACET_LENGTH.);
1398 if (maxLength == nullptr)
1399 {
1400 maxLength = poST->getLexicalFacetValuecxx . . $ xercesc_3_2/XSSimpleTypeDefinition#getLexicalFacetValue(9b5156274d2bb0de).(
1401 XSSimpleTypeDefinitioncxx . . $ xercesc_3_2/XSSimpleTypeDefinition#::FACET_MAXLENGTHcxx . . $ xercesc_3_2/XSSimpleTypeDefinition#FACET_MAXLENGTH.);
1402 }
1403 if (maxLength != nullptr)
1404 nMaxLength = stdcxx . . $ std/::maxcxx . . $ std/max(2a338fce5842aa6a).(nMaxLength, atoicxx . . $ atoi(f5ecf3191ed0cd93).(transcodecxx . . $ transcode(39fd9df5ac67f380).(maxLength)));
1405 poST = reinterpret_cast<XSSimpleTypeDefinitioncxx . . $ xercesc_3_2/XSSimpleTypeDefinition# *>(poST->getBaseTypecxx . . $ xercesc_3_2/XSSimpleTypeDefinition#getBaseType(13c19d6317d0eb59).());
1406 }
1407
1408 if (XMLStringcxx . . $ xercesc_3_2/XMLString#::equalscxx . . $ xercesc_3_2/XMLString#equals(b769d9dd7e23d000).(poST->getNamespacecxx . . $ xercesc_3_2/XSSimpleTypeDefinition#getNamespace(b92850b821c2ebdb).(), PSVIUnicxx . . $ xercesc_3_2/PSVIUni#::fgNamespaceXmlSchemacxx . . $ xercesc_3_2/PSVIUni#fgNamespaceXmlSchema.))
1409 {
1410 CPLString osType(transcodecxx . . $ transcode(39fd9df5ac67f380).(poST->getNamecxx . . $ xercesc_3_2/XSSimpleTypeDefinition#getName(b92850b821c2ebdb).()));
1411 oField.SetTypecxx . . $ GMLASField#SetType(1457e335bf1abcdb).(GMLASFieldcxx . . $ GMLASField#::GetTypeFromStringcxx . . $ GMLASField#GetTypeFromString(1f84dad9d29c9701).(osType), osType);
1412 }
1413 else
1414 {
1415 CPLError(CE_Warning, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, "Base type is not a xs: one ???");
1416 }
1417
1418 oField.SetWidthcxx . . $ GMLASField#SetWidth(d4f767463ce0a6b3).(nMaxLength);
1419 }
1420
1421 /************************************************************************/
1422 /* IsSame() */
1423 /* */
1424 /* The objects returned by different PSVI API are not always the same */
1425 /* so do content inspection to figure out if they are equivalent. */
1426 /************************************************************************/
1427
1428 bool GMLASSchemaAnalyzercxx . . $ GMLASSchemaAnalyzer#::IsSamecxx . . $ GMLASSchemaAnalyzer#IsSame(c4c371448cf3f202).(const XSModelGroupcxx . . $ xercesc_3_2/XSModelGroup# *poModelGroup1,
1429 const XSModelGroupcxx . . $ xercesc_3_2/XSModelGroup# *poModelGroup2)
1430 {
1431 if (poModelGroup1->getCompositorcxx . . $ xercesc_3_2/XSModelGroup#getCompositor(cb9708a35e0ab97a).() != poModelGroup2->getCompositorcxx . . $ xercesc_3_2/XSModelGroup#getCompositor(cb9708a35e0ab97a).())
1432 return false;
1433
1434 const XSParticleListcxx . . $ xercesc_3_2/XSParticleList# *poParticleList1 = poModelGroup1->getParticlescxx . . $ xercesc_3_2/XSModelGroup#getParticles(df925829153f3cdb).();
1435 const XSParticleListcxx . . $ xercesc_3_2/XSParticleList# *poParticleList2 = poModelGroup2->getParticlescxx . . $ xercesc_3_2/XSModelGroup#getParticles(df925829153f3cdb).();
1436 if (poParticleList1->sizecxx . . $ xercesc_3_2/BaseRefVectorOf#size(fe4d2d262d4164a8).() != poParticleList2->sizecxx . . $ xercesc_3_2/BaseRefVectorOf#size(fe4d2d262d4164a8).())
1437 return false;
1438
1439 for (size_t i = 0; i < poParticleList1->sizecxx . . $ xercesc_3_2/BaseRefVectorOf#size(fe4d2d262d4164a8).(); ++i)
1440 {
1441 const XSParticlecxx . . $ xercesc_3_2/XSParticle# *poParticle1 = poParticleList1->elementAtcxx . . $ xercesc_3_2/BaseRefVectorOf#elementAt(4c851f551995ffc).(i);
1442 const XSParticlecxx . . $ xercesc_3_2/XSParticle# *poParticle2 = poParticleList2->elementAtcxx . . $ xercesc_3_2/BaseRefVectorOf#elementAt(4c851f551995ffc).(i);
1443 if (poParticle1->getTermTypecxx . . $ xercesc_3_2/XSParticle#getTermType(8b4c3756b6b7510b).() != poParticle2->getTermTypecxx . . $ xercesc_3_2/XSParticle#getTermType(8b4c3756b6b7510b).() ||
1444 poParticle1->getMinOccurscxx . . $ xercesc_3_2/XSParticle#getMinOccurs(fe4d2d262d4164a8).() != poParticle2->getMinOccurscxx . . $ xercesc_3_2/XSParticle#getMinOccurs(fe4d2d262d4164a8).() ||
1445 poParticle1->getMaxOccurscxx . . $ xercesc_3_2/XSParticle#getMaxOccurs(fe4d2d262d4164a8).() != poParticle2->getMaxOccurscxx . . $ xercesc_3_2/XSParticle#getMaxOccurs(fe4d2d262d4164a8).() ||
1446 poParticle1->getMaxOccursUnboundedcxx . . $ xercesc_3_2/XSParticle#getMaxOccursUnbounded(50ce9a9e25b4a850).() !=
1447 poParticle2->getMaxOccursUnboundedcxx . . $ xercesc_3_2/XSParticle#getMaxOccursUnbounded(50ce9a9e25b4a850).())
1448 {
1449 return false;
1450 }
1451 switch (poParticle1->getTermTypecxx . . $ xercesc_3_2/XSParticle#getTermType(8b4c3756b6b7510b).())
1452 {
1453 case XSParticlecxx . . $ xercesc_3_2/XSParticle#::TERM_EMPTYcxx . . $ xercesc_3_2/XSParticle#TERM_EMPTY.:
1454 break;
1455
1456 case XSParticlecxx . . $ xercesc_3_2/XSParticle#::TERM_ELEMENTcxx . . $ xercesc_3_2/XSParticle#TERM_ELEMENT.:
1457 {
1458 const XSElementDeclarationcxx . . $ xercesc_3_2/XSElementDeclaration# *poElt1 =
1459 const_cast<XSParticlecxx . . $ xercesc_3_2/XSParticle# *>(poParticle1)->getElementTermcxx . . $ xercesc_3_2/XSParticle#getElementTerm(8efbc3b55c72a604).();
1460 const XSElementDeclarationcxx . . $ xercesc_3_2/XSElementDeclaration# *poElt2 =
1461 const_cast<XSParticlecxx . . $ xercesc_3_2/XSParticle# *>(poParticle2)->getElementTermcxx . . $ xercesc_3_2/XSParticle#getElementTerm(8efbc3b55c72a604).();
1462 // Pointer comparison works here
1463 if (poElt1 != poElt2)
1464 return false;
1465 break;
1466 }
1467
1468 case XSParticlecxx . . $ xercesc_3_2/XSParticle#::TERM_MODELGROUPcxx . . $ xercesc_3_2/XSParticle#TERM_MODELGROUP.:
1469 {
1470 const XSModelGroupcxx . . $ xercesc_3_2/XSModelGroup# *psSubGroup1 =
1471 const_cast<XSParticlecxx . . $ xercesc_3_2/XSParticle# *>(poParticle1)->getModelGroupTermcxx . . $ xercesc_3_2/XSParticle#getModelGroupTerm(4782e22670138a8b).();
1472 const XSModelGroupcxx . . $ xercesc_3_2/XSModelGroup# *psSubGroup2 =
1473 const_cast<XSParticlecxx . . $ xercesc_3_2/XSParticle# *>(poParticle2)->getModelGroupTermcxx . . $ xercesc_3_2/XSParticle#getModelGroupTerm(4782e22670138a8b).();
1474 if (!IsSamecxx . . $ GMLASSchemaAnalyzer#IsSame(c4c371448cf3f202).(psSubGroup1, psSubGroup2))
1475 return false;
1476 break;
1477 }
1478
1479 case XSParticlecxx . . $ xercesc_3_2/XSParticle#::TERM_WILDCARDcxx . . $ xercesc_3_2/XSParticle#TERM_WILDCARD.:
1480 {
1481 // TODO: check that pointer comparison works
1482 const XSWildcardcxx . . $ xercesc_3_2/XSWildcard# *psWildcard1 =
1483 const_cast<XSParticlecxx . . $ xercesc_3_2/XSParticle# *>(poParticle1)->getWildcardTermcxx . . $ xercesc_3_2/XSParticle#getWildcardTerm(ecfb7c5d94f34a3f).();
1484 const XSWildcardcxx . . $ xercesc_3_2/XSWildcard# *psWildcard2 =
1485 const_cast<XSParticlecxx . . $ xercesc_3_2/XSParticle# *>(poParticle2)->getWildcardTermcxx . . $ xercesc_3_2/XSParticle#getWildcardTerm(ecfb7c5d94f34a3f).();
1486 if (psWildcard1 != psWildcard2)
1487 return false;
1488 break;
1489 }
1490
1491 default:
1492 {
1493 CPLAssertcxx . . $ `port/cpl_error.h:353:9`!(FALSE);
1494 return false;
1495 }
1496 }
1497 }
1498
1499 return true;
1500 }
1501
1502 /************************************************************************/
1503 /* GetGroupName() */
1504 /* */
1505 /* The model group object returned when exploring a high level model */
1506 /* group isn't the same object as the one returned by model group */
1507 /* definitions and has no name. So we have to investigate the content */
1508 /* of model groups to figure out if they are the same. */
1509 /************************************************************************/
1510
1511 XSModelGroupDefinitioncxx . . $ xercesc_3_2/XSModelGroupDefinition# *
1512 GMLASSchemaAnalyzercxx . . $ GMLASSchemaAnalyzer#::GetGroupDefinitioncxx . . $ GMLASSchemaAnalyzer#GetGroupDefinition(35e7176071efce57).(const XSModelGroupcxx . . $ xercesc_3_2/XSModelGroup# *poModelGroup)
1513 {
1514 for (const auto &oIter : m_oMapModelGroupToMGDcxx . . $ GMLASSchemaAnalyzer#m_oMapModelGroupToMGD.)
1515 {
1516 if (IsSamecxx . . $ GMLASSchemaAnalyzer#IsSame(c4c371448cf3f202).(poModelGroup, oIter.first))
1517 {
1518 return oIter.second;
1519 }
1520 }
1521
1522 return nullptr;
1523 }
1524
1525 /************************************************************************/
1526 /* IsAnyType() */
1527 /************************************************************************/
1528
1529 static bool IsAnyTypecxx . . $ IsAnyType(b5821bb269915aa7).(XSComplexTypeDefinitioncxx . . $ xercesc_3_2/XSComplexTypeDefinition# *poType)
1530 {
1531 if (XMLStringcxx . . $ xercesc_3_2/XMLString#::equalscxx . . $ xercesc_3_2/XMLString#equals(b769d9dd7e23d000).(poType->getBaseTypecxx . . $ xercesc_3_2/XSComplexTypeDefinition#getBaseType(13c19d6317d0eb59).()->getNamespacecxx . . $ xercesc_3_2/XSTypeDefinition#getNamespace(b92850b821c2ebdb).(),
1532 PSVIUnicxx . . $ xercesc_3_2/PSVIUni#::fgNamespaceXmlSchemacxx . . $ xercesc_3_2/PSVIUni#fgNamespaceXmlSchema.) &&
1533 transcodecxx . . $ transcode(39fd9df5ac67f380).(poType->getBaseTypecxx . . $ xercesc_3_2/XSComplexTypeDefinition#getBaseType(13c19d6317d0eb59).()->getNamecxx . . $ xercesc_3_2/XSTypeDefinition#getName(b92850b821c2ebdb).()) == szXS_ANY_TYPEcxx . . $ GMLASConstants/szXS_ANY_TYPE.)
1534 {
1535 XSParticlecxx . . $ xercesc_3_2/XSParticle# *poParticle = poType->getParticlecxx . . $ xercesc_3_2/XSComplexTypeDefinition#getParticle(d23a6dcd2ef450a4).();
1536 if (poParticle != nullptr)
1537 {
1538 XSModelGroupcxx . . $ xercesc_3_2/XSModelGroup# *poGroupTerm = poParticle->getModelGroupTermcxx . . $ xercesc_3_2/XSParticle#getModelGroupTerm(4782e22670138a8b).();
1539 if (poGroupTerm != nullptr)
1540 {
1541 XSParticleListcxx . . $ xercesc_3_2/XSParticleList# *poParticles = poGroupTerm->getParticlescxx . . $ xercesc_3_2/XSModelGroup#getParticles(df925829153f3cdb).();
1542 if (poParticles != nullptr)
1543 {
1544 return poParticles->sizecxx . . $ xercesc_3_2/BaseRefVectorOf#size(fe4d2d262d4164a8).() == 1 &&
1545 poParticles->elementAtcxx . . $ xercesc_3_2/BaseRefVectorOf#elementAt(60a54806b2015313).(0)->getTermTypecxx . . $ xercesc_3_2/XSParticle#getTermType(8b4c3756b6b7510b).() ==
1546 XSParticlecxx . . $ xercesc_3_2/XSParticle#::TERM_WILDCARDcxx . . $ xercesc_3_2/XSParticle#TERM_WILDCARD.;
1547 }
1548 }
1549 }
1550 else if (poType->getDerivationMethodcxx . . $ xercesc_3_2/XSComplexTypeDefinition#getDerivationMethod(6948e81cad480420).() ==
1551 XSConstantscxx . . $ xercesc_3_2/XSConstants#::DERIVATION_EXTENSIONcxx . . $ xercesc_3_2/XSConstants#DERIVATION_EXTENSION.)
1552 {
1553 // swe:values case
1554 return true;
1555 }
1556 }
1557 return false;
1558 }
1559
1560 /************************************************************************/
1561 /* SetFieldFromAttribute() */
1562 /************************************************************************/
1563
1564 bool GMLASSchemaAnalyzercxx . . $ GMLASSchemaAnalyzer#::SetFieldFromAttributecxx . . $ GMLASSchemaAnalyzer#SetFieldFromAttribute(492ff3cb2cbdd4b0).(GMLASFieldcxx . . $ GMLASField# &oField,
1565 XSAttributeUsecxx . . $ xercesc_3_2/XSAttributeUse# *poAttr,
1566 const CPLString &osXPathPrefix,
1567 const CPLString &osNamePrefix)
1568 {
1569 const XSAttributeDeclarationcxx . . $ xercesc_3_2/XSAttributeDeclaration# *poAttrDecl = poAttr->getAttrDeclarationcxx . . $ xercesc_3_2/XSAttributeUse#getAttrDeclaration(15623097f01dd279).();
1570 const CPLString osNS(transcodecxx . . $ transcode(39fd9df5ac67f380).(poAttrDecl->getNamespacecxx . . $ xercesc_3_2/XSAttributeDeclaration#getNamespace(b92850b821c2ebdb).()));
1571 const CPLString osName(transcodecxx . . $ transcode(39fd9df5ac67f380).(poAttrDecl->getNamecxx . . $ xercesc_3_2/XSAttributeDeclaration#getName(b92850b821c2ebdb).()));
1572
1573 if (osNamePrefix.empty())
1574 oField.SetNamecxx . . $ GMLASField#SetName(42786403379ca8d8).(osName);
1575 else
1576 oField.SetNamecxx . . $ GMLASField#SetName(42786403379ca8d8).(osNamePrefix + "_" + osName);
1577
1578 XSSimpleTypeDefinitioncxx . . $ xercesc_3_2/XSSimpleTypeDefinition# *poAttrType = poAttrDecl->getTypeDefinitioncxx . . $ xercesc_3_2/XSAttributeDeclaration#getTypeDefinition(7b99620ce20aaec3).();
1579 if (!poAttrType)
1580 {
1581 CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!,
1582 "Cannot get type definition for attribute %s",
1583 oField.GetNamecxx . . $ GMLASField#GetName(1b8c726d1b99eee0).().c_str());
1584 return false;
1585 }
1586
1587 SetFieldTypeAndWidthFromDefinitioncxx . . $ GMLASSchemaAnalyzer#SetFieldTypeAndWidthFromDefinition(4c00e08a965847d4).(poAttrType, oField);
1588
1589 oField.SetXPathcxx . . $ GMLASField#SetXPath(42786403379ca8d8).(osXPathPrefix + "/@" + MakeXPathcxx . . $ GMLASSchemaAnalyzer#MakeXPath(ba8f7a05030d6bc1).(osNS, osName));
1590 if (poAttr->getRequiredcxx . . $ xercesc_3_2/XSAttributeUse#getRequired(50ce9a9e25b4a850).())
1591 {
1592 oField.SetNotNullablecxx . . $ GMLASField#SetNotNullable(b45ddcbc8423892c).(true);
1593 }
1594 oField.SetMinOccurscxx . . $ GMLASField#SetMinOccurs(d4f767463ce0a6b3).(oField.IsNotNullablecxx . . $ GMLASField#IsNotNullable(50ce9a9e25b4a850).() ? 1 : 0);
1595 oField.SetMaxOccurscxx . . $ GMLASField#SetMaxOccurs(d4f767463ce0a6b3).(1);
1596 if (poAttr->getConstraintTypecxx . . $ xercesc_3_2/XSAttributeUse#getConstraintType(cc8cfb2ba6e88401).() == XSConstantscxx . . $ xercesc_3_2/XSConstants#::VALUE_CONSTRAINT_FIXEDcxx . . $ xercesc_3_2/XSConstants#VALUE_CONSTRAINT_FIXED.)
1597 {
1598 oField.SetFixedValuecxx . . $ GMLASField#SetFixedValue(42786403379ca8d8).(transcodecxx . . $ transcode(39fd9df5ac67f380).(poAttr->getConstraintValuecxx . . $ xercesc_3_2/XSAttributeUse#getConstraintValue(4d7d1584a36f43f6).()));
1599 }
1600 else if (poAttr->getConstraintTypecxx . . $ xercesc_3_2/XSAttributeUse#getConstraintType(cc8cfb2ba6e88401).() ==
1601 XSConstantscxx . . $ xercesc_3_2/XSConstants#::VALUE_CONSTRAINT_DEFAULTcxx . . $ xercesc_3_2/XSConstants#VALUE_CONSTRAINT_DEFAULT.)
1602 {
1603 oField.SetDefaultValuecxx . . $ GMLASField#SetDefaultValue(42786403379ca8d8).(transcodecxx . . $ transcode(39fd9df5ac67f380).(poAttr->getConstraintValuecxx . . $ xercesc_3_2/XSAttributeUse#getConstraintValue(4d7d1584a36f43f6).()));
1604 }
1605
1606 const bool bIsList =
1607 (poAttrType->getVarietycxx . . $ xercesc_3_2/XSSimpleTypeDefinition#getVariety(12f631c2d3f46b57).() == XSSimpleTypeDefinitioncxx . . $ xercesc_3_2/XSSimpleTypeDefinition#::VARIETY_LISTcxx . . $ xercesc_3_2/XSSimpleTypeDefinition#VARIETY_LIST.);
1608 if (bIsList)
1609 {
1610 SetFieldTypeAndWidthFromDefinitioncxx . . $ GMLASSchemaAnalyzer#SetFieldTypeAndWidthFromDefinition(4c00e08a965847d4).(poAttrType->getItemTypecxx . . $ xercesc_3_2/XSSimpleTypeDefinition#getItemType(7b2d8333f4b51448).(), oField);
1611 if (m_bUseArrayscxx . . $ GMLASSchemaAnalyzer#m_bUseArrays. && IsCompatibleOfArraycxx . . $ IsCompatibleOfArray(58f33dce0e756b8f).(oField.GetTypecxx . . $ GMLASField#GetType(91ae572febc0467e).()))
1612 {
1613 oField.SetListcxx . . $ GMLASField#SetList(b45ddcbc8423892c).(true);
1614 oField.SetArraycxx . . $ GMLASField#SetArray(b45ddcbc8423892c).(true);
1615 }
1616 else
1617 {
1618 // We should probably create an auxiliary table here, but this
1619 // is too corner case for now...
1620 oField.SetTypecxx . . $ GMLASField#SetType(1457e335bf1abcdb).(GMLAS_FT_STRINGcxx . . $ GMLAS_FT_STRING., szXS_STRINGcxx . . $ GMLASConstants/szXS_STRING.);
1621 }
1622 }
1623
1624 oField.SetDocumentationcxx . . $ GMLASField#SetDocumentation(42786403379ca8d8).(GetAnnotationDoccxx . . $ GetAnnotationDoc(29613dfbf7736e29).(poAttrDecl->getAnnotationcxx . . $ xercesc_3_2/XSAttributeDeclaration#getAnnotation(44ae4ca8aaeb5ed9).()));
1625
1626 return true;
1627 }
1628
1629 /************************************************************************/
1630 /* GetConcreteImplementationTypes() */
1631 /************************************************************************/
1632
1633 void GMLASSchemaAnalyzercxx . . $ GMLASSchemaAnalyzer#::GetConcreteImplementationTypescxx . . $ GMLASSchemaAnalyzer#GetConcreteImplementationTypes(34e1fcfb46809e09).(
1634 XSElementDeclarationcxx . . $ xercesc_3_2/XSElementDeclaration# *poParentElt,
1635 stdcxx . . $ std/::vector<XSElementDeclarationcxx . . $ xercesc_3_2/XSElementDeclaration# *> &apoImplEltList)
1636 {
1637 const auto oIter = m_oMapParentEltToChildEltcxx . . $ GMLASSchemaAnalyzer#m_oMapParentEltToChildElt..findcxx . . $ std/map#find(36f8d56706583706).(poParentElt);
1638 if (oIter !=cxx . . $ std/`operator!=`(be6a71a859368080). m_oMapParentEltToChildEltcxx . . $ GMLASSchemaAnalyzer#m_oMapParentEltToChildElt..endcxx . . $ std/map#end(7e4de33083b6e738).())
1639 {
1640 for (size_t j = 0; j < oIter->cxx . . $ std/_Rb_tree_iterator#`operator->`(34d6acfd341ba7ab).second.size(); j++)
1641 {
1642 XSElementDeclarationcxx . . $ xercesc_3_2/XSElementDeclaration# *poSubElt = oIter->cxx . . $ std/_Rb_tree_iterator#`operator->`(34d6acfd341ba7ab).second[j];
1643 if (IsEltCompatibleOfFCcxx . . $ IsEltCompatibleOfFC(6a0bd3739bd6039d).(poSubElt))
1644 {
1645 if (!poSubElt->getAbstractcxx . . $ xercesc_3_2/XSElementDeclaration#getAbstract(50ce9a9e25b4a850).())
1646 {
1647 apoImplEltList.push_back(poSubElt);
1648 }
1649 }
1650 GetConcreteImplementationTypescxx . . $ GMLASSchemaAnalyzer#GetConcreteImplementationTypes(34e1fcfb46809e09).(poSubElt, apoImplEltList);
1651 }
1652 }
1653 }
1654
1655 /************************************************************************/
1656 /* GetConstraintChildrenElements() */
1657 /************************************************************************/
1658
1659 stdcxx . . $ std/::vector<XSElementDeclarationcxx . . $ xercesc_3_2/XSElementDeclaration# *>
1660 GMLASSchemaAnalyzercxx . . $ GMLASSchemaAnalyzer#::GetConstraintChildrenElementscxx . . $ GMLASSchemaAnalyzer#GetConstraintChildrenElements(78fff1f9c0652c8).(const CPLString &osFullXPath)
1661 {
1662
1663 stdcxx . . $ std/::vector<XSElementDeclarationcxx . . $ xercesc_3_2/XSElementDeclaration# *> oVectorRes;
1664 CPLString osMatched;
1665 if (m_oChildrenElementsConstraintsXPathMatchercxx . . $ GMLASSchemaAnalyzer#m_oChildrenElementsConstraintsXPathMatcher..MatchesRefXPathcxx . . $ GMLASXPathMatcher#MatchesRefXPath(cf5d743131df5287).(osFullXPath,
1666 osMatched))
1667 {
1668 const stdcxx . . $ std/::vector<CPLString> &oVector =
1669 m_oMapChildrenElementsConstraintscxx . . $ GMLASSchemaAnalyzer#m_oMapChildrenElementsConstraints.[cxx . . $ std/map#`operator[]`(bbd415b616967878).osMatched];
1670 const stdcxx . . $ std/::mapcxx . . $ std/map#<CPLString, CPLString> &oMapPrefixToURI =
1671 m_oChildrenElementsConstraintsXPathMatchercxx . . $ GMLASSchemaAnalyzer#m_oChildrenElementsConstraintsXPathMatcher..GetMapPrefixToURIcxx . . $ GMLASXPathMatcher#GetMapPrefixToURI(63da06ea30bdc8a6).();
1672 for (size_t j = 0; j < oVector.size(); ++j)
1673 {
1674 const CPLString &osSubElt(oVector[j]);
1675 CPLString osSubEltPrefix;
1676 CPLString osSubEltURI;
1677 CPLString osSubEltType(osSubElt);
1678 size_t nPos = osSubElt.find(":");
1679 if (nPos != stdcxx . . $ std/::string::npos)
1680 {
1681 osSubEltPrefix = osSubElt.substr(0, nPos);
1682 osSubEltType = osSubElt.substr(nPos + 1);
1683
1684 const auto oIter2 = oMapPrefixToURI.findcxx . . $ std/map#find(7b3585bb5da8f7d).(osSubEltPrefix);
1685 if (oIter2 !=cxx . . $ std/`operator!=`(a84eb84a7a5e8237). oMapPrefixToURI.endcxx . . $ std/map#end(b953fec338ad1a3b).())
1686 {
1687 osSubEltURI = oIter2->cxx . . $ std/_Rb_tree_const_iterator#`operator->`(8e614c7de0b1573e).second;
1688 }
1689 else
1690 {
1691 CPLError(CE_Warning, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!,
1692 "Cannot find prefix of type constraint %s",
1693 osSubElt.c_str());
1694 }
1695 }
1696
1697 const CPLString osSubEltXPath(MakeXPathcxx . . $ GMLASSchemaAnalyzer#MakeXPath(ba8f7a05030d6bc1).(osSubEltURI, osSubEltType));
1698 const auto oIter2 = m_oMapXPathToEltDeclcxx . . $ GMLASSchemaAnalyzer#m_oMapXPathToEltDecl..findcxx . . $ std/map#find(36f8d56706583706).(osSubEltXPath);
1699 if (oIter2 !=cxx . . $ std/`operator!=`(be6a71a859368080). m_oMapXPathToEltDeclcxx . . $ GMLASSchemaAnalyzer#m_oMapXPathToEltDecl..endcxx . . $ std/map#end(7e4de33083b6e738).())
1700 {
1701 XSElementDeclarationcxx . . $ xercesc_3_2/XSElementDeclaration# *poSubElt = oIter2->cxx . . $ std/_Rb_tree_iterator#`operator->`(34d6acfd341ba7ab).second;
1702 if (IsEltCompatibleOfFCcxx . . $ IsEltCompatibleOfFC(6a0bd3739bd6039d).(poSubElt))
1703 {
1704 oVectorRes.push_back(poSubElt);
1705 }
1706 }
1707 else
1708 {
1709 CPLError(
1710 CE_Warning, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!,
1711 "Cannot find element declaration of type constraint %s",
1712 osSubElt.c_str());
1713 }
1714 }
1715 }
1716 return oVectorRes;
1717 }
1718
1719 /************************************************************************/
1720 /* GetOGRGeometryType() */
1721 /************************************************************************/
1722
1723 static OGRwkbGeometryType GetOGRGeometryTypecxx . . $ GetOGRGeometryType(617150b046df1df4).(XSTypeDefinitioncxx . . $ xercesc_3_2/XSTypeDefinition# *poTypeDef)
1724 {
1725 const struct MyStructcxx . . $ GetOGRGeometryType(617150b046df1df4).MyStruct#
1726 {
1727 const char *pszNamecxx . . $ GetOGRGeometryType(617150b046df1df4).MyStruct#pszName.;
1728 OGRwkbGeometryType eTypecxx . . $ GetOGRGeometryType(617150b046df1df4).MyStruct#eType.;
1729 } asArray[] = {{"GeometryPropertyType", wkbUnknown},
1730 {"PointPropertyType", wkbPoint},
1731 {"BoundingShapeType", wkbPolygon},
1732 {"PolygonPropertyType", wkbPolygon},
1733 {"LineStringPropertyType", wkbLineString},
1734 {"MultiPointPropertyType", wkbMultiPoint},
1735 {"MultiPolygonPropertyType", wkbMultiPolygon},
1736 {"MultiLineStringPropertyType", wkbMultiLineString},
1737 {"MultiGeometryPropertyType", wkbGeometryCollection},
1738 {"MultiCurvePropertyType", wkbMultiCurve},
1739 {"MultiSurfacePropertyType", wkbMultiSurface},
1740 {"MultiSolidPropertyType", wkbUnknown},
1741 // GeometryArrayPropertyType ?
1742 {"GeometricPrimitivePropertyType", wkbUnknown},
1743 {"CurvePropertyType", wkbCurve},
1744 {"SurfacePropertyType", wkbSurface},
1745 // SurfaceArrayPropertyType ?
1746 // AbstractRingPropertyType ?
1747 // LinearRingPropertyType ?
1748 {"CompositeCurvePropertyType", wkbCurve},
1749 {"CompositeSurfacePropertyType", wkbSurface},
1750 {"CompositeSolidPropertyType", wkbUnknown},
1751 {"GeometricComplexPropertyType", wkbUnknown},
1752 {"SolidPropertyType", wkbPolyhedralSurface}};
1753
1754 CPLString osName(transcodecxx . . $ transcode(39fd9df5ac67f380).(poTypeDef->getNamecxx . . $ xercesc_3_2/XSTypeDefinition#getName(b92850b821c2ebdb).()));
1755 for (size_t i = 0; i < CPL_ARRAYSIZEcxx . . $ `port/cpl_port.h:1144:9`!(asArray); ++i)
1756 {
1757 if (osName == asArray[i].pszNamecxx . . $ GetOGRGeometryType(617150b046df1df4).MyStruct#pszName.)
1758 return asArray[i].eTypecxx . . $ GetOGRGeometryType(617150b046df1df4).MyStruct#eType.;
1759 }
1760 return wkbNone;
1761
1762 #if 0
1763 <complexType name="CurveSegmentArrayPropertyType">
1764 <complexType name="KnotPropertyType">
1765 <complexType name="SurfacePatchArrayPropertyType">
1766 <complexType name="RingPropertyType">
1767 <complexType name="PolygonPatchArrayPropertyType">
1768 <complexType name="TrianglePatchArrayPropertyType">
1769 <complexType name="LineStringSegmentArrayPropertyType">
1770 <complexType name="SolidArrayPropertyType">
1771 #endif
1772 }
1773
1774 /************************************************************************/
1775 /* GetOGRGeometryTypeFromGMLEltName() */
1776 /************************************************************************/
1777
1778 static OGRwkbGeometryType
1779 GetOGRGeometryTypeFromGMLEltNamecxx . . $ GetOGRGeometryTypeFromGMLEltName(f08e7c67973937ab).(const CPLString &osEltName)
1780 {
1781 const struct MyStructcxx . . $ GetOGRGeometryTypeFromGMLEltName(f08e7c67973937ab).MyStruct#
1782 {
1783 const char *pszNamecxx . . $ GetOGRGeometryTypeFromGMLEltName(f08e7c67973937ab).MyStruct#pszName.;
1784 OGRwkbGeometryType eTypecxx . . $ GetOGRGeometryTypeFromGMLEltName(f08e7c67973937ab).MyStruct#eType.;
1785 } asArray[] = {
1786 {"Point", wkbPoint},
1787 {"Polygon", wkbPolygon},
1788 {"Envelope", wkbPolygon},
1789 {"LineString", wkbLineString},
1790 {"MultiPoint", wkbMultiPoint},
1791 {"MultiPolygon", wkbMultiPolygon},
1792 {"MultiLineString", wkbMultiLineString},
1793 {"MultiGeometry", wkbGeometryCollection},
1794 {"MultiCurve", wkbMultiCurve},
1795 {"MultiSurface", wkbMultiSurface},
1796 {"MultiSolid", wkbUnknown},
1797 {"Curve", wkbCurve},
1798 {"Surface", wkbSurface},
1799 {"CompositeCurve", wkbCurve},
1800 {"CompositeSurface", wkbSurface},
1801 {"CompositeSolid", wkbUnknown},
1802 {"GeometricComplex", wkbUnknown},
1803 };
1804
1805 for (size_t i = 0; i < CPL_ARRAYSIZEcxx . . $ `port/cpl_port.h:1144:9`!(asArray); ++i)
1806 {
1807 if (osEltName == asArray[i].pszNamecxx . . $ GetOGRGeometryTypeFromGMLEltName(f08e7c67973937ab).MyStruct#pszName.)
1808 return asArray[i].eTypecxx . . $ GetOGRGeometryTypeFromGMLEltName(f08e7c67973937ab).MyStruct#eType.;
1809 }
1810 return wkbNone;
1811 }
1812
1813 /************************************************************************/
1814 /* CreateNonNestedRelationship() */
1815 /************************************************************************/
1816
1817 void GMLASSchemaAnalyzercxx . . $ GMLASSchemaAnalyzer#::CreateNonNestedRelationshipcxx . . $ GMLASSchemaAnalyzer#CreateNonNestedRelationship(d41c4a386c166014).(
1818 XSElementDeclarationcxx . . $ xercesc_3_2/XSElementDeclaration# *poElt,
1819 stdcxx . . $ std/::vector<XSElementDeclarationcxx . . $ xercesc_3_2/XSElementDeclaration# *> &apoImplEltList,
1820 GMLASFeatureClasscxx . . $ GMLASFeatureClass# &oClass, int nMaxOccurs, bool bEltNameWillNeedPrefix,
1821 bool bForceJunctionTable, bool bCaseOfConstraintChildren)
1822 {
1823 const CPLString osEltPrefix(GetPrefixcxx . . $ GMLASSchemaAnalyzer#GetPrefix(385147141d89f498).(transcodecxx . . $ transcode(39fd9df5ac67f380).(poElt->getNamespacecxx . . $ xercesc_3_2/XSElementDeclaration#getNamespace(b92850b821c2ebdb).())));
1824 const CPLString osEltName(transcodecxx . . $ transcode(39fd9df5ac67f380).(poElt->getNamecxx . . $ xercesc_3_2/XSElementDeclaration#getName(b92850b821c2ebdb).()));
1825 const CPLString osOnlyElementXPath(
1826 MakeXPathcxx . . $ GMLASSchemaAnalyzer#MakeXPath(ba8f7a05030d6bc1).(transcodecxx . . $ transcode(39fd9df5ac67f380).(poElt->getNamespacecxx . . $ xercesc_3_2/XSElementDeclaration#getNamespace(b92850b821c2ebdb).()), osEltName));
1827 const CPLString osElementXPath(oClass.GetXPathcxx . . $ GMLASFeatureClass#GetXPath(1b8c726d1b99eee0).() + "/" +
1828 osOnlyElementXPath);
1829
1830 if (!poElt->getAbstractcxx . . $ xercesc_3_2/XSElementDeclaration#getAbstract(50ce9a9e25b4a850).() && !bCaseOfConstraintChildren)
1831 {
1832 apoImplEltList.insert(apoImplEltList.begin(), poElt);
1833 }
1834
1835 stdcxx . . $ std/::setcxx . . $ std/set#<CPLString> aoSetSubEltXPathcxx . . $ std/set#set(49f6e7a06ebc5aa8).;
1836 if (nMaxOccurs == 1 && !bForceJunctionTable)
1837 {
1838 // If the field isn't repeated, then we can link to each
1839 // potential realization types with a field
1840
1841 for (size_t j = 0; j < apoImplEltList.size(); j++)
1842 {
1843 XSElementDeclarationcxx . . $ xercesc_3_2/XSElementDeclaration# *poSubElt = apoImplEltList[j];
1844 const CPLString osSubEltName(transcodecxx . . $ transcode(39fd9df5ac67f380).(poSubElt->getNamecxx . . $ xercesc_3_2/XSElementDeclaration#getName(b92850b821c2ebdb).()));
1845 const CPLString osSubEltXPath(
1846 MakeXPathcxx . . $ GMLASSchemaAnalyzer#MakeXPath(ba8f7a05030d6bc1).(transcodecxx . . $ transcode(39fd9df5ac67f380).(poSubElt->getNamespacecxx . . $ xercesc_3_2/XSElementDeclaration#getNamespace(b92850b821c2ebdb).()), osSubEltName));
1847
1848 // For AbstractFeature_SpatialDataSet_pkid in SpatialDataSet_member
1849 if (aoSetSubEltXPath.findcxx . . $ std/set#find(f8922f46a681e6cc).(osSubEltXPath) !=cxx . . $ std/`operator!=`(a84eb84a7a5e8237). aoSetSubEltXPath.endcxx . . $ std/set#end(3220b82c0db6d2a1).())
1850 {
1851 continue;
1852 }
1853 aoSetSubEltXPath.insertcxx . . $ std/set#insert(411a10a755068dfe).(osSubEltXPath);
1854
1855 const CPLString osRealFullXPath(oClass.GetXPathcxx . . $ GMLASFeatureClass#GetXPath(1b8c726d1b99eee0).() + "/" +
1856 ((bCaseOfConstraintChildren)
1857 ? osOnlyElementXPath + "/"
1858 : CPLString("")) +
1859 osSubEltXPath);
1860
1861 if (IsIgnoredXPathcxx . . $ GMLASSchemaAnalyzer#IsIgnoredXPath(86da8d82cde12b2b).(osRealFullXPath))
1862 {
1863 #ifdef DEBUG_VERBOSE
1864 CPLDebug("GMLAS", "%s is in ignored xpaths",
1865 osRealFullXPath.c_str());
1866 #endif
1867 continue;
1868 }
1869
1870 GMLASFieldcxx . . $ GMLASField# oFieldcxx . . $ GMLASField#GMLASField(49f6e7a06ebc5aa8).;
1871 if (apoImplEltList.size() > 1 || bCaseOfConstraintChildren)
1872 {
1873 if (m_oMapEltNamesToInstanceCountcxx . . $ GMLASSchemaAnalyzer#m_oMapEltNamesToInstanceCount.[cxx . . $ std/map#`operator[]`(bbd415b616967878).osSubEltName] > 1)
1874 {
1875 CPLString osLaunderedXPath(osSubEltXPath);
1876 osLaunderedXPath.replaceAll(':', '_');
1877 oField.SetNamecxx . . $ GMLASField#SetName(42786403379ca8d8).(((bEltNameWillNeedPrefix) ? osEltPrefix + "_"
1878 : CPLString()) +
1879 transcodecxx . . $ transcode(39fd9df5ac67f380).(poElt->getNamecxx . . $ xercesc_3_2/XSElementDeclaration#getName(b92850b821c2ebdb).()) + "_" +
1880 osLaunderedXPath + "_pkid");
1881 }
1882 else
1883 {
1884 oField.SetNamecxx . . $ GMLASField#SetName(42786403379ca8d8).(((bEltNameWillNeedPrefix) ? osEltPrefix + "_"
1885 : CPLString()) +
1886 transcodecxx . . $ transcode(39fd9df5ac67f380).(poElt->getNamecxx . . $ xercesc_3_2/XSElementDeclaration#getName(b92850b821c2ebdb).()) + "_" +
1887 osSubEltName + "_pkid");
1888 }
1889 }
1890 else
1891 {
1892 oField.SetNamecxx . . $ GMLASField#SetName(42786403379ca8d8).(transcodecxx . . $ transcode(39fd9df5ac67f380).(poElt->getNamecxx . . $ xercesc_3_2/XSElementDeclaration#getName(b92850b821c2ebdb).()) + "_pkid");
1893 }
1894 oField.SetXPathcxx . . $ GMLASField#SetXPath(42786403379ca8d8).(osRealFullXPath);
1895 oField.SetMinOccurscxx . . $ GMLASField#SetMinOccurs(d4f767463ce0a6b3).(0);
1896 oField.SetMaxOccurscxx . . $ GMLASField#SetMaxOccurs(d4f767463ce0a6b3).(nMaxOccurs);
1897 oField.SetCategorycxx . . $ GMLASField#SetCategory(7d753e80d748751c).(GMLASFieldcxx . . $ GMLASField#::PATH_TO_CHILD_ELEMENT_WITH_LINKcxx . . $ GMLASField#PATH_TO_CHILD_ELEMENT_WITH_LINK.);
1898 oField.SetRelatedClassXPathcxx . . $ GMLASField#SetRelatedClassXPath(42786403379ca8d8).(osSubEltXPath);
1899 oField.SetTypecxx . . $ GMLASField#SetType(1457e335bf1abcdb).(GMLAS_FT_STRINGcxx . . $ GMLAS_FT_STRING., szXS_STRINGcxx . . $ GMLASConstants/szXS_STRING.);
1900 oClass.AddFieldcxx . . $ GMLASFeatureClass#AddField(18625785520e30ac).(oField);
1901 }
1902 }
1903 else
1904 {
1905 // If the field is repeated, we need to use junction
1906 // tables
1907 for (size_t j = 0; j < apoImplEltList.size(); j++)
1908 {
1909 XSElementDeclarationcxx . . $ xercesc_3_2/XSElementDeclaration# *poSubElt = apoImplEltList[j];
1910 const CPLString osSubEltName(transcodecxx . . $ transcode(39fd9df5ac67f380).(poSubElt->getNamecxx . . $ xercesc_3_2/XSElementDeclaration#getName(b92850b821c2ebdb).()));
1911 const CPLString osSubEltXPath(
1912 MakeXPathcxx . . $ GMLASSchemaAnalyzer#MakeXPath(ba8f7a05030d6bc1).(transcodecxx . . $ transcode(39fd9df5ac67f380).(poSubElt->getNamespacecxx . . $ xercesc_3_2/XSElementDeclaration#getNamespace(b92850b821c2ebdb).()), osSubEltName));
1913
1914 // For AbstractFeature_SpatialDataSet_pkid in SpatialDataSet_member
1915 if (aoSetSubEltXPath.findcxx . . $ std/set#find(f8922f46a681e6cc).(osSubEltXPath) !=cxx . . $ std/`operator!=`(a84eb84a7a5e8237). aoSetSubEltXPath.endcxx . . $ std/set#end(3220b82c0db6d2a1).())
1916 {
1917 continue;
1918 }
1919 aoSetSubEltXPath.insertcxx . . $ std/set#insert(411a10a755068dfe).(osSubEltXPath);
1920
1921 // Instantiate a junction table
1922 GMLASFeatureClasscxx . . $ GMLASFeatureClass# oJunctionTablecxx . . $ GMLASFeatureClass#GMLASFeatureClass(49f6e7a06ebc5aa8).;
1923
1924 if (m_oMapEltNamesToInstanceCountcxx . . $ GMLASSchemaAnalyzer#m_oMapEltNamesToInstanceCount.[cxx . . $ std/map#`operator[]`(bbd415b616967878).osSubEltName] > 1)
1925 {
1926 CPLString osLaunderedXPath(osSubEltXPath);
1927 osLaunderedXPath.replaceAll(':', '_');
1928 oJunctionTable.SetNamecxx . . $ GMLASFeatureClass#SetName(42786403379ca8d8).(oClass.GetNamecxx . . $ GMLASFeatureClass#GetName(1b8c726d1b99eee0).() + "_" +
1929 transcodecxx . . $ transcode(39fd9df5ac67f380).(poElt->getNamecxx . . $ xercesc_3_2/XSElementDeclaration#getName(b92850b821c2ebdb).()) + "_" +
1930 osLaunderedXPath);
1931 }
1932 else
1933 {
1934 oJunctionTable.SetNamecxx . . $ GMLASFeatureClass#SetName(42786403379ca8d8).(oClass.GetNamecxx . . $ GMLASFeatureClass#GetName(1b8c726d1b99eee0).() + "_" +
1935 transcodecxx . . $ transcode(39fd9df5ac67f380).(poElt->getNamecxx . . $ xercesc_3_2/XSElementDeclaration#getName(b92850b821c2ebdb).()) + "_" +
1936 osSubEltName);
1937 }
1938 // Create a fake XPath binding the parent xpath (to an abstract
1939 // element) to the child element
1940 oJunctionTable.SetXPathcxx . . $ GMLASFeatureClass#SetXPath(42786403379ca8d8).(
1941 BuildJunctionTableXPathcxx . . $ GMLASSchemaAnalyzer#BuildJunctionTableXPath(ba8f7a05030d6bc1).(osElementXPath, osSubEltXPath));
1942 oJunctionTable.SetParentXPathcxx . . $ GMLASFeatureClass#SetParentXPath(42786403379ca8d8).(oClass.GetXPathcxx . . $ GMLASFeatureClass#GetXPath(1b8c726d1b99eee0).());
1943 oJunctionTable.SetChildXPathcxx . . $ GMLASFeatureClass#SetChildXPath(42786403379ca8d8).(osSubEltXPath);
1944 m_aoClassescxx . . $ GMLASSchemaAnalyzer#m_aoClasses..push_back(stdcxx . . $ std/::move(oJunctionTable));
1945
1946 // Add an abstract field
1947 GMLASFieldcxx . . $ GMLASField# oFieldcxx . . $ GMLASField#GMLASField(49f6e7a06ebc5aa8).;
1948 oField.SetNamecxx . . $ GMLASField#SetName(42786403379ca8d8).(
1949 ((bEltNameWillNeedPrefix) ? osEltPrefix + "_" : CPLString()) +
1950 osEltName + "_" + osSubEltName);
1951 oField.SetXPathcxx . . $ GMLASField#SetXPath(42786403379ca8d8).(oClass.GetXPathcxx . . $ GMLASFeatureClass#GetXPath(1b8c726d1b99eee0).() + "/" +
1952 ((bCaseOfConstraintChildren)
1953 ? osOnlyElementXPath + "/"
1954 : CPLString("")) +
1955 osSubEltXPath);
1956 oField.SetMinOccurscxx . . $ GMLASField#SetMinOccurs(d4f767463ce0a6b3).(0);
1957 oField.SetMaxOccurscxx . . $ GMLASField#SetMaxOccurs(d4f767463ce0a6b3).(nMaxOccurs);
1958 oField.SetAbstractElementXPathcxx . . $ GMLASField#SetAbstractElementXPath(42786403379ca8d8).(osElementXPath);
1959 oField.SetRelatedClassXPathcxx . . $ GMLASField#SetRelatedClassXPath(42786403379ca8d8).(osSubEltXPath);
1960 oField.SetCategorycxx . . $ GMLASField#SetCategory(7d753e80d748751c).(
1961 GMLASFieldcxx . . $ GMLASField#::PATH_TO_CHILD_ELEMENT_WITH_JUNCTION_TABLEcxx . . $ GMLASField#PATH_TO_CHILD_ELEMENT_WITH_JUNCTION_TABLE.);
1962 oClass.AddFieldcxx . . $ GMLASFeatureClass#AddField(18625785520e30ac).(oField);
1963 }
1964 }
1965
1966 #if 0
1967 GMLASField oField;
1968 oField.SetName( transcode(poElt->getName()) );
1969 oField.SetXPath( osElementXPath );
1970 oField.SetMinOccurs( poParticle->getMinOccurs() );
1971 oField.SetMaxOccurs( poParticle->getMaxOccursUnbounded() ?
1972 MAXOCCURS_UNLIMITED : poParticle->getMaxOccurs() );
1973
1974 for( size_t j = 0; j < apoImplEltList.size(); j++ )
1975 {
1976 XSElementDeclaration* poSubElt = apoImplEltList[j];
1977 XSTypeDefinition* poSubEltType =
1978 poSubElt->getTypeDefinition();
1979 XSComplexTypeDefinition* poCT =
1980 reinterpret_cast<XSComplexTypeDefinition*>(poSubEltType);
1981
1982 GMLASFeatureClass oNestedClass;
1983 oNestedClass.SetName( oClass.GetName() + "_" +
1984 transcode(poSubElt->getName()) );
1985 oNestedClass.SetXPath( oClass.GetXPath() + "/" +
1986 MakeXPath(transcode(poSubElt->getNamespace()),
1987 transcode(poSubElt->getName())) );
1988
1989 std::set<XSModelGroup*>
1990 oSetNewVisitedModelGroups(oSetVisitedModelGroups);
1991 if( !ExploreModelGroup(
1992 poCT->getParticle()->getModelGroupTerm(),
1993 NULL,
1994 oNestedClass,
1995 nRecursionCounter + 1,
1996 oSetNewVisitedModelGroups ) )
1997 {
1998 return false;
1999 }
2000
2001 oClass.AddNestedClass( oNestedClass );
2002 }
2003
2004 if( !apoImplEltList.empty() )
2005 {
2006 oField.SetAbstract(true);
2007 }
2008 else
2009 {
2010 oField.SetType( GMLAS_FT_ANYTYPE, "anyType" );
2011 oField.SetXPath( oClass.GetXPath() + "/" + "*" );
2012 oField.SetIncludeThisEltInBlob( true );
2013 }
2014 oClass.AddField( oField );
2015 #endif
2016 }
2017
2018 /************************************************************************/
2019 /* IsIgnoredXPath() */
2020 /************************************************************************/
2021
2022 bool GMLASSchemaAnalyzercxx . . $ GMLASSchemaAnalyzer#::IsIgnoredXPathcxx . . $ GMLASSchemaAnalyzer#IsIgnoredXPath(86da8d82cde12b2b).(const CPLString &osXPath)
2023 {
2024 CPLString osIgnored;
2025 return m_oIgnoredXPathMatchercxx . . $ GMLASSchemaAnalyzer#m_oIgnoredXPathMatcher..MatchesRefXPathcxx . . $ GMLASXPathMatcher#MatchesRefXPath(cf5d743131df5287).(osXPath, osIgnored);
2026 }
2027
2028 /************************************************************************/
2029 /* FindElementsWithMustBeToLevel() */
2030 /************************************************************************/
2031
2032 bool GMLASSchemaAnalyzercxx . . $ GMLASSchemaAnalyzer#::FindElementsWithMustBeToLevelcxx . . $ GMLASSchemaAnalyzer#FindElementsWithMustBeToLevel(7d42f8025f26bc9e).(
2033 const CPLString &osParentXPath, XSModelGroupcxx . . $ xercesc_3_2/XSModelGroup# *poModelGroup,
2034 int nRecursionCounter, stdcxx . . $ std/::setcxx . . $ std/set#<XSElementDeclarationcxx . . $ xercesc_3_2/XSElementDeclaration# *> &oSetVisitedEltDecl,
2035 stdcxx . . $ std/::setcxx . . $ std/set#<XSModelGroupcxx . . $ xercesc_3_2/XSModelGroup# *> &oSetVisitedModelGroups,
2036 stdcxx . . $ std/::vector<XSElementDeclarationcxx . . $ xercesc_3_2/XSElementDeclaration# *> &oVectorEltsForTopClass,
2037 stdcxx . . $ std/::setcxx . . $ std/set#<CPLString> &aoSetXPathEltsForTopClass, XSModelcxx . . $ xercesc_3_2/XSModel# *poModel,
2038 bool &bSimpleEnoughOut, int &nCountSubEltsOut)
2039 {
2040 const bool bAlreadyVisitedMG = (oSetVisitedModelGroups.findcxx . . $ std/set#find(f8922f46a681e6cc).(poModelGroup) !=cxx . . $ std/`operator!=`(a84eb84a7a5e8237).
2041 oSetVisitedModelGroups.endcxx . . $ std/set#end(3220b82c0db6d2a1).());
2042
2043 oSetVisitedModelGroups.insertcxx . . $ std/set#insert(411a10a755068dfe).(poModelGroup);
2044
2045 if (nRecursionCounter == 100)
2046 {
2047 // Presumably an hostile schema
2048 CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!,
2049 "Schema analysis failed due to too deeply nested model");
2050 return false;
2051 }
2052
2053 {
2054 CPLString osIgnored;
2055 if (m_oDisabledFlattenedXPathMatchercxx . . $ GMLASSchemaAnalyzer#m_oDisabledFlattenedXPathMatcher..MatchesRefXPathcxx . . $ GMLASXPathMatcher#MatchesRefXPath(cf5d743131df5287).(osParentXPath,
2056 osIgnored))
2057 {
2058 bSimpleEnoughOut = false;
2059 }
2060 }
2061
2062 XSParticleListcxx . . $ xercesc_3_2/XSParticleList# *poParticles = poModelGroup->getParticlescxx . . $ xercesc_3_2/XSModelGroup#getParticles(df925829153f3cdb).();
2063 for (size_t i = 0; i < poParticles->sizecxx . . $ xercesc_3_2/BaseRefVectorOf#size(fe4d2d262d4164a8).(); ++i)
2064 {
2065 XSParticlecxx . . $ xercesc_3_2/XSParticle# *poParticle = poParticles->elementAtcxx . . $ xercesc_3_2/BaseRefVectorOf#elementAt(60a54806b2015313).(i);
2066
2067 const bool bRepeatedParticle = poParticle->getMaxOccursUnboundedcxx . . $ xercesc_3_2/XSParticle#getMaxOccursUnbounded(50ce9a9e25b4a850).() ||
2068 poParticle->getMaxOccurscxx . . $ xercesc_3_2/XSParticle#getMaxOccurs(fe4d2d262d4164a8).() > 1;
2069
2070 if (poParticle->getTermTypecxx . . $ xercesc_3_2/XSParticle#getTermType(8b4c3756b6b7510b).() == XSParticlecxx . . $ xercesc_3_2/XSParticle#::TERM_ELEMENTcxx . . $ xercesc_3_2/XSParticle#TERM_ELEMENT.)
2071 {
2072 XSElementDeclarationcxx . . $ xercesc_3_2/XSElementDeclaration# *poElt = poParticle->getElementTermcxx . . $ xercesc_3_2/XSParticle#getElementTerm(8efbc3b55c72a604).();
2073 XSTypeDefinitioncxx . . $ xercesc_3_2/XSTypeDefinition# *poTypeDef = poElt->getTypeDefinitioncxx . . $ xercesc_3_2/XSElementDeclaration#getTypeDefinition(cdce5b073bfe8145).();
2074 const CPLString osEltName(transcodecxx . . $ transcode(39fd9df5ac67f380).(poElt->getNamecxx . . $ xercesc_3_2/XSElementDeclaration#getName(b92850b821c2ebdb).()));
2075 const CPLString osEltNS(transcodecxx . . $ transcode(39fd9df5ac67f380).(poElt->getNamespacecxx . . $ xercesc_3_2/XSElementDeclaration#getNamespace(b92850b821c2ebdb).()));
2076 CPLString osXPath(MakeXPathcxx . . $ GMLASSchemaAnalyzer#MakeXPath(ba8f7a05030d6bc1).(osEltNS, osEltName));
2077 const CPLString osFullXPath(osParentXPath + "/" + osXPath);
2078
2079 #ifdef DEBUG_SUPER_VERBOSE
2080 CPLDebug("GMLAS", "FindElementsWithMustBeToLevel: %s",
2081 osFullXPath.c_str());
2082 #endif
2083
2084 if (IsIgnoredXPathcxx . . $ GMLASSchemaAnalyzer#IsIgnoredXPath(86da8d82cde12b2b).(osFullXPath))
2085 {
2086 #ifdef DEBUG_VERBOSE
2087 CPLDebug("GMLAS", "%s is in ignored xpaths",
2088 osFullXPath.c_str());
2089 #endif
2090 continue;
2091 }
2092
2093 // This could be refined to detect if the repeated element might not
2094 // be simplifiable as an array
2095 if (bSimpleEnoughOut && bRepeatedParticle)
2096 {
2097 #ifdef DEBUG_VERBOSE
2098 CPLDebug("GMLAS", "%s not inlinable because %s is repeated",
2099 osParentXPath.c_str(), osXPath.c_str());
2100 #endif
2101 bSimpleEnoughOut = false;
2102 }
2103
2104 // We don't want to inline
2105 // sub-classes with hundereds of attributes
2106 nCountSubEltsOut++;
2107
2108 stdcxx . . $ std/::vector<XSElementDeclarationcxx . . $ xercesc_3_2/XSElementDeclaration# *> apoImplEltList;
2109 GetConcreteImplementationTypescxx . . $ GMLASSchemaAnalyzer#GetConcreteImplementationTypes(34e1fcfb46809e09).(poElt, apoImplEltList);
2110
2111 stdcxx . . $ std/::vector<XSElementDeclarationcxx . . $ xercesc_3_2/XSElementDeclaration# *> apoChildrenElements =
2112 GetConstraintChildrenElementscxx . . $ GMLASSchemaAnalyzer#GetConstraintChildrenElements(78fff1f9c0652c8).(osFullXPath);
2113
2114 // Special case for a GML geometry property
2115 if (IsGMLNamespacecxx . . $ GMLASSchemaAnalyzer#IsGMLNamespace(86da8d82cde12b2b).(transcodecxx . . $ transcode(39fd9df5ac67f380).(poTypeDef->getNamespacecxx . . $ xercesc_3_2/XSTypeDefinition#getNamespace(b92850b821c2ebdb).())) &&
2116 GetOGRGeometryTypecxx . . $ GetOGRGeometryType(617150b046df1df4).(poTypeDef) != wkbNone)
2117 {
2118 // Do nothing
2119 }
2120 else if (IsGMLNamespacecxx . . $ GMLASSchemaAnalyzer#IsGMLNamespace(86da8d82cde12b2b).(osEltNS) &&
2121 GetOGRGeometryTypeFromGMLEltNamecxx . . $ GetOGRGeometryTypeFromGMLEltName(f08e7c67973937ab).(osEltName) != wkbNone)
2122 {
2123 // Do nothing
2124 }
2125 // Any GML abstract type
2126 else if (poElt->getAbstractcxx . . $ xercesc_3_2/XSElementDeclaration#getAbstract(50ce9a9e25b4a850).() && IsGMLNamespacecxx . . $ GMLASSchemaAnalyzer#IsGMLNamespace(86da8d82cde12b2b).(osEltNS) &&
2127 osEltName != "_Feature" &&
2128 osEltName != "AbstractFeature" &&
2129 osEltName != "AbstractTimeObject")
2130 {
2131 // Do nothing
2132 }
2133 // Are there substitution groups for this element ?
2134 else if (!apoImplEltList.empty() || !apoChildrenElements.empty())
2135 {
2136 if (!apoChildrenElements.empty())
2137 {
2138 apoImplEltList = stdcxx . . $ std/::move(apoChildrenElements);
2139 }
2140 else if (!poElt->getAbstractcxx . . $ xercesc_3_2/XSElementDeclaration#getAbstract(50ce9a9e25b4a850).())
2141 {
2142 apoImplEltList.insert(apoImplEltList.begin(), poElt);
2143 }
2144 for (size_t j = 0; j < apoImplEltList.size(); j++)
2145 {
2146 XSElementDeclarationcxx . . $ xercesc_3_2/XSElementDeclaration# *poSubElt = apoImplEltList[j];
2147 const CPLString osSubEltXPath(
2148 MakeXPathcxx . . $ GMLASSchemaAnalyzer#MakeXPath(ba8f7a05030d6bc1).(transcodecxx . . $ transcode(39fd9df5ac67f380).(poSubElt->getNamespacecxx . . $ xercesc_3_2/XSElementDeclaration#getNamespace(b92850b821c2ebdb).()),
2149 transcodecxx . . $ transcode(39fd9df5ac67f380).(poSubElt->getNamecxx . . $ xercesc_3_2/XSElementDeclaration#getName(b92850b821c2ebdb).())));
2150
2151 if (IsIgnoredXPathcxx . . $ GMLASSchemaAnalyzer#IsIgnoredXPath(86da8d82cde12b2b).(osParentXPath + "/" + osSubEltXPath))
2152 {
2153 #ifdef DEBUG_VERBOSE
2154 CPLDebug("GMLAS", "%s is in ignored xpaths",
2155 (osParentXPath + "/" + osSubEltXPath).c_str());
2156 #endif
2157 continue;
2158 }
2159
2160 // Make sure we will instantiate the referenced element
2161 if (m_oSetEltsForTopClasscxx . . $ GMLASSchemaAnalyzer#m_oSetEltsForTopClass..findcxx . . $ std/set#find(f8922f46a681e6cc).(poSubElt) ==cxx . . $ std/`operator==`(a84eb84a7a5e8237).
2162 m_oSetEltsForTopClasscxx . . $ GMLASSchemaAnalyzer#m_oSetEltsForTopClass..endcxx . . $ std/set#end(3220b82c0db6d2a1).() &&
2163 aoSetXPathEltsForTopClass.findcxx . . $ std/set#find(f8922f46a681e6cc).(osSubEltXPath) ==cxx . . $ std/`operator==`(a84eb84a7a5e8237).
2164 aoSetXPathEltsForTopClass.endcxx . . $ std/set#end(3220b82c0db6d2a1).())
2165 {
2166 #ifdef DEBUG_VERBOSE
2167 CPLDebug(
2168 "GMLAS",
2169 "%s (%s) must be exposed as "
2170 "top-level (%s of %s)",
2171 osSubEltXPath.c_str(),
2172 transcode(poSubElt->getTypeDefinition()->getName())
2173 .c_str(),
2174 apoChildrenElements.empty() ? "derived class"
2175 : "child",
2176 osParentXPath.c_str());
2177 #endif
2178
2179 oSetVisitedEltDecl.insertcxx . . $ std/set#insert(411a10a755068dfe).(poSubElt);
2180 m_oSetEltsForTopClasscxx . . $ GMLASSchemaAnalyzer#m_oSetEltsForTopClass..insertcxx . . $ std/set#insert(411a10a755068dfe).(poSubElt);
2181 oVectorEltsForTopClass.push_back(poSubElt);
2182 aoSetXPathEltsForTopClass.insertcxx . . $ std/set#insert(411a10a755068dfe).(osSubEltXPath);
2183
2184 XSComplexTypeDefinitioncxx . . $ xercesc_3_2/XSComplexTypeDefinition# *poSubEltCT =
2185 IsEltCompatibleOfFCcxx . . $ IsEltCompatibleOfFC(6a0bd3739bd6039d).(poSubElt);
2186 if (!bAlreadyVisitedMG && poSubEltCT != nullptr &&
2187 poSubEltCT->getParticlecxx . . $ xercesc_3_2/XSComplexTypeDefinition#getParticle(d23a6dcd2ef450a4).() != nullptr)
2188 {
2189 bool bSubSimpleEnoughOut = true;
2190 int nSubCountSubElt = 0;
2191 if (!FindElementsWithMustBeToLevelcxx . . $ GMLASSchemaAnalyzer#FindElementsWithMustBeToLevel(7d42f8025f26bc9e).(
2192 osSubEltXPath,
2193 poSubEltCT->getParticlecxx . . $ xercesc_3_2/XSComplexTypeDefinition#getParticle(d23a6dcd2ef450a4).()
2194 ->getModelGroupTermcxx . . $ xercesc_3_2/XSParticle#getModelGroupTerm(4782e22670138a8b).(),
2195 nRecursionCounter + 1, oSetVisitedEltDecl,
2196 oSetVisitedModelGroups,
2197 oVectorEltsForTopClass,
2198 aoSetXPathEltsForTopClass, poModel,
2199 bSubSimpleEnoughOut, nSubCountSubElt))
2200 {
2201 return false;
2202 }
2203 }
2204 }
2205 }
2206 }
2207
2208 else if (!poElt->getAbstractcxx . . $ xercesc_3_2/XSElementDeclaration#getAbstract(50ce9a9e25b4a850).() &&
2209 poTypeDef->getTypeCategorycxx . . $ xercesc_3_2/XSTypeDefinition#getTypeCategory(648f99a6da51541c).() ==
2210 XSTypeDefinitioncxx . . $ xercesc_3_2/XSTypeDefinition#::COMPLEX_TYPEcxx . . $ xercesc_3_2/XSTypeDefinition#COMPLEX_TYPE.)
2211 {
2212 nCountSubEltsOut--;
2213
2214 XSComplexTypeDefinitioncxx . . $ xercesc_3_2/XSComplexTypeDefinition# *poEltCT = IsEltCompatibleOfFCcxx . . $ IsEltCompatibleOfFC(6a0bd3739bd6039d).(poElt);
2215 if (poEltCT)
2216 {
2217 // Might be a bit extreme, but for now we don't inline
2218 // classes that have subclasses.
2219 if (bSimpleEnoughOut)
2220 {
2221 #ifdef DEBUG_VERBOSE
2222 CPLDebug("GMLAS",
2223 "%s not inlinable because %s field is complex",
2224 osParentXPath.c_str(), osXPath.c_str());
2225 #endif
2226 bSimpleEnoughOut = false;
2227 }
2228
2229 if (oSetVisitedEltDecl.findcxx . . $ std/set#find(f8922f46a681e6cc).(poElt) !=cxx . . $ std/`operator!=`(a84eb84a7a5e8237).
2230 oSetVisitedEltDecl.endcxx . . $ std/set#end(3220b82c0db6d2a1).())
2231 {
2232 if (m_oSetEltsForTopClasscxx . . $ GMLASSchemaAnalyzer#m_oSetEltsForTopClass..findcxx . . $ std/set#find(f8922f46a681e6cc).(poElt) ==cxx . . $ std/`operator==`(a84eb84a7a5e8237).
2233 m_oSetEltsForTopClasscxx . . $ GMLASSchemaAnalyzer#m_oSetEltsForTopClass..endcxx . . $ std/set#end(3220b82c0db6d2a1).() &&
2234 m_oSetSimpleEnoughEltscxx . . $ GMLASSchemaAnalyzer#m_oSetSimpleEnoughElts..findcxx . . $ std/set#find(f8922f46a681e6cc).(poElt) ==cxx . . $ std/`operator==`(a84eb84a7a5e8237).
2235 m_oSetSimpleEnoughEltscxx . . $ GMLASSchemaAnalyzer#m_oSetSimpleEnoughElts..endcxx . . $ std/set#end(3220b82c0db6d2a1).() &&
2236 aoSetXPathEltsForTopClass.findcxx . . $ std/set#find(f8922f46a681e6cc).(osXPath) ==cxx . . $ std/`operator==`(a84eb84a7a5e8237).
2237 aoSetXPathEltsForTopClass.endcxx . . $ std/set#end(3220b82c0db6d2a1).())
2238 {
2239 CPLString osIgnored;
2240 if (!m_oForcedFlattenedXPathMatchercxx . . $ GMLASSchemaAnalyzer#m_oForcedFlattenedXPathMatcher..MatchesRefXPathcxx . . $ GMLASXPathMatcher#MatchesRefXPath(cf5d743131df5287).(
2241 osXPath, osIgnored))
2242 {
2243 #ifdef DEBUG_VERBOSE
2244 CPLDebug("GMLAS",
2245 "%s (%s) must be exposed as "
2246 "top-level (multiple time referenced)",
2247 osXPath.c_str(),
2248 transcode(poTypeDef->getNamespace())
2249 .c_str());
2250 #endif
2251 m_oSetEltsForTopClasscxx . . $ GMLASSchemaAnalyzer#m_oSetEltsForTopClass..insertcxx . . $ std/set#insert(411a10a755068dfe).(poElt);
2252 oVectorEltsForTopClass.push_back(poElt);
2253 aoSetXPathEltsForTopClass.insertcxx . . $ std/set#insert(10916b2dbd511ba8).(
2254 stdcxx . . $ std/::move(osXPath));
2255 }
2256 }
2257 }
2258 else
2259 {
2260 oSetVisitedEltDecl.insertcxx . . $ std/set#insert(411a10a755068dfe).(poElt);
2261
2262 if (!bAlreadyVisitedMG &&
2263 poEltCT->getParticlecxx . . $ xercesc_3_2/XSComplexTypeDefinition#getParticle(d23a6dcd2ef450a4).() != nullptr)
2264 {
2265 int nSubCountSubElt = 0;
2266
2267 // Process attributes
2268 XSAttributeUseListcxx . . $ xercesc_3_2/XSAttributeUseList# *poAttrList =
2269 poEltCT->getAttributeUsescxx . . $ xercesc_3_2/XSComplexTypeDefinition#getAttributeUses(485d41f626ab6abb).();
2270 const size_t nAttrListSize =
2271 (poAttrList != nullptr) ? poAttrList->sizecxx . . $ xercesc_3_2/BaseRefVectorOf#size(fe4d2d262d4164a8).()
2272 : 0;
2273 for (size_t j = 0; j < nAttrListSize; ++j)
2274 {
2275 XSAttributeUsecxx . . $ xercesc_3_2/XSAttributeUse# *poAttr =
2276 poAttrList->elementAtcxx . . $ xercesc_3_2/BaseRefVectorOf#elementAt(60a54806b2015313).(j);
2277 GMLASFieldcxx . . $ GMLASField# oFieldcxx . . $ GMLASField#GMLASField(49f6e7a06ebc5aa8).;
2278 if (!SetFieldFromAttributecxx . . $ GMLASSchemaAnalyzer#SetFieldFromAttribute(492ff3cb2cbdd4b0).(oField, poAttr,
2279 osFullXPath))
2280 {
2281 return false;
2282 }
2283 if (!IsIgnoredXPathcxx . . $ GMLASSchemaAnalyzer#IsIgnoredXPath(86da8d82cde12b2b).(oField.GetXPathcxx . . $ GMLASField#GetXPath(1b8c726d1b99eee0).()) &&
2284 oField.GetFixedValuecxx . . $ GMLASField#GetFixedValue(1b8c726d1b99eee0).().empty())
2285 {
2286 #ifdef DEBUG_SUPER_VERBOSE
2287 CPLDebug(
2288 "GMLAS",
2289 "FindElementsWithMustBeToLevel: %s",
2290 oField.GetXPath().c_str());
2291 #endif
2292 nSubCountSubElt++;
2293 }
2294 }
2295
2296 bool bSubSimpleEnoughOut = true;
2297 if (!FindElementsWithMustBeToLevelcxx . . $ GMLASSchemaAnalyzer#FindElementsWithMustBeToLevel(7d42f8025f26bc9e).(
2298 osFullXPath,
2299 poEltCT->getParticlecxx . . $ xercesc_3_2/XSComplexTypeDefinition#getParticle(d23a6dcd2ef450a4).()->getModelGroupTermcxx . . $ xercesc_3_2/XSParticle#getModelGroupTerm(4782e22670138a8b).(),
2300 nRecursionCounter + 1, oSetVisitedEltDecl,
2301 oSetVisitedModelGroups,
2302 oVectorEltsForTopClass,
2303 aoSetXPathEltsForTopClass, poModel,
2304 bSubSimpleEnoughOut, nSubCountSubElt))
2305 {
2306 return false;
2307 }
2308 if (bSubSimpleEnoughOut)
2309 {
2310 #ifdef DEBUG_VERBOSE
2311 CPLDebug("GMLAS", "%s is inlinable: %d fields",
2312 osXPath.c_str(), nSubCountSubElt);
2313 #endif
2314 m_oSetSimpleEnoughEltscxx . . $ GMLASSchemaAnalyzer#m_oSetSimpleEnoughElts..insertcxx . . $ std/set#insert(411a10a755068dfe).(poElt);
2315
2316 nCountSubEltsOut += nSubCountSubElt;
2317 }
2318 else if (bSimpleEnoughOut)
2319 {
2320 #ifdef DEBUG_VERBOSE
2321 CPLDebug("GMLAS",
2322 "%s not inlinable because %s is not "
2323 "inlinable",
2324 osParentXPath.c_str(),
2325 osXPath.c_str());
2326 #endif
2327 bSimpleEnoughOut = false;
2328 }
2329 }
2330 }
2331 }
2332 else
2333 {
2334 if (transcodecxx . . $ transcode(39fd9df5ac67f380).(poElt->getNamecxx . . $ xercesc_3_2/XSElementDeclaration#getName(b92850b821c2ebdb).()) != szFEATURE_COLLECTIONcxx . . $ GMLASConstants/szFEATURE_COLLECTION.)
2335 {
2336 poEltCT = reinterpret_cast<XSComplexTypeDefinitioncxx . . $ xercesc_3_2/XSComplexTypeDefinition# *>(
2337 poTypeDef);
2338 // Process attributes
2339 XSAttributeUseListcxx . . $ xercesc_3_2/XSAttributeUseList# *poAttrList =
2340 poEltCT->getAttributeUsescxx . . $ xercesc_3_2/XSComplexTypeDefinition#getAttributeUses(485d41f626ab6abb).();
2341 const size_t nAttrListSize =
2342 (poAttrList != nullptr) ? poAttrList->sizecxx . . $ xercesc_3_2/BaseRefVectorOf#size(fe4d2d262d4164a8).() : 0;
2343 for (size_t j = 0;
2344 bSimpleEnoughOut && j < nAttrListSize; ++j)
2345 {
2346 XSAttributeUsecxx . . $ xercesc_3_2/XSAttributeUse# *poAttr = poAttrList->elementAtcxx . . $ xercesc_3_2/BaseRefVectorOf#elementAt(60a54806b2015313).(j);
2347 GMLASFieldcxx . . $ GMLASField# oFieldcxx . . $ GMLASField#GMLASField(49f6e7a06ebc5aa8).;
2348 if (!SetFieldFromAttributecxx . . $ GMLASSchemaAnalyzer#SetFieldFromAttribute(492ff3cb2cbdd4b0).(oField, poAttr,
2349 osFullXPath))
2350 {
2351 return false;
2352 }
2353 if (!IsIgnoredXPathcxx . . $ GMLASSchemaAnalyzer#IsIgnoredXPath(86da8d82cde12b2b).(oField.GetXPathcxx . . $ GMLASField#GetXPath(1b8c726d1b99eee0).()) &&
2354 oField.GetFixedValuecxx . . $ GMLASField#GetFixedValue(1b8c726d1b99eee0).().empty())
2355 {
2356 #ifdef DEBUG_SUPER_VERBOSE
2357 CPLDebug("GMLAS",
2358 "FindElementsWithMustBeToLevel: %s",
2359 oField.GetXPath().c_str());
2360 #endif
2361 nCountSubEltsOut++;
2362 }
2363 }
2364 }
2365 }
2366
2367 CPLString osTargetElement;
2368 if (poElt->getAnnotationcxx . . $ xercesc_3_2/XSElementDeclaration#getAnnotation(44ae4ca8aaeb5ed9).() != nullptr)
2369 {
2370 CPLString osAnnot(transcodecxx . . $ transcode(39fd9df5ac67f380).(
2371 poElt->getAnnotationcxx . . $ xercesc_3_2/XSElementDeclaration#getAnnotation(44ae4ca8aaeb5ed9).()->getAnnotationStringcxx . . $ xercesc_3_2/XSAnnotation#getAnnotationString(9d9c13ec032803fb).()));
2372
2373 #ifdef DEBUG_SUPER_VERBOSE
2374 CPLDebug("GMLAS", "Annot: %s", osAnnot.c_str());
2375 #endif
2376 CPLXMLNodecxx . . $ CPLXMLNode# *psRoot = CPLParseXMLString(osAnnot);
2377 CPLStripXMLNamespace(psRoot, nullptr, TRUEcxx . . $ `port/cpl_port.h:1184:9`!);
2378 osTargetElement = CPLGetXMLValue(
2379 psRoot, "=annotation.appinfo.targetElement", "");
2380 CPLDestroyXMLNode(psRoot);
2381 #ifdef DEBUG_VERBOSE
2382 if (!osTargetElement.empty())
2383 CPLDebug("GMLAS", "targetElement: %s",
2384 osTargetElement.c_str());
2385 #endif
2386 }
2387
2388 // If we have a element of type gml:ReferenceType that has
2389 // a targetElement in its annotation.appinfo, then create
2390 // a dedicated field to have cross-layer relationships.
2391 if (IsGMLNamespacecxx . . $ GMLASSchemaAnalyzer#IsGMLNamespace(86da8d82cde12b2b).(transcodecxx . . $ transcode(39fd9df5ac67f380).(poTypeDef->getNamespacecxx . . $ xercesc_3_2/XSTypeDefinition#getNamespace(b92850b821c2ebdb).())) &&
2392 transcodecxx . . $ transcode(39fd9df5ac67f380).(poTypeDef->getNamecxx . . $ xercesc_3_2/XSTypeDefinition#getName(b92850b821c2ebdb).()) == "ReferenceType" &&
2393 !osTargetElement.empty())
2394 {
2395 XSElementDeclarationcxx . . $ xercesc_3_2/XSElementDeclaration# *poTargetElt =
2396 GetTopElementDeclarationFromXPathcxx . . $ GMLASSchemaAnalyzer#GetTopElementDeclarationFromXPath(36d74f5cbbead52).(osTargetElement,
2397 poModel);
2398 // TODO: even for non abstract we should probably
2399 // handle substitutions
2400 if (poTargetElt != nullptr && !poTargetElt->getAbstractcxx . . $ xercesc_3_2/XSElementDeclaration#getAbstract(50ce9a9e25b4a850).())
2401 {
2402 const CPLString osTargetEltXPath(
2403 MakeXPathcxx . . $ GMLASSchemaAnalyzer#MakeXPath(ba8f7a05030d6bc1).(transcodecxx . . $ transcode(39fd9df5ac67f380).(poTargetElt->getNamespacecxx . . $ xercesc_3_2/XSElementDeclaration#getNamespace(b92850b821c2ebdb).()),
2404 transcodecxx . . $ transcode(39fd9df5ac67f380).(poTargetElt->getNamecxx . . $ xercesc_3_2/XSElementDeclaration#getName(b92850b821c2ebdb).())));
2405
2406 if (IsIgnoredXPathcxx . . $ GMLASSchemaAnalyzer#IsIgnoredXPath(86da8d82cde12b2b).(osTargetEltXPath))
2407 {
2408 #ifdef DEBUG_VERBOSE
2409 CPLDebug("GMLAS", "%s is in ignored xpaths",
2410 osTargetEltXPath.c_str());
2411 #endif
2412 continue;
2413 }
2414
2415 // Make sure we will instantiate the referenced
2416 // element
2417 if (m_oSetEltsForTopClasscxx . . $ GMLASSchemaAnalyzer#m_oSetEltsForTopClass..findcxx . . $ std/set#find(f8922f46a681e6cc).(poTargetElt) ==cxx . . $ std/`operator==`(a84eb84a7a5e8237).
2418 m_oSetEltsForTopClasscxx . . $ GMLASSchemaAnalyzer#m_oSetEltsForTopClass..endcxx . . $ std/set#end(3220b82c0db6d2a1).() &&
2419 aoSetXPathEltsForTopClass.findcxx . . $ std/set#find(f8922f46a681e6cc).(osTargetEltXPath) ==cxx . . $ std/`operator==`(a84eb84a7a5e8237).
2420 aoSetXPathEltsForTopClass.endcxx . . $ std/set#end(3220b82c0db6d2a1).())
2421 {
2422 #ifdef DEBUG_VERBOSE
2423 CPLDebug(
2424 "GMLAS", "%d: Adding %s as (%s) needed type",
2425 __LINE__, osTargetElement.c_str(),
2426 transcode(
2427 poTargetElt->getTypeDefinition()->getName())
2428 .c_str());
2429 #endif
2430 oSetVisitedEltDecl.insertcxx . . $ std/set#insert(411a10a755068dfe).(poTargetElt);
2431 m_oSetEltsForTopClasscxx . . $ GMLASSchemaAnalyzer#m_oSetEltsForTopClass..insertcxx . . $ std/set#insert(411a10a755068dfe).(poTargetElt);
2432 oVectorEltsForTopClass.push_back(poTargetElt);
2433 aoSetXPathEltsForTopClass.insertcxx . . $ std/set#insert(411a10a755068dfe).(osTargetEltXPath);
2434 }
2435
2436 XSComplexTypeDefinitioncxx . . $ xercesc_3_2/XSComplexTypeDefinition# *poTargetEltCT =
2437 IsEltCompatibleOfFCcxx . . $ IsEltCompatibleOfFC(6a0bd3739bd6039d).(poTargetElt);
2438 if (!bAlreadyVisitedMG && poTargetEltCT &&
2439 poTargetEltCT->getParticlecxx . . $ xercesc_3_2/XSComplexTypeDefinition#getParticle(d23a6dcd2ef450a4).() != nullptr)
2440 {
2441 bool bSubSimpleEnoughOut = true;
2442 int nSubCountSubElt = 0;
2443 if (!FindElementsWithMustBeToLevelcxx . . $ GMLASSchemaAnalyzer#FindElementsWithMustBeToLevel(7d42f8025f26bc9e).(
2444 osTargetEltXPath,
2445 poTargetEltCT->getParticlecxx . . $ xercesc_3_2/XSComplexTypeDefinition#getParticle(d23a6dcd2ef450a4).()
2446 ->getModelGroupTermcxx . . $ xercesc_3_2/XSParticle#getModelGroupTerm(4782e22670138a8b).(),
2447 nRecursionCounter + 1, oSetVisitedEltDecl,
2448 oSetVisitedModelGroups,
2449 oVectorEltsForTopClass,
2450 aoSetXPathEltsForTopClass, poModel,
2451 bSubSimpleEnoughOut, nSubCountSubElt))
2452 {
2453 return false;
2454 }
2455 }
2456 }
2457 }
2458 }
2459 }
2460 else if (!bAlreadyVisitedMG &&
2461 poParticle->getTermTypecxx . . $ xercesc_3_2/XSParticle#getTermType(8b4c3756b6b7510b).() == XSParticlecxx . . $ xercesc_3_2/XSParticle#::TERM_MODELGROUPcxx . . $ xercesc_3_2/XSParticle#TERM_MODELGROUP.)
2462 {
2463 // This could be refined to detect if the repeated element might not
2464 // be simplifiable as an array
2465 if (bSimpleEnoughOut && bRepeatedParticle)
2466 {
2467 #ifdef DEBUG_VERBOSE
2468 CPLDebug(
2469 "GMLAS",
2470 "%s not inlinable because there is a repeated particle",
2471 osParentXPath.c_str());
2472 #endif
2473 bSimpleEnoughOut = false;
2474 }
2475
2476 XSModelGroupcxx . . $ xercesc_3_2/XSModelGroup# *psSubModelGroup = poParticle->getModelGroupTermcxx . . $ xercesc_3_2/XSParticle#getModelGroupTerm(4782e22670138a8b).();
2477 if (!FindElementsWithMustBeToLevelcxx . . $ GMLASSchemaAnalyzer#FindElementsWithMustBeToLevel(7d42f8025f26bc9e).(
2478 osParentXPath, psSubModelGroup, nRecursionCounter + 1,
2479 oSetVisitedEltDecl, oSetVisitedModelGroups,
2480 oVectorEltsForTopClass, aoSetXPathEltsForTopClass, poModel,
2481 bSimpleEnoughOut, nCountSubEltsOut))
2482 {
2483 return false;
2484 }
2485 }
2486 else
2487 {
2488 // This could be refined to detect if the repeated element might not
2489 // be simplifiable as an array
2490 if (bSimpleEnoughOut && bRepeatedParticle)
2491 {
2492 #ifdef DEBUG_VERBOSE
2493 CPLDebug(
2494 "GMLAS",
2495 "%s not inlinable because there is a repeated particle",
2496 osParentXPath.c_str());
2497 #endif
2498 bSimpleEnoughOut = false;
2499 }
2500 }
2501 }
2502
2503 if (bSimpleEnoughOut && nCountSubEltsOut > m_nMaximumFieldsForFlatteningcxx . . $ GMLASSchemaAnalyzer#m_nMaximumFieldsForFlattening.)
2504 {
2505 CPLString osIgnored;
2506 if (!m_oForcedFlattenedXPathMatchercxx . . $ GMLASSchemaAnalyzer#m_oForcedFlattenedXPathMatcher..MatchesRefXPathcxx . . $ GMLASXPathMatcher#MatchesRefXPath(cf5d743131df5287).(osParentXPath,
2507 osIgnored))
2508 {
2509 #ifdef DEBUG_VERBOSE
2510 CPLDebug("GMLAS",
2511 "%s not inlinable because it has more than %d fields",
2512 osParentXPath.c_str(), m_nMaximumFieldsForFlattening);
2513 #endif
2514 bSimpleEnoughOut = false;
2515 }
2516 }
2517
2518 return true;
2519 }
2520
2521 /************************************************************************/
2522 /* IsGMLNamespace() */
2523 /************************************************************************/
2524
2525 bool GMLASSchemaAnalyzercxx . . $ GMLASSchemaAnalyzer#::IsGMLNamespacecxx . . $ GMLASSchemaAnalyzer#IsGMLNamespace(86da8d82cde12b2b).(const CPLString &osURI)
2526 {
2527 if (osURI.find(szGML_URIcxx . . $ GMLASConstants/szGML_URI.) == 0)
2528 return true;
2529 // Below is mostly for unit tests were we use xmlns:gml="http://fake_gml"
2530 const auto oIter = m_oMapURIToPrefixcxx . . $ GMLASSchemaAnalyzer#m_oMapURIToPrefix..findcxx . . $ std/map#find(36f8d56706583706).(osURI);
2531 return oIter !=cxx . . $ std/`operator!=`(be6a71a859368080). m_oMapURIToPrefixcxx . . $ GMLASSchemaAnalyzer#m_oMapURIToPrefix..endcxx . . $ std/map#end(7e4de33083b6e738).() && oIter->cxx . . $ std/_Rb_tree_iterator#`operator->`(34d6acfd341ba7ab).second == szGML_PREFIXcxx . . $ GMLASConstants/szGML_PREFIX.;
2532 }
2533
2534 /************************************************************************/
2535 /* BuildMapCountOccurrencesOfSameName() */
2536 /************************************************************************/
2537
2538 void GMLASSchemaAnalyzercxx . . $ GMLASSchemaAnalyzer#::BuildMapCountOccurrencesOfSameNamecxx . . $ GMLASSchemaAnalyzer#BuildMapCountOccurrencesOfSameName(641bd252dfbd3c56).(
2539 XSModelGroupcxx . . $ xercesc_3_2/XSModelGroup# *poModelGroup,
2540 stdcxx . . $ std/::mapcxx . . $ std/map#<CPLString, int> &oMapCountOccurrencesOfSameName)
2541 {
2542 XSParticleListcxx . . $ xercesc_3_2/XSParticleList# *poParticles = poModelGroup->getParticlescxx . . $ xercesc_3_2/XSModelGroup#getParticles(df925829153f3cdb).();
2543 for (size_t i = 0; i < poParticles->sizecxx . . $ xercesc_3_2/BaseRefVectorOf#size(fe4d2d262d4164a8).(); ++i)
2544 {
2545 XSParticlecxx . . $ xercesc_3_2/XSParticle# *poParticle = poParticles->elementAtcxx . . $ xercesc_3_2/BaseRefVectorOf#elementAt(60a54806b2015313).(i);
2546 if (poParticle->getTermTypecxx . . $ xercesc_3_2/XSParticle#getTermType(8b4c3756b6b7510b).() == XSParticlecxx . . $ xercesc_3_2/XSParticle#::TERM_ELEMENTcxx . . $ xercesc_3_2/XSParticle#TERM_ELEMENT.)
2547 {
2548 XSElementDeclarationcxx . . $ xercesc_3_2/XSElementDeclaration# *poElt = poParticle->getElementTermcxx . . $ xercesc_3_2/XSParticle#getElementTerm(8efbc3b55c72a604).();
2549 const CPLString osEltName(transcodecxx . . $ transcode(39fd9df5ac67f380).(poElt->getNamecxx . . $ xercesc_3_2/XSElementDeclaration#getName(b92850b821c2ebdb).()));
2550 oMapCountOccurrencesOfSameName[cxx . . $ std/map#`operator[]`(bbd415b616967878).osEltName]++;
2551 }
2552 else if (poParticle->getTermTypecxx . . $ xercesc_3_2/XSParticle#getTermType(8b4c3756b6b7510b).() == XSParticlecxx . . $ xercesc_3_2/XSParticle#::TERM_MODELGROUPcxx . . $ xercesc_3_2/XSParticle#TERM_MODELGROUP.)
2553 {
2554 XSModelGroupcxx . . $ xercesc_3_2/XSModelGroup# *psSubModelGroup = poParticle->getModelGroupTermcxx . . $ xercesc_3_2/XSParticle#getModelGroupTerm(4782e22670138a8b).();
2555 BuildMapCountOccurrencesOfSameNamecxx . . $ GMLASSchemaAnalyzer#BuildMapCountOccurrencesOfSameName(641bd252dfbd3c56).(psSubModelGroup,
2556 oMapCountOccurrencesOfSameName);
2557 }
2558 }
2559 }
2560
2561 /************************************************************************/
2562 /* ComposeMinOccurs() */
2563 /************************************************************************/
2564
2565 static int ComposeMinOccurscxx . . $ ComposeMinOccurs(9b79fb6aee4c0440).(int nVal1, int nVal2)
2566 {
2567 return nVal1 * nVal2;
2568 }
2569
2570 /************************************************************************/
2571 /* ComposeMaxOccurs() */
2572 /************************************************************************/
2573
2574 static int ComposeMaxOccurscxx . . $ ComposeMaxOccurs(9b79fb6aee4c0440).(int nVal1, int nVal2)
2575 {
2576 if (nVal1 == MAXOCCURS_UNLIMITEDcxx . . $ GMLASConstants/MAXOCCURS_UNLIMITED. || nVal2 == MAXOCCURS_UNLIMITEDcxx . . $ GMLASConstants/MAXOCCURS_UNLIMITED.)
2577 return MAXOCCURS_UNLIMITEDcxx . . $ GMLASConstants/MAXOCCURS_UNLIMITED.;
2578 return nVal1 * nVal2;
2579 }
2580
2581 /************************************************************************/
2582 /* ExploreModelGroup() */
2583 /************************************************************************/
2584
2585 bool GMLASSchemaAnalyzercxx . . $ GMLASSchemaAnalyzer#::ExploreModelGroupcxx . . $ GMLASSchemaAnalyzer#ExploreModelGroup(e6fd9903c30f114c).(
2586 XSModelGroupcxx . . $ xercesc_3_2/XSModelGroup# *poModelGroup, XSAttributeUseListcxx . . $ xercesc_3_2/XSAttributeUseList# *poMainAttrList,
2587 GMLASFeatureClasscxx . . $ GMLASFeatureClass# &oClass, int nRecursionCounter,
2588 stdcxx . . $ std/::setcxx . . $ std/set#<XSModelGroupcxx . . $ xercesc_3_2/XSModelGroup# *> &oSetVisitedModelGroups, XSModelcxx . . $ xercesc_3_2/XSModel# *poModel,
2589 const stdcxx . . $ std/::mapcxx . . $ std/map#<CPLString, int> &oMapCountOccurrencesOfSameName)
2590 {
2591 if (oSetVisitedModelGroups.findcxx . . $ std/set#find(f8922f46a681e6cc).(poModelGroup) !=cxx . . $ std/`operator!=`(a84eb84a7a5e8237).
2592 oSetVisitedModelGroups.endcxx . . $ std/set#end(3220b82c0db6d2a1).())
2593 {
2594 CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!, "%s already visited",
2595 oClass.GetXPathcxx . . $ GMLASFeatureClass#GetXPath(1b8c726d1b99eee0).().c_str());
2596 return false;
2597 }
2598 oSetVisitedModelGroups.insertcxx . . $ std/set#insert(411a10a755068dfe).(poModelGroup);
2599
2600 if (nRecursionCounter == 100)
2601 {
2602 // Presumably an hostile schema
2603 CPLError(CE_Failure, CPLE_AppDefinedcxx . . $ `port/cpl_error.h:108:9`!,
2604 "Schema analysis failed due to too deeply nested model");
2605 return false;
2606 }
2607
2608 if (poMainAttrList != nullptr)
2609 {
2610 const size_t nMainAttrListSize = poMainAttrList->sizecxx . . $ xercesc_3_2/BaseRefVectorOf#size(fe4d2d262d4164a8).();
2611 for (size_t j = 0; j < nMainAttrListSize; ++j)
2612 {
2613 GMLASFieldcxx . . $ GMLASField# oFieldcxx . . $ GMLASField#GMLASField(49f6e7a06ebc5aa8).;
2614 XSAttributeUsecxx . . $ xercesc_3_2/XSAttributeUse# *poAttr = poMainAttrList->elementAtcxx . . $ xercesc_3_2/BaseRefVectorOf#elementAt(60a54806b2015313).(j);
2615 if (!SetFieldFromAttributecxx . . $ GMLASSchemaAnalyzer#SetFieldFromAttribute(492ff3cb2cbdd4b0).(oField, poAttr, oClass.GetXPathcxx . . $ GMLASFeatureClass#GetXPath(1b8c726d1b99eee0).()))
2616 {
2617 return false;
2618 }
2619
2620 if (IsIgnoredXPathcxx . . $ GMLASSchemaAnalyzer#IsIgnoredXPath(86da8d82cde12b2b).(oField.GetXPathcxx . . $ GMLASField#GetXPath(1b8c726d1b99eee0).()))
2621 {
2622 #ifdef DEBUG_VERBOSE
2623 CPLDebug("GMLAS", "%s is in ignored xpaths",
2624 oField.GetXPath().c_str());
2625 #endif
2626 if (!oField.GetFixedValuecxx . . $ GMLASField#GetFixedValue(1b8c726d1b99eee0).().empty() ||
2627 !oField.GetDefaultValuecxx . . $ GMLASField#GetDefaultValue(1b8c726d1b99eee0).().empty())
2628 {
2629 oField.SetIgnoredcxx . . $ GMLASField#SetIgnored(49f6e7a06ebc5aa8).();
2630 }
2631 else
2632 {
2633 continue;
2634 }
2635 }
2636
2637 oClass.AddFieldcxx . . $ GMLASFeatureClass#AddField(18625785520e30ac).(oField);
2638 }
2639 }
2640
2641 XSParticleListcxx . . $ xercesc_3_2/XSParticleList# *poParticles = poModelGroup->getParticlescxx . . $ xercesc_3_2/XSModelGroup#getParticles(df925829153f3cdb).();
2642
2643 // Special case for GML 3.1.1 where gml:metaDataProperty should be
2644 // a sequence of gml:_Metadata but for some reason they have used
2645 // a sequence of any.
2646 if (oClass.GetXPathcxx . . $ GMLASFeatureClass#GetXPath(1b8c726d1b99eee0).() == "gml:metaDataProperty" &&
2647 poModelGroup->getCompositorcxx . . $ xercesc_3_2/XSModelGroup#getCompositor(cb9708a35e0ab97a).() == XSModelGroupcxx . . $ xercesc_3_2/XSModelGroup#::COMPOSITOR_SEQUENCEcxx . . $ xercesc_3_2/XSModelGroup#COMPOSITOR_SEQUENCE. &&
2648 poParticles->sizecxx . . $ xercesc_3_2/BaseRefVectorOf#size(fe4d2d262d4164a8).() == 1 &&
2649 poParticles->elementAtcxx . . $ xercesc_3_2/BaseRefVectorOf#elementAt(60a54806b2015313).(0)->getTermTypecxx . . $ xercesc_3_2/XSParticle#getTermType(8b4c3756b6b7510b).() == XSParticlecxx . . $ xercesc_3_2/XSParticle#::TERM_WILDCARDcxx . . $ xercesc_3_2/XSParticle#TERM_WILDCARD.)
2650 {
2651 XSElementDeclarationcxx . . $ xercesc_3_2/XSElementDeclaration# *poGMLMetadata =
2652 GetTopElementDeclarationFromXPathcxx . . $ GMLASSchemaAnalyzer#GetTopElementDeclarationFromXPath(36d74f5cbbead52).("gml:_MetaData", poModel);
2653 if (poGMLMetadata != nullptr)
2654 {
2655 stdcxx . . $ std/::vector<XSElementDeclarationcxx . . $ xercesc_3_2/XSElementDeclaration# *> apoImplEltList;
2656 GetConcreteImplementationTypescxx . . $ GMLASSchemaAnalyzer#GetConcreteImplementationTypes(34e1fcfb46809e09).(poGMLMetadata, apoImplEltList);
2657 CreateNonNestedRelationshipcxx . . $ GMLASSchemaAnalyzer#CreateNonNestedRelationship(d41c4a386c166014).(poGMLMetadata, apoImplEltList, oClass,
2658 1,
2659 false, // doesn't need prefix
2660 true, // force junction table
2661 false // regular case
2662 );
2663
2664 return true;
2665 }
2666 }
2667
2668 const bool bIsChoice =
2669 (poModelGroup->getCompositorcxx . . $ xercesc_3_2/XSModelGroup#getCompositor(cb9708a35e0ab97a).() == XSModelGroupcxx . . $ xercesc_3_2/XSModelGroup#::COMPOSITOR_CHOICEcxx . . $ xercesc_3_2/XSModelGroup#COMPOSITOR_CHOICE.);
2670 int nGroup = 0;
2671
2672 for (size_t i = 0; i < poParticles->sizecxx . . $ xercesc_3_2/BaseRefVectorOf#size(fe4d2d262d4164a8).(); ++i)
2673 {
2674 XSParticlecxx . . $ xercesc_3_2/XSParticle# *poParticle = poParticles->elementAtcxx . . $ xercesc_3_2/BaseRefVectorOf#elementAt(60a54806b2015313).(i);
2675 const bool bRepeatedParticle = poParticle->getMaxOccursUnboundedcxx . . $ xercesc_3_2/XSParticle#getMaxOccursUnbounded(50ce9a9e25b4a850).() ||
2676 poParticle->getMaxOccurscxx . . $ xercesc_3_2/XSParticle#getMaxOccurs(fe4d2d262d4164a8).() > 1;
2677 const int nMinOccurs = static_cast<int>(poParticle->getMinOccurscxx . . $ xercesc_3_2/XSParticle#getMinOccurs(fe4d2d262d4164a8).());
2678 const int nMaxOccurs =
2679 poParticle->getMaxOccursUnboundedcxx . . $ xercesc_3_2/XSParticle#getMaxOccursUnbounded(50ce9a9e25b4a850).()
2680 ? MAXOCCURS_UNLIMITEDcxx . . $ GMLASConstants/MAXOCCURS_UNLIMITED.
2681 : static_cast<int>(poParticle->getMaxOccurscxx . . $ xercesc_3_2/XSParticle#getMaxOccurs(fe4d2d262d4164a8).());
2682
2683 if (poParticle->getTermTypecxx . . $ xercesc_3_2/XSParticle#getTermType(8b4c3756b6b7510b).() == XSParticlecxx . . $ xercesc_3_2/XSParticle#::TERM_ELEMENTcxx . . $ xercesc_3_2/XSParticle#TERM_ELEMENT.)
2684 {
2685 XSElementDeclarationcxx . . $ xercesc_3_2/XSElementDeclaration# *poElt = poParticle->getElementTermcxx . . $ xercesc_3_2/XSParticle#getElementTerm(8efbc3b55c72a604).();
2686 const CPLString osEltName(transcodecxx . . $ transcode(39fd9df5ac67f380).(poElt->getNamecxx . . $ xercesc_3_2/XSElementDeclaration#getName(b92850b821c2ebdb).()));
2687
2688 const auto oIter = oMapCountOccurrencesOfSameName.findcxx . . $ std/map#find(7b3585bb5da8f7d).(osEltName);
2689 const bool bEltNameWillNeedPrefix =
2690 oIter !=cxx . . $ std/`operator!=`(a84eb84a7a5e8237). oMapCountOccurrencesOfSameName.endcxx . . $ std/map#end(b953fec338ad1a3b).() &&
2691 oIter->cxx . . $ std/_Rb_tree_const_iterator#`operator->`(8e614c7de0b1573e).second > 1;
2692 const CPLString osEltNS(transcodecxx . . $ transcode(39fd9df5ac67f380).(poElt->getNamespacecxx . . $ xercesc_3_2/XSElementDeclaration#getNamespace(b92850b821c2ebdb).()));
2693 const CPLString osPrefixedEltName((bEltNameWillNeedPrefix
2694 ? GetPrefixcxx . . $ GMLASSchemaAnalyzer#GetPrefix(385147141d89f498).(osEltNS) + "_"
2695 : CPLString()) +
2696 osEltName);
2697 const CPLString osOnlyElementXPath(MakeXPathcxx . . $ GMLASSchemaAnalyzer#MakeXPath(ba8f7a05030d6bc1).(osEltNS, osEltName));
2698 const CPLString osElementXPath(oClass.GetXPathcxx . . $ GMLASFeatureClass#GetXPath(1b8c726d1b99eee0).() + "/" +
2699 osOnlyElementXPath);
2700 #ifdef DEBUG_VERBOSE
2701 CPLDebug("GMLAS", "Iterating through %s", osElementXPath.c_str());
2702 #endif
2703
2704 if (IsIgnoredXPathcxx . . $ GMLASSchemaAnalyzer#IsIgnoredXPath(86da8d82cde12b2b).(osElementXPath))
2705 {
2706 #ifdef DEBUG_VERBOSE
2707 CPLDebug("GMLAS", "%s is in ignored xpaths",
2708 osElementXPath.c_str());
2709 #endif
2710 continue;
2711 }
2712
2713 CPLString osTargetElement;
2714 if (poElt->getAnnotationcxx . . $ xercesc_3_2/XSElementDeclaration#getAnnotation(44ae4ca8aaeb5ed9).() != nullptr)
2715 {
2716 CPLString osAnnot(
2717 transcodecxx . . $ transcode(39fd9df5ac67f380).(poElt->getAnnotationcxx . . $ xercesc_3_2/XSElementDeclaration#getAnnotation(44ae4ca8aaeb5ed9).()->getAnnotationStringcxx . . $ xercesc_3_2/XSAnnotation#getAnnotationString(9d9c13ec032803fb).()));
2718
2719 #ifdef DEBUG_SUPER_VERBOSE
2720 CPLDebug("GMLAS", "Annot: %s", osAnnot.c_str());
2721 #endif
2722 CPLXMLNodecxx . . $ CPLXMLNode# *psRoot = CPLParseXMLString(osAnnot);
2723 CPLStripXMLNamespace(psRoot, nullptr, TRUEcxx . . $ `port/cpl_port.h:1184:9`!);
2724 osTargetElement = CPLGetXMLValue(
2725 psRoot, "=annotation.appinfo.targetElement", "");
2726 CPLDestroyXMLNode(psRoot);
2727 #ifdef DEBUG_VERBOSE
2728 if (!osTargetElement.empty())
2729 CPLDebug("GMLAS", "targetElement: %s",
2730 osTargetElement.c_str());
2731 #endif
2732 }
2733
2734 XSTypeDefinitioncxx . . $ xercesc_3_2/XSTypeDefinition# *poTypeDef = poElt->getTypeDefinitioncxx . . $ xercesc_3_2/XSElementDeclaration#getTypeDefinition(cdce5b073bfe8145).();
2735
2736 stdcxx . . $ std/::vector<XSElementDeclarationcxx . . $ xercesc_3_2/XSElementDeclaration# *> apoImplEltList;
2737 GetConcreteImplementationTypescxx . . $ GMLASSchemaAnalyzer#GetConcreteImplementationTypes(34e1fcfb46809e09).(poElt, apoImplEltList);
2738
2739 stdcxx . . $ std/::vector<XSElementDeclarationcxx . . $ xercesc_3_2/XSElementDeclaration# *> apoChildrenElements =
2740 GetConstraintChildrenElementscxx . . $ GMLASSchemaAnalyzer#GetConstraintChildrenElements(78fff1f9c0652c8).(osElementXPath);
2741
2742 // Special case for a GML geometry property
2743 OGRwkbGeometryType eGeomType =
2744 wkbNone; // to make Visual Studio happy
2745 CPL_IGNORE_RET_VAL(eGeomType); // to make cppcheck happy
2746
2747 if (!apoChildrenElements.empty())
2748 {
2749 CreateNonNestedRelationshipcxx . . $ GMLASSchemaAnalyzer#CreateNonNestedRelationship(d41c4a386c166014).(
2750 poElt, apoChildrenElements, oClass, nMaxOccurs,
2751 bEltNameWillNeedPrefix,
2752 false, // do not force junction table
2753 true // special case for children elements
2754 );
2755 }
2756
2757 else if (IsGMLNamespacecxx . . $ GMLASSchemaAnalyzer#IsGMLNamespace(86da8d82cde12b2b).(transcodecxx . . $ transcode(39fd9df5ac67f380).(poTypeDef->getNamespacecxx . . $ xercesc_3_2/XSTypeDefinition#getNamespace(b92850b821c2ebdb).())) &&
2758 (eGeomType = GetOGRGeometryTypecxx . . $ GetOGRGeometryType(617150b046df1df4).(poTypeDef)) != wkbNone)
2759 {
2760 GMLASFieldcxx . . $ GMLASField# oFieldcxx . . $ GMLASField#GMLASField(49f6e7a06ebc5aa8).;
2761 oField.SetNamecxx . . $ GMLASField#SetName(42786403379ca8d8).(osPrefixedEltName);
2762 oField.SetMinOccurscxx . . $ GMLASField#SetMinOccurs(d4f767463ce0a6b3).(nMinOccurs);
2763 oField.SetMaxOccurscxx . . $ GMLASField#SetMaxOccurs(d4f767463ce0a6b3).(nMaxOccurs);
2764 oField.SetTypecxx . . $ GMLASField#SetType(1457e335bf1abcdb).(GMLAS_FT_GEOMETRYcxx . . $ GMLAS_FT_GEOMETRY., szFAKEXS_GEOMETRYcxx . . $ GMLASConstants/szFAKEXS_GEOMETRY.);
2765 if (nMaxOccurs > 1 || nMaxOccurs == MAXOCCURS_UNLIMITEDcxx . . $ GMLASConstants/MAXOCCURS_UNLIMITED.)
2766 {
2767 // Repeated geometry property can happen in some schemas
2768 // like
2769 // inspire.ec.europa.eu/schemas/ge_gp/4.0/GeophysicsCore.xsd
2770 // or
2771 // http://ngwd-bdnes.cits.nrcan.gc.ca/service/gwml/schemas/2.1/gwml2-flow.xsd
2772 oField.SetGeomTypecxx . . $ GMLASField#SetGeomType(f47ce3f1fe923726).(wkbUnknown);
2773 oField.SetArraycxx . . $ GMLASField#SetArray(b45ddcbc8423892c).(true);
2774 }
2775 else
2776 oField.SetGeomTypecxx . . $ GMLASField#SetGeomType(f47ce3f1fe923726).(eGeomType);
2777 oField.SetXPathcxx . . $ GMLASField#SetXPath(42786403379ca8d8).(osElementXPath);
2778 oField.SetDocumentationcxx . . $ GMLASField#SetDocumentation(42786403379ca8d8).(GetAnnotationDoccxx . . $ GetAnnotationDoc(c42646b806debdc2).(poElt));
2779
2780 oClass.AddFieldcxx . . $ GMLASFeatureClass#AddField(18625785520e30ac).(oField);
2781 }
2782
2783 else if (IsGMLNamespacecxx . . $ GMLASSchemaAnalyzer#IsGMLNamespace(86da8d82cde12b2b).(osEltNS) &&
2784 (eGeomType = GetOGRGeometryTypeFromGMLEltNamecxx . . $ GetOGRGeometryTypeFromGMLEltName(f08e7c67973937ab).(
2785 osEltName)) != wkbNone)
2786 {
2787 GMLASFieldcxx . . $ GMLASField# oFieldcxx . . $ GMLASField#GMLASField(49f6e7a06ebc5aa8).;
2788 oField.SetNamecxx . . $ GMLASField#SetName(42786403379ca8d8).(osPrefixedEltName);
2789 oField.SetMinOccurscxx . . $ GMLASField#SetMinOccurs(d4f767463ce0a6b3).(nMinOccurs);
2790 oField.SetMaxOccurscxx . . $ GMLASField#SetMaxOccurs(d4f767463ce0a6b3).(nMaxOccurs);
2791
2792 oField.SetTypecxx . . $ GMLASField#SetType(1457e335bf1abcdb).(GMLAS_FT_GEOMETRYcxx . . $ GMLAS_FT_GEOMETRY., szFAKEXS_GEOMETRYcxx . . $ GMLASConstants/szFAKEXS_GEOMETRY.);
2793 oField.SetGeomTypecxx . . $ GMLASField#SetGeomType(f47ce3f1fe923726).(eGeomType);
2794 oField.SetArraycxx . . $ GMLASField#SetArray(b45ddcbc8423892c).(nMaxOccurs > 1 ||
2795 nMaxOccurs == MAXOCCURS_UNLIMITEDcxx . . $ GMLASConstants/MAXOCCURS_UNLIMITED.);
2796
2797 oField.SetXPathcxx . . $ GMLASField#SetXPath(42786403379ca8d8).(osElementXPath);
2798 oField.SetIncludeThisEltInBlobcxx . . $ GMLASField#SetIncludeThisEltInBlob(b45ddcbc8423892c).(true);
2799 oField.SetDocumentationcxx . . $ GMLASField#SetDocumentation(42786403379ca8d8).(GetAnnotationDoccxx . . $ GetAnnotationDoc(c42646b806debdc2).(poElt));
2800
2801 oClass.AddFieldcxx . . $ GMLASFeatureClass#AddField(18625785520e30ac).(oField);
2802 }
2803
2804 // Any GML abstract type
2805 else if (poElt->getAbstractcxx . . $ xercesc_3_2/XSElementDeclaration#getAbstract(50ce9a9e25b4a850).() && IsGMLNamespacecxx . . $ GMLASSchemaAnalyzer#IsGMLNamespace(86da8d82cde12b2b).(osEltNS) &&
2806 osEltName != "_Feature" &&
2807 osEltName != "AbstractFeature" &&
2808 osEltName != "AbstractTimeObject")
2809 {
2810 GMLASFieldcxx . . $ GMLASField# oFieldcxx . . $ GMLASField#GMLASField(49f6e7a06ebc5aa8).;
2811 oField.SetNamecxx . . $ GMLASField#SetName(42786403379ca8d8).(osPrefixedEltName);
2812 oField.SetMinOccurscxx . . $ GMLASField#SetMinOccurs(d4f767463ce0a6b3).(nMinOccurs);
2813 oField.SetMaxOccurscxx . . $ GMLASField#SetMaxOccurs(d4f767463ce0a6b3).(nMaxOccurs);
2814 if (osEltName == "AbstractGeometry")
2815 {
2816 oField.SetTypecxx . . $ GMLASField#SetType(1457e335bf1abcdb).(GMLAS_FT_GEOMETRYcxx . . $ GMLAS_FT_GEOMETRY., szFAKEXS_GEOMETRYcxx . . $ GMLASConstants/szFAKEXS_GEOMETRY.);
2817 oField.SetGeomTypecxx . . $ GMLASField#SetGeomType(f47ce3f1fe923726).(wkbUnknown);
2818 oField.SetArraycxx . . $ GMLASField#SetArray(b45ddcbc8423892c).(nMaxOccurs > 1 ||
2819 nMaxOccurs == MAXOCCURS_UNLIMITEDcxx . . $ GMLASConstants/MAXOCCURS_UNLIMITED.);
2820 }
2821 else
2822 {
2823 oField.SetTypecxx . . $ GMLASField#SetType(1457e335bf1abcdb).(GMLAS_FT_ANYTYPEcxx . . $ GMLAS_FT_ANYTYPE., szXS_ANY_TYPEcxx . . $ GMLASConstants/szXS_ANY_TYPE.);
2824 }
2825 oField.SetIncludeThisEltInBlobcxx . . $ GMLASField#SetIncludeThisEltInBlob(b45ddcbc8423892c).(true);
2826 oField.SetDocumentationcxx . . $ GMLASField#SetDocumentation(42786403379ca8d8).(GetAnnotationDoccxx . . $ GetAnnotationDoc(c42646b806debdc2).(poElt));
2827
2828 for (size_t j = 0; j < apoImplEltList.size(); j++)
2829 {
2830 XSElementDeclarationcxx . . $ xercesc_3_2/XSElementDeclaration# *poSubElt = apoImplEltList[j];
2831 oField.AddAlternateXPathcxx . . $ GMLASField#AddAlternateXPath(42786403379ca8d8).(
2832 oClass.GetXPathcxx . . $ GMLASFeatureClass#GetXPath(1b8c726d1b99eee0).() + "/" +
2833 MakeXPathcxx . . $ GMLASSchemaAnalyzer#MakeXPath(ba8f7a05030d6bc1).(transcodecxx . . $ transcode(39fd9df5ac67f380).(poSubElt->getNamespacecxx . . $ xercesc_3_2/XSElementDeclaration#getNamespace(b92850b821c2ebdb).()),
2834 transcodecxx . . $ transcode(39fd9df5ac67f380).(poSubElt->getNamecxx . . $ xercesc_3_2/XSElementDeclaration#getName(b92850b821c2ebdb).())));
2835 }
2836
2837 oClass.AddFieldcxx . . $ GMLASFeatureClass#AddField(18625785520e30ac).(oField);
2838 }
2839
2840 // Are there substitution groups for this element ?
2841 // or is this element already identified as being a top-level one ?
2842 else if (!apoImplEltList.empty() ||
2843 (m_oSetEltsForTopClasscxx . . $ GMLASSchemaAnalyzer#m_oSetEltsForTopClass..findcxx . . $ std/set#find(f8922f46a681e6cc).(poElt) !=cxx . . $ std/`operator!=`(a84eb84a7a5e8237).
2844 m_oSetEltsForTopClasscxx . . $ GMLASSchemaAnalyzer#m_oSetEltsForTopClass..endcxx . . $ std/set#end(3220b82c0db6d2a1).() &&
2845 m_oSetSimpleEnoughEltscxx . . $ GMLASSchemaAnalyzer#m_oSetSimpleEnoughElts..findcxx . . $ std/set#find(f8922f46a681e6cc).(poElt) ==cxx . . $ std/`operator==`(a84eb84a7a5e8237).
2846 m_oSetSimpleEnoughEltscxx . . $ GMLASSchemaAnalyzer#m_oSetSimpleEnoughElts..endcxx . . $ std/set#end(3220b82c0db6d2a1).()))
2847 {
2848 CreateNonNestedRelationshipcxx . . $ GMLASSchemaAnalyzer#CreateNonNestedRelationship(d41c4a386c166014).(
2849 poElt, apoImplEltList, oClass, nMaxOccurs,
2850 bEltNameWillNeedPrefix,
2851 false, // do not force junction table
2852 false // regular case
2853 );
2854 }
2855
2856 // Abstract element without realizations !
2857 else if (poElt->getAbstractcxx . . $ xercesc_3_2/XSElementDeclaration#getAbstract(50ce9a9e25b4a850).())
2858 {
2859 // Do nothing with it since it cannot be instantiated
2860 // in a valid way.
2861 CPLDebug("GMLAS",
2862 "Ignoring %s that is abstract without realizations",
2863 osElementXPath.c_str());
2864 }
2865
2866 // Simple type like string, int, etc...
2867 else if (poTypeDef->getTypeCategorycxx . . $ xercesc_3_2/XSTypeDefinition#getTypeCategory(648f99a6da51541c).() ==
2868 XSTypeDefinitioncxx . . $ xercesc_3_2/XSTypeDefinition#::SIMPLE_TYPEcxx . . $ xercesc_3_2/XSTypeDefinition#SIMPLE_TYPE.)
2869 {
2870 XSSimpleTypeDefinitioncxx . . $ xercesc_3_2/XSSimpleTypeDefinition# *poST =
2871 reinterpret_cast<XSSimpleTypeDefinitioncxx . . $ xercesc_3_2/XSSimpleTypeDefinition# *>(poTypeDef);
2872 GMLASFieldcxx . . $ GMLASField# oFieldcxx . . $ GMLASField#GMLASField(49f6e7a06ebc5aa8).;
2873 SetFieldTypeAndWidthFromDefinitioncxx . . $ GMLASSchemaAnalyzer#SetFieldTypeAndWidthFromDefinition(4c00e08a965847d4).(poST, oField);
2874 oField.SetMinOccurscxx . . $ GMLASField#SetMinOccurs(d4f767463ce0a6b3).((bIsChoice) ? 0 : nMinOccurs);
2875 oField.SetMaxOccurscxx . . $ GMLASField#SetMaxOccurs(d4f767463ce0a6b3).(nMaxOccurs);
2876 oField.SetDocumentationcxx . . $ GMLASField#SetDocumentation(42786403379ca8d8).(GetAnnotationDoccxx . . $ GetAnnotationDoc(c42646b806debdc2).(poElt));
2877
2878 bool bNeedAuxTable = false;
2879 const bool bIsList = (poST->getVarietycxx . . $ xercesc_3_2/XSSimpleTypeDefinition#getVariety(12f631c2d3f46b57).() ==
2880 XSSimpleTypeDefinitioncxx . . $ xercesc_3_2/XSSimpleTypeDefinition#::VARIETY_LISTcxx . . $ xercesc_3_2/XSSimpleTypeDefinition#VARIETY_LIST.);
2881 if (bIsList)
2882 {
2883 SetFieldTypeAndWidthFromDefinitioncxx . . $ GMLASSchemaAnalyzer#SetFieldTypeAndWidthFromDefinition(4c00e08a965847d4).(poST->getItemTypecxx . . $ xercesc_3_2/XSSimpleTypeDefinition#getItemType(7b2d8333f4b51448).(),
2884 oField);
2885 if (bRepeatedParticle || !m_bUseArrayscxx . . $ GMLASSchemaAnalyzer#m_bUseArrays. ||
2886 !IsCompatibleOfArraycxx . . $ IsCompatibleOfArray(58f33dce0e756b8f).(oField.GetTypecxx . . $ GMLASField#GetType(91ae572febc0467e).()))
2887 {
2888 // Really particular case. This is a workaround
2889 oField.SetTypecxx . . $ GMLASField#SetType(1457e335bf1abcdb).(GMLAS_FT_STRINGcxx . . $ GMLAS_FT_STRING., szXS_STRINGcxx . . $ GMLASConstants/szXS_STRING.);
2890 }
2891 else
2892 {
2893 oField.SetListcxx . . $ GMLASField#SetList(b45ddcbc8423892c).(true);
2894 oField.SetArraycxx . . $ GMLASField#SetArray(b45ddcbc8423892c).(true);
2895 }
2896 }
2897
2898 if (m_bUseArrayscxx . . $ GMLASSchemaAnalyzer#m_bUseArrays. && bRepeatedParticle &&
2899 IsCompatibleOfArraycxx . . $ IsCompatibleOfArray(58f33dce0e756b8f).(oField.GetTypecxx . . $ GMLASField#GetType(91ae572febc0467e).()))
2900 {
2901 oField.SetArraycxx . . $ GMLASField#SetArray(b45ddcbc8423892c).(true);
2902 }
2903 else if (bRepeatedParticle)
2904 {
2905 bNeedAuxTable = true;
2906 }
2907 if (bNeedAuxTable)
2908 {
2909 GMLASFeatureClasscxx . . $ GMLASFeatureClass# oNestedClasscxx . . $ GMLASFeatureClass#GMLASFeatureClass(49f6e7a06ebc5aa8).;
2910 oNestedClass.SetNamecxx . . $ GMLASFeatureClass#SetName(42786403379ca8d8).(oClass.GetNamecxx . . $ GMLASFeatureClass#GetName(1b8c726d1b99eee0).() + "_" +
2911 osPrefixedEltName);
2912 oNestedClass.SetXPathcxx . . $ GMLASFeatureClass#SetXPath(42786403379ca8d8).(osElementXPath);
2913 GMLASFieldcxx . . $ GMLASField# oUniqueFieldcxx . . $ GMLASField#GMLASField(49f6e7a06ebc5aa8).;
2914 oUniqueField.SetNamecxx . . $ GMLASField#SetName(42786403379ca8d8).("value");
2915 oUniqueField.SetMinOccurscxx . . $ GMLASField#SetMinOccurs(d4f767463ce0a6b3).(1);
2916 oUniqueField.SetMaxOccurscxx . . $ GMLASField#SetMaxOccurs(d4f767463ce0a6b3).(1);
2917 oUniqueField.SetXPathcxx . . $ GMLASField#SetXPath(42786403379ca8d8).(osElementXPath);
2918 oUniqueField.SetTypecxx . . $ GMLASField#SetType(1457e335bf1abcdb).(oField.GetTypecxx . . $ GMLASField#GetType(91ae572febc0467e).(),
2919 oField.GetTypeNamecxx . . $ GMLASField#GetTypeName(1b8c726d1b99eee0).());
2920 oNestedClass.AddFieldcxx . . $ GMLASFeatureClass#AddField(18625785520e30ac).(oUniqueField);
2921 oNestedClass.SetDocumentationcxx . . $ GMLASFeatureClass#SetDocumentation(42786403379ca8d8).(GetAnnotationDoccxx . . $ GetAnnotationDoc(c42646b806debdc2).(poElt));
2922
2923 oClass.AddNestedClasscxx . . $ GMLASFeatureClass#AddNestedClass(d64d5814e030c1b7).(oNestedClass);
2924
2925 oField.SetTypecxx . . $ GMLASField#SetType(1457e335bf1abcdb).(GMLAS_FT_STRINGcxx . . $ GMLAS_FT_STRING., "");
2926 oField.SetNamecxx . . $ GMLASField#SetName(42786403379ca8d8).(osPrefixedEltName);
2927 oField.SetXPathcxx . . $ GMLASField#SetXPath(42786403379ca8d8).(osElementXPath);
2928 oField.SetCategorycxx . . $ GMLASField#SetCategory(7d753e80d748751c).(
2929 GMLASFieldcxx . . $ GMLASField#::PATH_TO_CHILD_ELEMENT_NO_LINKcxx . . $ GMLASField#PATH_TO_CHILD_ELEMENT_NO_LINK.);
2930 oField.SetRelatedClassXPathcxx . . $ GMLASField#SetRelatedClassXPath(42786403379ca8d8).(oField.GetXPathcxx . . $ GMLASField#GetXPath(1b8c726d1b99eee0).());
2931 oClass.AddFieldcxx . . $ GMLASFeatureClass#AddField(18625785520e30ac).(oField);
2932 }
2933 else
2934 {
2935 oField.SetNamecxx . . $ GMLASField#SetName(42786403379ca8d8).(osPrefixedEltName);
2936 oField.SetXPathcxx . . $ GMLASField#SetXPath(42786403379ca8d8).(osElementXPath);
2937 if (!bIsChoice && nMinOccurs > 0 && !poElt->getNillablecxx . . $ xercesc_3_2/XSElementDeclaration#getNillable(50ce9a9e25b4a850).())
2938 {
2939 oField.SetNotNullablecxx . . $ GMLASField#SetNotNullable(b45ddcbc8423892c).(true);
2940 }
2941 oClass.AddFieldcxx . . $ GMLASFeatureClass#AddField(18625785520e30ac).(oField);
2942
2943 // If the element has minOccurs=0 and is nillable, then we
2944 // need an extra field to be able to distinguish between the
2945 // case of the missing element or the element with
2946 // xsi:nil="true"
2947 if (nMinOccurs == 0 && poElt->getNillablecxx . . $ xercesc_3_2/XSElementDeclaration#getNillable(50ce9a9e25b4a850).() &&
2948 !m_bUseNullStatecxx . . $ GMLASSchemaAnalyzer#m_bUseNullState.)
2949 {
2950 GMLASFieldcxx . . $ GMLASField# oFieldNilcxx . . $ GMLASField#GMLASField(49f6e7a06ebc5aa8).;
2951 oFieldNil.SetNamecxx . . $ GMLASField#SetName(42786403379ca8d8).(osPrefixedEltName + "_" + szNILcxx . . $ GMLASConstants/szNIL.);
2952 oFieldNil.SetXPathcxx . . $ GMLASField#SetXPath(42786403379ca8d8).(osElementXPath + "/" + szAT_XSI_NILcxx . . $ GMLASConstants/szAT_XSI_NIL.);
2953 oFieldNil.SetTypecxx . . $ GMLASField#SetType(1457e335bf1abcdb).(GMLAS_FT_BOOLEANcxx . . $ GMLAS_FT_BOOLEAN., "boolean");
2954 oFieldNil.SetMinOccurscxx . . $ GMLASField#SetMinOccurs(d4f767463ce0a6b3).(0);
2955 oFieldNil.SetMaxOccurscxx . . $ GMLASField#SetMaxOccurs(d4f767463ce0a6b3).(1);
2956 oClass.AddFieldcxx . . $ GMLASFeatureClass#AddField(18625785520e30ac).(oFieldNil);
2957 }
2958 }
2959 }
2960
2961 // Complex type (element with attributes, composed element, etc...)
2962 else if (poTypeDef->getTypeCategorycxx . . $ xercesc_3_2/XSTypeDefinition#getTypeCategory(648f99a6da51541c).() ==
2963 XSTypeDefinitioncxx . . $ xercesc_3_2/XSTypeDefinition#::COMPLEX_TYPEcxx . . $ xercesc_3_2/XSTypeDefinition#COMPLEX_TYPE.)
2964 {
2965 XSComplexTypeDefinitioncxx . . $ xercesc_3_2/XSComplexTypeDefinition# *poEltCT =
2966 reinterpret_cast<XSComplexTypeDefinitioncxx . . $ xercesc_3_2/XSComplexTypeDefinition# *>(poTypeDef);
2967 stdcxx . . $ std/::vector<GMLASFieldcxx . . $ GMLASField#> aoFields;
2968 bool bNothingMoreToDo = false;
2969 stdcxx . . $ std/::vector<GMLASFeatureClasscxx . . $ GMLASFeatureClass#> aoNestedClasses;
2970
2971 const int nMinOccursEltParticle =
2972 poEltCT->getParticlecxx . . $ xercesc_3_2/XSComplexTypeDefinition#getParticle(d23a6dcd2ef450a4).()
2973 ? static_cast<int>(
2974 poEltCT->getParticlecxx . . $ xercesc_3_2/XSComplexTypeDefinition#getParticle(d23a6dcd2ef450a4).()->getMinOccurscxx . . $ xercesc_3_2/XSParticle#getMinOccurs(fe4d2d262d4164a8).())
2975 : -1;
2976 const int nMaxOccursEltParticle =
2977 poEltCT->getParticlecxx . . $ xercesc_3_2/XSComplexTypeDefinition#getParticle(d23a6dcd2ef450a4).()
2978 ? (poEltCT->getParticlecxx . . $ xercesc_3_2/XSComplexTypeDefinition#getParticle(d23a6dcd2ef450a4).()->getMaxOccursUnboundedcxx . . $ xercesc_3_2/XSParticle#getMaxOccursUnbounded(50ce9a9e25b4a850).()
2979 ? MAXOCCURS_UNLIMITEDcxx . . $ GMLASConstants/MAXOCCURS_UNLIMITED.
2980 : static_cast<int>(
2981 poEltCT->getParticlecxx . . $ xercesc_3_2/XSComplexTypeDefinition#getParticle(d23a6dcd2ef450a4).()->getMaxOccurscxx . . $ xercesc_3_2/XSParticle#getMaxOccurs(fe4d2d262d4164a8).()))
2982 : -1;
2983
2984 const bool bEltRepeatedParticle =
2985 nMaxOccursEltParticle > 1 ||
2986 nMaxOccursEltParticle == MAXOCCURS_UNLIMITEDcxx . . $ GMLASConstants/MAXOCCURS_UNLIMITED.;
2987 const bool bMoveNestedClassToTop =
2988 !bRepeatedParticle && !bEltRepeatedParticle;
2989
2990 // Process attributes
2991 XSAttributeUseListcxx . . $ xercesc_3_2/XSAttributeUseList# *poAttrList = poEltCT->getAttributeUsescxx . . $ xercesc_3_2/XSComplexTypeDefinition#getAttributeUses(485d41f626ab6abb).();
2992 const size_t nAttrListSize =
2993 (poAttrList != nullptr) ? poAttrList->sizecxx . . $ xercesc_3_2/BaseRefVectorOf#size(fe4d2d262d4164a8).() : 0;
2994 for (size_t j = 0; j < nAttrListSize; ++j)
2995 {
2996 XSAttributeUsecxx . . $ xercesc_3_2/XSAttributeUse# *poAttr = poAttrList->elementAtcxx . . $ xercesc_3_2/BaseRefVectorOf#elementAt(60a54806b2015313).(j);
2997 GMLASFieldcxx . . $ GMLASField# oFieldcxx . . $ GMLASField#GMLASField(49f6e7a06ebc5aa8).;
2998 CPLString osNamePrefix(bMoveNestedClassToTop
2999 ? osPrefixedEltName
3000 : CPLString());
3001 if (!SetFieldFromAttributecxx . . $ GMLASSchemaAnalyzer#SetFieldFromAttribute(492ff3cb2cbdd4b0).(oField, poAttr, osElementXPath,
3002 osNamePrefix))
3003 {
3004 return false;
3005 }
3006 if (nMinOccurs == 0 || bIsChoice)
3007 {
3008 oField.SetMinOccurscxx . . $ GMLASField#SetMinOccurs(d4f767463ce0a6b3).(0);
3009 oField.SetNotNullablecxx . . $ GMLASField#SetNotNullable(b45ddcbc8423892c).(false);
3010 }
3011
3012 if (IsIgnoredXPathcxx . . $ GMLASSchemaAnalyzer#IsIgnoredXPath(86da8d82cde12b2b).(oField.GetXPathcxx . . $ GMLASField#GetXPath(1b8c726d1b99eee0).()))
3013 {
3014 #ifdef DEBUG_VERBOSE
3015 CPLDebug("GMLAS", "%s is in ignored xpaths",
3016 oField.GetXPath().c_str());
3017 #endif
3018 if (!oField.GetFixedValuecxx . . $ GMLASField#GetFixedValue(1b8c726d1b99eee0).().empty() ||
3019 !oField.GetDefaultValuecxx . . $ GMLASField#GetDefaultValue(1b8c726d1b99eee0).().empty())
3020 {
3021 oField.SetIgnoredcxx . . $ GMLASField#SetIgnored(49f6e7a06ebc5aa8).();
3022 }
3023 else
3024 {
3025 continue;
3026 }
3027 }
3028
3029 aoFields.push_back(stdcxx . . $ std/::move(oField));
3030 }
3031
3032 // Deal with anyAttributes (or any element that also imply it)
3033 XSWildcardcxx . . $ xercesc_3_2/XSWildcard# *poAttrWildcard = poEltCT->getAttributeWildcardcxx . . $ xercesc_3_2/XSComplexTypeDefinition#getAttributeWildcard(c18fcd03c00320de).();
3034 if (poAttrWildcard != nullptr)
3035 {
3036 GMLASFieldcxx . . $ GMLASField# oFieldcxx . . $ GMLASField#GMLASField(49f6e7a06ebc5aa8).;
3037 oField.SetTypecxx . . $ GMLASField#SetType(1457e335bf1abcdb).(GMLASFieldcxx . . $ GMLASField#::GetTypeFromStringcxx . . $ GMLASField#GetTypeFromString(1f84dad9d29c9701).(szXS_STRINGcxx . . $ GMLASConstants/szXS_STRING.),
3038 szFAKEXS_JSON_DICTcxx . . $ GMLASConstants/szFAKEXS_JSON_DICT.);
3039 if (!bMoveNestedClassToTop)
3040 {
3041 oField.SetNamecxx . . $ GMLASField#SetName(42786403379ca8d8).("anyAttributes");
3042 }
3043 else
3044 {
3045 oField.SetNamecxx . . $ GMLASField#SetName(42786403379ca8d8).(osPrefixedEltName + "_anyAttributes");
3046 }
3047 oField.SetXPathcxx . . $ GMLASField#SetXPath(42786403379ca8d8).(osElementXPath + "/" + szAT_ANY_ATTRcxx . . $ GMLASConstants/szAT_ANY_ATTR.);
3048 oField.SetDocumentationcxx . . $ GMLASField#SetDocumentation(42786403379ca8d8).(
3049 GetAnnotationDoccxx . . $ GetAnnotationDoc(29613dfbf7736e29).(poAttrWildcard->getAnnotationcxx . . $ xercesc_3_2/XSWildcard#getAnnotation(44ae4ca8aaeb5ed9).()));
3050
3051 aoFields.push_back(stdcxx . . $ std/::move(oField));
3052 }
3053
3054 XSSimpleTypeDefinitioncxx . . $ xercesc_3_2/XSSimpleTypeDefinition# *poST = poEltCT->getSimpleTypecxx . . $ xercesc_3_2/XSComplexTypeDefinition#getSimpleType(7b99620ce20aaec3).();
3055 if (poST != nullptr)
3056 {
3057 /* Case of an element, generally with attributes */
3058
3059 GMLASFieldcxx . . $ GMLASField# oFieldcxx . . $ GMLASField#GMLASField(49f6e7a06ebc5aa8).;
3060 SetFieldTypeAndWidthFromDefinitioncxx . . $ GMLASSchemaAnalyzer#SetFieldTypeAndWidthFromDefinition(4c00e08a965847d4).(poST, oField);
3061 if (bRepeatedParticle && nAttrListSize == 0 &&
3062 m_bUseArrayscxx . . $ GMLASSchemaAnalyzer#m_bUseArrays. && IsCompatibleOfArraycxx . . $ IsCompatibleOfArray(58f33dce0e756b8f).(oField.GetTypecxx . . $ GMLASField#GetType(91ae572febc0467e).()) &&
3063 oField.GetCategorycxx . . $ GMLASField#GetCategory(c4a5dfd59ad3a301).() !=
3064 GMLASFieldcxx . . $ GMLASField#::PATH_TO_CHILD_ELEMENT_WITH_LINKcxx . . $ GMLASField#PATH_TO_CHILD_ELEMENT_WITH_LINK.)
3065 {
3066 /* We have a complex type, but no attributes, and */
3067 /* compatible of arrays, so move it to top level! */
3068 oField.SetNamecxx . . $ GMLASField#SetName(42786403379ca8d8).(osPrefixedEltName);
3069 oField.SetArraycxx . . $ GMLASField#SetArray(b45ddcbc8423892c).(true);
3070 oField.SetMinOccurscxx . . $ GMLASField#SetMinOccurs(d4f767463ce0a6b3).(nMinOccurs);
3071 oField.SetMaxOccurscxx . . $ GMLASField#SetMaxOccurs(d4f767463ce0a6b3).(nMaxOccurs);
3072 }
3073 else if (bRepeatedParticle)
3074 {
3075 oField.SetNamecxx . . $ GMLASField#SetName(42786403379ca8d8).("value");
3076 oField.SetMinOccurscxx . . $ GMLASField#SetMinOccurs(d4f767463ce0a6b3).(1);
3077 oField.SetMaxOccurscxx . . $ GMLASField#SetMaxOccurs(d4f767463ce0a6b3).(1);
3078 oField.SetNotNullablecxx . . $ GMLASField#SetNotNullable(b45ddcbc8423892c).(true);
3079 }
3080 else
3081 {
3082 if (nMinOccurs == 0)
3083 {
3084 for (size_t j = 0; j < aoFields.size(); j++)
3085 {
3086 aoFields[j].SetMinOccurscxx . . $ GMLASField#SetMinOccurs(d4f767463ce0a6b3).(0);
3087 aoFields[j].SetNotNullablecxx . . $ GMLASField#SetNotNullable(b45ddcbc8423892c).(false);
3088 }
3089 }
3090
3091 oField.SetNamecxx . . $ GMLASField#SetName(42786403379ca8d8).(osPrefixedEltName);
3092 oField.SetMinOccurscxx . . $ GMLASField#SetMinOccurs(d4f767463ce0a6b3).((bIsChoice) ? 0 : nMinOccurs);
3093 oField.SetMaxOccurscxx . . $ GMLASField#SetMaxOccurs(d4f767463ce0a6b3).(nMaxOccurs);
3094
3095 // If the element has minOccurs=0 and is nillable, then
3096 // we need an extra field to be able to distinguish
3097 // between the case of the missing element or the
3098 // element with xsi:nil="true"
3099 if (nMinOccurs == 0 && poElt->getNillablecxx . . $ xercesc_3_2/XSElementDeclaration#getNillable(50ce9a9e25b4a850).() &&
3100 !m_bUseNullStatecxx . . $ GMLASSchemaAnalyzer#m_bUseNullState.)
3101 {
3102 GMLASFieldcxx . . $ GMLASField# oFieldNilcxx . . $ GMLASField#GMLASField(49f6e7a06ebc5aa8).;
3103 oFieldNil.SetNamecxx . . $ GMLASField#SetName(42786403379ca8d8).(osPrefixedEltName + "_" + szNILcxx . . $ GMLASConstants/szNIL.);
3104 oFieldNil.SetXPathcxx . . $ GMLASField#SetXPath(42786403379ca8d8).(osElementXPath + "/" +
3105 szAT_XSI_NILcxx . . $ GMLASConstants/szAT_XSI_NIL.);
3106 oFieldNil.SetTypecxx . . $ GMLASField#SetType(1457e335bf1abcdb).(GMLAS_FT_BOOLEANcxx . . $ GMLAS_FT_BOOLEAN., "boolean");
3107 oFieldNil.SetMinOccurscxx . . $ GMLASField#SetMinOccurs(d4f767463ce0a6b3).(0);
3108 oFieldNil.SetMaxOccurscxx . . $ GMLASField#SetMaxOccurs(d4f767463ce0a6b3).(1);
3109 aoFields.push_back(stdcxx . . $ std/::move(oFieldNil));
3110 }
3111 }
3112 oField.SetXPathcxx . . $ GMLASField#SetXPath(42786403379ca8d8).(osElementXPath);
3113 oField.SetDocumentationcxx . . $ GMLASField#SetDocumentation(42786403379ca8d8).(GetAnnotationDoccxx . . $ GetAnnotationDoc(c42646b806debdc2).(poElt));
3114
3115 aoFields.push_back(oField);
3116 if (oField.IsArraycxx . . $ GMLASField#IsArray(50ce9a9e25b4a850).())
3117 {
3118 oClass.AddFieldcxx . . $ GMLASFeatureClass#AddField(18625785520e30ac).(oField);
3119 bNothingMoreToDo = true;
3120 }
3121 }
3122 else if (IsAnyTypecxx . . $ IsAnyType(b5821bb269915aa7).(poEltCT))
3123 {
3124 GMLASFieldcxx . . $ GMLASField# oFieldcxx . . $ GMLASField#GMLASField(49f6e7a06ebc5aa8).;
3125 oField.SetTypecxx . . $ GMLASField#SetType(1457e335bf1abcdb).(GMLAS_FT_ANYTYPEcxx . . $ GMLAS_FT_ANYTYPE., szXS_ANY_TYPEcxx . . $ GMLASConstants/szXS_ANY_TYPE.);
3126 if (bRepeatedParticle)
3127 {
3128 oField.SetNamecxx . . $ GMLASField#SetName(42786403379ca8d8).("value");
3129 oField.SetMinOccurscxx . . $ GMLASField#SetMinOccurs(d4f767463ce0a6b3).(1);
3130 oField.SetMaxOccurscxx . . $ GMLASField#SetMaxOccurs(d4f767463ce0a6b3).(1);
3131 oField.SetNotNullablecxx . . $ GMLASField#SetNotNullable(b45ddcbc8423892c).(true);
3132 }
3133 else
3134 {
3135 if (nMinOccurs == 0)
3136 {
3137 for (size_t j = 0; j < aoFields.size(); j++)
3138 {
3139 aoFields[j].SetMinOccurscxx . . $ GMLASField#SetMinOccurs(d4f767463ce0a6b3).(0);
3140 aoFields[j].SetNotNullablecxx . . $ GMLASField#SetNotNullable(b45ddcbc8423892c).(false);
3141 }
3142 }
3143
3144 oField.SetNamecxx . . $ GMLASField#SetName(42786403379ca8d8).(osPrefixedEltName);
3145 oField.SetMinOccurscxx . . $ GMLASField#SetMinOccurs(d4f767463ce0a6b3).(nMinOccurs);
3146 oField.SetMaxOccurscxx . . $ GMLASField#SetMaxOccurs(d4f767463ce0a6b3).(nMaxOccurs);
3147 }
3148 oField.SetXPathcxx . . $ GMLASField#SetXPath(42786403379ca8d8).(osElementXPath);
3149 oField.SetDocumentationcxx . . $ GMLASField#SetDocumentation(42786403379ca8d8).(GetAnnotationDoccxx . . $ GetAnnotationDoc(c42646b806debdc2).(poElt));
3150
3151 aoFields.push_back(stdcxx . . $ std/::move(oField));
3152 }
3153
3154 // Is it an element that we already visited ? (cycle)
3155 else if (poEltCT->getParticlecxx . . $ xercesc_3_2/XSComplexTypeDefinition#getParticle(d23a6dcd2ef450a4).() != nullptr &&
3156 oSetVisitedModelGroups.findcxx . . $ std/set#find(f8922f46a681e6cc).(
3157 poEltCT->getParticlecxx . . $ xercesc_3_2/XSComplexTypeDefinition#getParticle(d23a6dcd2ef450a4).()->getModelGroupTermcxx . . $ xercesc_3_2/XSParticle#getModelGroupTerm(4782e22670138a8b).()) !=cxx . . $ std/`operator!=`(a84eb84a7a5e8237).
3158 oSetVisitedModelGroups.endcxx . . $ std/set#end(3220b82c0db6d2a1).())
3159 {
3160 CreateNonNestedRelationshipcxx . . $ GMLASSchemaAnalyzer#CreateNonNestedRelationship(d41c4a386c166014).(
3161 poElt, apoImplEltList, oClass,
3162 bMoveNestedClassToTop ? 1 : MAXOCCURS_UNLIMITEDcxx . . $ GMLASConstants/MAXOCCURS_UNLIMITED.,
3163 bEltNameWillNeedPrefix,
3164 true, // force junction table
3165 false // regular case
3166 );
3167
3168 bNothingMoreToDo = true;
3169 }
3170
3171 else
3172 {
3173 GMLASFeatureClasscxx . . $ GMLASFeatureClass# oNestedClasscxx . . $ GMLASFeatureClass#GMLASFeatureClass(49f6e7a06ebc5aa8).;
3174 oNestedClass.SetNamecxx . . $ GMLASFeatureClass#SetName(42786403379ca8d8).(oClass.GetNamecxx . . $ GMLASFeatureClass#GetName(1b8c726d1b99eee0).() + "_" +
3175 osPrefixedEltName);
3176 oNestedClass.SetXPathcxx . . $ GMLASFeatureClass#SetXPath(42786403379ca8d8).(osElementXPath);
3177 oNestedClass.SetDocumentationcxx . . $ GMLASFeatureClass#SetDocumentation(42786403379ca8d8).(GetAnnotationDoccxx . . $ GetAnnotationDoc(c42646b806debdc2).(poElt));
3178
3179 // NULL can happen, for example for gml:ReferenceType
3180 // that is an empty sequence with just attributes
3181 if (poEltCT->getParticlecxx . . $ xercesc_3_2/XSComplexTypeDefinition#getParticle(d23a6dcd2ef450a4).() != nullptr)
3182 {
3183 #ifdef DEBUG_VERBOSE
3184 CPLDebug("GMLAS", "Exploring %s",
3185 osElementXPath.c_str());
3186 #endif
3187 stdcxx . . $ std/::setcxx . . $ std/set#<XSModelGroupcxx . . $ xercesc_3_2/XSModelGroup# *> oSetNewVisitedModelGroupscxx . . $ std/set#set(a5cb4082b223c231).(
3188 oSetVisitedModelGroups);
3189
3190 stdcxx . . $ std/::mapcxx . . $ std/map#<CPLString, int>
3191 oMapCountOccurrencesOfSameNameSubcxx . . $ std/map#map(49f6e7a06ebc5aa8).;
3192 BuildMapCountOccurrencesOfSameNamecxx . . $ GMLASSchemaAnalyzer#BuildMapCountOccurrencesOfSameName(641bd252dfbd3c56).(
3193 poEltCT->getParticlecxx . . $ xercesc_3_2/XSComplexTypeDefinition#getParticle(d23a6dcd2ef450a4).()->getModelGroupTermcxx . . $ xercesc_3_2/XSParticle#getModelGroupTerm(4782e22670138a8b).(),
3194 oMapCountOccurrencesOfSameNameSub);
3195
3196 if (!ExploreModelGroupcxx . . $ GMLASSchemaAnalyzer#ExploreModelGroup(e6fd9903c30f114c).(
3197 poEltCT->getParticlecxx . . $ xercesc_3_2/XSComplexTypeDefinition#getParticle(d23a6dcd2ef450a4).()->getModelGroupTermcxx . . $ xercesc_3_2/XSParticle#getModelGroupTerm(4782e22670138a8b).(),
3198 nullptr, oNestedClass, nRecursionCounter + 1,
3199 oSetNewVisitedModelGroups, poModel,
3200 oMapCountOccurrencesOfSameNameSub))
3201 {
3202 return false;
3203 }
3204 }
3205
3206 // If we have a element of type gml:ReferenceType that has
3207 // a targetElement in its annotation.appinfo, then create
3208 // a dedicated field to have cross-layer relationships.
3209 if (IsGMLNamespacecxx . . $ GMLASSchemaAnalyzer#IsGMLNamespace(86da8d82cde12b2b).(transcodecxx . . $ transcode(39fd9df5ac67f380).(poTypeDef->getNamespacecxx . . $ xercesc_3_2/XSTypeDefinition#getNamespace(b92850b821c2ebdb).())) &&
3210 transcodecxx . . $ transcode(39fd9df5ac67f380).(poTypeDef->getNamecxx . . $ xercesc_3_2/XSTypeDefinition#getName(b92850b821c2ebdb).()) == "ReferenceType" &&
3211 !osTargetElement.empty())
3212 {
3213 XSElementDeclarationcxx . . $ xercesc_3_2/XSElementDeclaration# *poTargetElt =
3214 GetTopElementDeclarationFromXPathcxx . . $ GMLASSchemaAnalyzer#GetTopElementDeclarationFromXPath(36d74f5cbbead52).(osTargetElement,
3215 poModel);
3216 // TODO: even for non abstract we should probably
3217 // handle substitutions
3218 if (poTargetElt != nullptr &&
3219 !poTargetElt->getAbstractcxx . . $ xercesc_3_2/XSElementDeclaration#getAbstract(50ce9a9e25b4a850).())
3220 {
3221 bool bHasRequiredId = false;
3222 XSComplexTypeDefinitioncxx . . $ xercesc_3_2/XSComplexTypeDefinition# *poTargetEltCT =
3223 IsEltCompatibleOfFCcxx . . $ IsEltCompatibleOfFC(6a0bd3739bd6039d).(poTargetElt);
3224 if (poTargetEltCT)
3225 {
3226 XSAttributeUseListcxx . . $ xercesc_3_2/XSAttributeUseList# *poTargetEltAttrList =
3227 poTargetEltCT->getAttributeUsescxx . . $ xercesc_3_2/XSComplexTypeDefinition#getAttributeUses(485d41f626ab6abb).();
3228 const size_t nTEAttrListSize =
3229 (poTargetEltAttrList != nullptr)
3230 ? poTargetEltAttrList->sizecxx . . $ xercesc_3_2/BaseRefVectorOf#size(fe4d2d262d4164a8).()
3231 : 0;
3232 for (size_t j = 0; j < nTEAttrListSize; ++j)
3233 {
3234 XSAttributeUsecxx . . $ xercesc_3_2/XSAttributeUse# *poTEAttr =
3235 poTargetEltAttrList->elementAtcxx . . $ xercesc_3_2/BaseRefVectorOf#elementAt(60a54806b2015313).(j);
3236 XSAttributeDeclarationcxx . . $ xercesc_3_2/XSAttributeDeclaration# *poTEAttrDecl =
3237 poTEAttr->getAttrDeclarationcxx . . $ xercesc_3_2/XSAttributeUse#getAttrDeclaration(15623097f01dd279).();
3238 XSSimpleTypeDefinitioncxx . . $ xercesc_3_2/XSSimpleTypeDefinition# *poTEAttrType =
3239 poTEAttrDecl->getTypeDefinitioncxx . . $ xercesc_3_2/XSAttributeDeclaration#getTypeDefinition(7b99620ce20aaec3).();
3240 if (transcodecxx . . $ transcode(39fd9df5ac67f380).(poTEAttrType->getNamecxx . . $ xercesc_3_2/XSSimpleTypeDefinition#getName(b92850b821c2ebdb).()) ==
3241 szXS_IDcxx . . $ GMLASConstants/szXS_ID. &&
3242 poTEAttr->getRequiredcxx . . $ xercesc_3_2/XSAttributeUse#getRequired(50ce9a9e25b4a850).())
3243 {
3244 bHasRequiredId = true;
3245 break;
3246 }
3247 }
3248 }
3249 if (bHasRequiredId && !m_bAlwaysGenerateOGRIdcxx . . $ GMLASSchemaAnalyzer#m_bAlwaysGenerateOGRId.)
3250 {
3251 // If the element is nillable, then we
3252 // need an extra field to be able to distinguish
3253 // between the case of the missing element or
3254 // the element with xsi:nil="true"
3255 if (poElt->getNillablecxx . . $ xercesc_3_2/XSElementDeclaration#getNillable(50ce9a9e25b4a850).() && !m_bUseNullStatecxx . . $ GMLASSchemaAnalyzer#m_bUseNullState.)
3256 {
3257 GMLASFieldcxx . . $ GMLASField# oFieldNilcxx . . $ GMLASField#GMLASField(49f6e7a06ebc5aa8).;
3258 oFieldNil.SetNamecxx . . $ GMLASField#SetName(42786403379ca8d8).(osPrefixedEltName + "_" +
3259 szNILcxx . . $ GMLASConstants/szNIL.);
3260 oFieldNil.SetXPathcxx . . $ GMLASField#SetXPath(42786403379ca8d8).(osElementXPath + "/" +
3261 szAT_XSI_NILcxx . . $ GMLASConstants/szAT_XSI_NIL.);
3262 oFieldNil.SetTypecxx . . $ GMLASField#SetType(1457e335bf1abcdb).(GMLAS_FT_BOOLEANcxx . . $ GMLAS_FT_BOOLEAN.,
3263 "boolean");
3264 oFieldNil.SetMinOccurscxx . . $ GMLASField#SetMinOccurs(d4f767463ce0a6b3).(0);
3265 oFieldNil.SetMaxOccurscxx . . $ GMLASField#SetMaxOccurs(d4f767463ce0a6b3).(1);
3266 aoFields.push_back(stdcxx . . $ std/::move(oFieldNil));
3267 }
3268
3269 GMLASFieldcxx . . $ GMLASField# oFieldcxx . . $ GMLASField#GMLASField(49f6e7a06ebc5aa8).;
3270 // Fake xpath
3271 oField.SetXPathcxx . . $ GMLASField#SetXPath(42786403379ca8d8).(
3272 GMLASFieldcxx . . $ GMLASField#::
3273 MakePKIDFieldXPathFromXLinkHrefXPathcxx . . $ GMLASField#MakePKIDFieldXPathFromXLinkHrefXPath(385147141d89f498).(
3274 osElementXPath + "/" +
3275 szAT_XLINK_HREFcxx . . $ GMLASConstants/szAT_XLINK_HREF.));
3276 oField.SetNamecxx . . $ GMLASField#SetName(42786403379ca8d8).(osPrefixedEltName +
3277 szPKID_SUFFIXcxx . . $ GMLASConstants/szPKID_SUFFIX.);
3278 oField.SetMinOccurscxx . . $ GMLASField#SetMinOccurs(d4f767463ce0a6b3).(0);
3279 oField.SetMaxOccurscxx . . $ GMLASField#SetMaxOccurs(d4f767463ce0a6b3).(1);
3280 oField.SetTypecxx . . $ GMLASField#SetType(1457e335bf1abcdb).(GMLAS_FT_STRINGcxx . . $ GMLAS_FT_STRING., szXS_STRINGcxx . . $ GMLASConstants/szXS_STRING.);
3281 oField.SetCategorycxx . . $ GMLASField#SetCategory(7d753e80d748751c).(
3282 GMLASFieldcxx . . $ GMLASField#::
3283 PATH_TO_CHILD_ELEMENT_WITH_LINKcxx . . $ GMLASField#PATH_TO_CHILD_ELEMENT_WITH_LINK.);
3284 oField.SetRelatedClassXPathcxx . . $ GMLASField#SetRelatedClassXPath(42786403379ca8d8).(osTargetElement);
3285 aoFields.push_back(stdcxx . . $ std/::move(oField));
3286 }
3287 }
3288 else if (poTargetElt != nullptr &&
3289 poTargetElt->getAbstractcxx . . $ xercesc_3_2/XSElementDeclaration#getAbstract(50ce9a9e25b4a850).())
3290 {
3291 // If the element is nillable, then we
3292 // need an extra field to be able to distinguish
3293 // between the case of the missing element or the
3294 // element with xsi:nil="true"
3295 if (poElt->getNillablecxx . . $ xercesc_3_2/XSElementDeclaration#getNillable(50ce9a9e25b4a850).() && !m_bUseNullStatecxx . . $ GMLASSchemaAnalyzer#m_bUseNullState.)
3296 {
3297 GMLASFieldcxx . . $ GMLASField# oFieldNilcxx . . $ GMLASField#GMLASField(49f6e7a06ebc5aa8).;
3298 oFieldNil.SetNamecxx . . $ GMLASField#SetName(42786403379ca8d8).(osPrefixedEltName + "_" +
3299 szNILcxx . . $ GMLASConstants/szNIL.);
3300 oFieldNil.SetXPathcxx . . $ GMLASField#SetXPath(42786403379ca8d8).(osElementXPath + "/" +
3301 szAT_XSI_NILcxx . . $ GMLASConstants/szAT_XSI_NIL.);
3302 oFieldNil.SetTypecxx . . $ GMLASField#SetType(1457e335bf1abcdb).(GMLAS_FT_BOOLEANcxx . . $ GMLAS_FT_BOOLEAN., "boolean");
3303 oFieldNil.SetMinOccurscxx . . $ GMLASField#SetMinOccurs(d4f767463ce0a6b3).(0);
3304 oFieldNil.SetMaxOccurscxx . . $ GMLASField#SetMaxOccurs(d4f767463ce0a6b3).(1);
3305 aoFields.push_back(stdcxx . . $ std/::move(oFieldNil));
3306 }
3307
3308 // e.g importing
3309 // http://inspire.ec.europa.eu/schemas/ad/4.0
3310 // references bu-base:AbstractConstruction, but
3311 // sometimes there are no realization available for
3312 // it, so no need to be verbose about that.
3313 stdcxx . . $ std/::vector<XSElementDeclarationcxx . . $ xercesc_3_2/XSElementDeclaration# *>
3314 apoImplTargetEltList;
3315 GetConcreteImplementationTypescxx . . $ GMLASSchemaAnalyzer#GetConcreteImplementationTypes(34e1fcfb46809e09).(
3316 poTargetElt, apoImplTargetEltList);
3317 if (!apoImplTargetEltList.empty())
3318 {
3319 CPLDebug("GMLAS",
3320 "Not handled: targetElement %s of %s "
3321 "is abstract but has substitutions",
3322 osTargetElement.c_str(),
3323 osElementXPath.c_str());
3324 }
3325 }
3326 else
3327 {
3328 // This shouldn't happen with consistent schemas
3329 // but as targetElement is in <annotation>, no
3330 // general-purpose XSD validator can ensure this
3331 CPLDebug("GMLAS",
3332 "%s is a targetElement of %s, "
3333 "but cannot be found",
3334 osTargetElement.c_str(),
3335 osElementXPath.c_str());
3336 }
3337 }
3338
3339 // Can we move the nested class(es) one level up ?
3340 if (bMoveNestedClassToTop)
3341 {
3342 // Case of an element like
3343 // <xs:element name="foo">
3344 // <xs:complexType>
3345 // <xs:sequence>
3346
3347 const stdcxx . . $ std/::vector<GMLASFieldcxx . . $ GMLASField#> &osNestedClassFields =
3348 oNestedClass.GetFieldscxx . . $ GMLASFeatureClass#GetFields(9b2e6b53619bff0e).();
3349 const bool bIsTimeInstantType =
3350 transcodecxx . . $ transcode(39fd9df5ac67f380).(poTypeDef->getNamecxx . . $ xercesc_3_2/XSTypeDefinition#getName(b92850b821c2ebdb).()) ==
3351 szXS_TIME_INSTANT_TYPEcxx . . $ GMLASConstants/szXS_TIME_INSTANT_TYPE.;
3352 for (size_t j = 0; j < osNestedClassFields.size(); j++)
3353 {
3354 GMLASFieldcxx . . $ GMLASField# oField(osNestedClassFields[j]);
3355 if (bIsTimeInstantType &&
3356 oField.GetTypecxx . . $ GMLASField#GetType(91ae572febc0467e).() == GMLAS_FT_ANYSIMPLETYPEcxx . . $ GMLAS_FT_ANYSIMPLETYPE. &&
3357 oField.GetNamecxx . . $ GMLASField#GetName(1b8c726d1b99eee0).() == "timePosition")
3358 {
3359 oField.SetTypecxx . . $ GMLASField#SetType(1457e335bf1abcdb).(GMLAS_FT_DATETIMEcxx . . $ GMLAS_FT_DATETIME.,
3360 szXS_DATETIMEcxx . . $ GMLASConstants/szXS_DATETIME.);
3361 }
3362 oField.SetNamecxx . . $ GMLASField#SetName(42786403379ca8d8).(osPrefixedEltName + "_" +
3363 oField.GetNamecxx . . $ GMLASField#GetName(1b8c726d1b99eee0).());
3364 if (nMinOccurs == 0 ||
3365 (poEltCT->getParticlecxx . . $ xercesc_3_2/XSComplexTypeDefinition#getParticle(d23a6dcd2ef450a4).() != nullptr &&
3366 poEltCT->getParticlecxx . . $ xercesc_3_2/XSComplexTypeDefinition#getParticle(d23a6dcd2ef450a4).()->getMinOccurscxx . . $ xercesc_3_2/XSParticle#getMinOccurs(fe4d2d262d4164a8).() == 0))
3367 {
3368 oField.SetMinOccurscxx . . $ GMLASField#SetMinOccurs(d4f767463ce0a6b3).(0);
3369 oField.SetNotNullablecxx . . $ GMLASField#SetNotNullable(b45ddcbc8423892c).(false);
3370 }
3371
3372 aoFields.push_back(stdcxx . . $ std/::move(oField));
3373 }
3374
3375 aoNestedClasses = oNestedClass.GetNestedClassescxx . . $ GMLASFeatureClass#GetNestedClasses(825ee02b13fbc77f).();
3376 }
3377 else
3378 {
3379 // Case of an element like
3380 // <xs:element name="foo">
3381 // <xs:complexType>
3382 // <xs:sequence maxOccurs="unbounded">
3383 // or
3384 // <xs:element name="foo" maxOccurs="unbounded">
3385 // <xs:complexType>
3386 // <xs:sequence>
3387 // or even
3388 // <xs:element name="foo" maxOccurs="unbounded">
3389 // <xs:complexType>
3390 // <xs:sequence maxOccurs="unbounded">
3391 if (m_bUseArrayscxx . . $ GMLASSchemaAnalyzer#m_bUseArrays. && nAttrListSize == 0 &&
3392 oNestedClass.GetNestedClassescxx . . $ GMLASFeatureClass#GetNestedClasses(825ee02b13fbc77f).().empty() &&
3393 oNestedClass.GetFieldscxx . . $ GMLASFeatureClass#GetFields(9b2e6b53619bff0e).().size() == 1 &&
3394 IsCompatibleOfArraycxx . . $ IsCompatibleOfArray(58f33dce0e756b8f).(
3395 oNestedClass.GetFieldscxx . . $ GMLASFeatureClass#GetFields(9b2e6b53619bff0e).()[0].GetTypecxx . . $ GMLASField#GetType(91ae572febc0467e).()) &&
3396 oNestedClass.GetFieldscxx . . $ GMLASFeatureClass#GetFields(9b2e6b53619bff0e).()[0].GetCategorycxx . . $ GMLASField#GetCategory(c4a5dfd59ad3a301).() !=
3397 GMLASFieldcxx . . $ GMLASField#::PATH_TO_CHILD_ELEMENT_WITH_LINKcxx . . $ GMLASField#PATH_TO_CHILD_ELEMENT_WITH_LINK.)
3398 {
3399 // In the case the sequence has a single element,
3400 // compatible of array type, and no attribute and
3401 // no nested classes, then add an array attribute
3402 // at the top-level
3403 GMLASFieldcxx . . $ GMLASField# oField(oNestedClass.GetFieldscxx . . $ GMLASFeatureClass#GetFields(9b2e6b53619bff0e).()[0]);
3404 oField.SetNamecxx . . $ GMLASField#SetName(42786403379ca8d8).(osPrefixedEltName + "_" +
3405 oField.GetNamecxx . . $ GMLASField#GetName(1b8c726d1b99eee0).());
3406 if (oField.GetMaxOccurscxx . . $ GMLASField#GetMaxOccurs(455f465bc33b4cdf).() == 1 &&
3407 bEltRepeatedParticle &&
3408 poEltCT->getParticlecxx . . $ xercesc_3_2/XSComplexTypeDefinition#getParticle(d23a6dcd2ef450a4).() != nullptr)
3409 {
3410 oField.SetMaxOccurscxx . . $ GMLASField#SetMaxOccurs(d4f767463ce0a6b3).(nMaxOccursEltParticle);
3411 }
3412 oField.SetArraycxx . . $ GMLASField#SetArray(b45ddcbc8423892c).(true);
3413 oClass.AddFieldcxx . . $ GMLASFeatureClass#AddField(18625785520e30ac).(oField);
3414 }
3415 else
3416 {
3417 if (!aoFields.empty() && bEltRepeatedParticle)
3418 {
3419 // We have attributes and the sequence is
3420 // repeated
3421 // <xs:element name="foo"
3422 // maxOccurs="unbounded">
3423 // <xs:complexType>
3424 // <xs:sequence maxOccurs="unbounded">
3425 // ...
3426 // </xs:sequence>
3427 // <xs:attribute .../>
3428 // </xs:complexType>
3429 // </xs:element>
3430 // So we need to create an
3431 // intermediate class to store them
3432 GMLASFeatureClasscxx . . $ GMLASFeatureClass# oIntermediateNestedClasscxx . . $ GMLASFeatureClass#GMLASFeatureClass(49f6e7a06ebc5aa8).;
3433 oIntermediateNestedClass.SetNamecxx . . $ GMLASFeatureClass#SetName(42786403379ca8d8).(
3434 oClass.GetNamecxx . . $ GMLASFeatureClass#GetName(1b8c726d1b99eee0).() + "_" + osPrefixedEltName);
3435 oIntermediateNestedClass.SetXPathcxx . . $ GMLASFeatureClass#SetXPath(42786403379ca8d8).(
3436 osElementXPath);
3437
3438 oIntermediateNestedClass.PrependFieldscxx . . $ GMLASFeatureClass#PrependFields(3a9c1b984d0b7afa).(
3439 aoFields);
3440
3441 oNestedClass.SetNamecxx . . $ GMLASFeatureClass#SetName(42786403379ca8d8).(oClass.GetNamecxx . . $ GMLASFeatureClass#GetName(1b8c726d1b99eee0).() + "_" +
3442 osPrefixedEltName +
3443 "_sequence");
3444 oNestedClass.SetXPathcxx . . $ GMLASFeatureClass#SetXPath(42786403379ca8d8).(oNestedClass.GetXPathcxx . . $ GMLASFeatureClass#GetXPath(1b8c726d1b99eee0).() +
3445 szEXTRA_SUFFIXcxx . . $ GMLASConstants/szEXTRA_SUFFIX. +
3446 "sequence");
3447 oNestedClass.SetIsRepeatedSequencecxx . . $ GMLASFeatureClass#SetIsRepeatedSequence(b45ddcbc8423892c).(true);
3448
3449 GMLASFieldcxx . . $ GMLASField# oFieldcxx . . $ GMLASField#GMLASField(49f6e7a06ebc5aa8).;
3450 oField.SetXPathcxx . . $ GMLASField#SetXPath(42786403379ca8d8).(osElementXPath);
3451 oField.SetCategorycxx . . $ GMLASField#SetCategory(7d753e80d748751c).(
3452 GMLASFieldcxx . . $ GMLASField#::PATH_TO_CHILD_ELEMENT_NO_LINKcxx . . $ GMLASField#PATH_TO_CHILD_ELEMENT_NO_LINK.);
3453 if (nMaxOccursEltParticle != 1)
3454 oField.SetRepetitionOnSequencecxx . . $ GMLASField#SetRepetitionOnSequence(b45ddcbc8423892c).(true);
3455 oField.SetMinOccurscxx . . $ GMLASField#SetMinOccurs(d4f767463ce0a6b3).(nMinOccursEltParticle);
3456 oField.SetMaxOccurscxx . . $ GMLASField#SetMaxOccurs(d4f767463ce0a6b3).(nMaxOccursEltParticle);
3457 oField.SetRelatedClassXPathcxx . . $ GMLASField#SetRelatedClassXPath(42786403379ca8d8).(
3458 oNestedClass.GetXPathcxx . . $ GMLASFeatureClass#GetXPath(1b8c726d1b99eee0).());
3459 oIntermediateNestedClass.AddFieldcxx . . $ GMLASFeatureClass#AddField(18625785520e30ac).(oField);
3460
3461 oIntermediateNestedClass.AddNestedClasscxx . . $ GMLASFeatureClass#AddNestedClass(d64d5814e030c1b7).(
3462 oNestedClass);
3463
3464 oClass.AddNestedClasscxx . . $ GMLASFeatureClass#AddNestedClass(d64d5814e030c1b7).(oIntermediateNestedClass);
3465 }
3466 else
3467 {
3468 oNestedClass.SetIsRepeatedSequencecxx . . $ GMLASFeatureClass#SetIsRepeatedSequence(b45ddcbc8423892c).(
3469 bEltRepeatedParticle);
3470 oNestedClass.PrependFieldscxx . . $ GMLASFeatureClass#PrependFields(3a9c1b984d0b7afa).(aoFields);
3471
3472 oClass.AddNestedClasscxx . . $ GMLASFeatureClass#AddNestedClass(d64d5814e030c1b7).(oNestedClass);
3473 }
3474
3475 GMLASFieldcxx . . $ GMLASField# oFieldcxx . . $ GMLASField#GMLASField(49f6e7a06ebc5aa8).;
3476 oField.SetNamecxx . . $ GMLASField#SetName(42786403379ca8d8).(osPrefixedEltName);
3477 oField.SetXPathcxx . . $ GMLASField#SetXPath(42786403379ca8d8).(osElementXPath);
3478 if (bRepeatedParticle)
3479 {
3480 if (poEltCT->getParticlecxx . . $ xercesc_3_2/XSComplexTypeDefinition#getParticle(d23a6dcd2ef450a4).() != nullptr)
3481 {
3482 oField.SetMinOccurscxx . . $ GMLASField#SetMinOccurs(d4f767463ce0a6b3).(ComposeMinOccurscxx . . $ ComposeMinOccurs(9b79fb6aee4c0440).(
3483 nMinOccurs, nMinOccursEltParticle));
3484 oField.SetMaxOccurscxx . . $ GMLASField#SetMaxOccurs(d4f767463ce0a6b3).(ComposeMaxOccurscxx . . $ ComposeMaxOccurs(9b79fb6aee4c0440).(
3485 nMaxOccurs, nMaxOccursEltParticle));
3486 }
3487 else
3488 {
3489 oField.SetMinOccurscxx . . $ GMLASField#SetMinOccurs(d4f767463ce0a6b3).(nMinOccurs);
3490 oField.SetMaxOccurscxx . . $ GMLASField#SetMaxOccurs(d4f767463ce0a6b3).(nMaxOccurs);
3491 }
3492 }
3493 else if (poEltCT->getParticlecxx . . $ xercesc_3_2/XSComplexTypeDefinition#getParticle(d23a6dcd2ef450a4).() != nullptr)
3494 {
3495 if (nMaxOccursEltParticle != 1)
3496 oField.SetRepetitionOnSequencecxx . . $ GMLASField#SetRepetitionOnSequence(b45ddcbc8423892c).(true);
3497 oField.SetMinOccurscxx . . $ GMLASField#SetMinOccurs(d4f767463ce0a6b3).(nMinOccursEltParticle);
3498 oField.SetMaxOccurscxx . . $ GMLASField#SetMaxOccurs(d4f767463ce0a6b3).(nMaxOccursEltParticle);
3499 }
3500 oField.SetCategorycxx . . $ GMLASField#SetCategory(7d753e80d748751c).(
3501 GMLASFieldcxx . . $ GMLASField#::PATH_TO_CHILD_ELEMENT_NO_LINKcxx . . $ GMLASField#PATH_TO_CHILD_ELEMENT_NO_LINK.);
3502 oField.SetRelatedClassXPathcxx . . $ GMLASField#SetRelatedClassXPath(42786403379ca8d8).(oField.GetXPathcxx . . $ GMLASField#GetXPath(1b8c726d1b99eee0).());
3503 oClass.AddFieldcxx . . $ GMLASFeatureClass#AddField(18625785520e30ac).(oField);
3504 }
3505
3506 bNothingMoreToDo = true;
3507 }
3508 }
3509
3510 if (bNothingMoreToDo)
3511 {
3512 // Nothing to do
3513 }
3514 else if (bRepeatedParticle)
3515 {
3516 GMLASFeatureClasscxx . . $ GMLASFeatureClass# oNestedClasscxx . . $ GMLASFeatureClass#GMLASFeatureClass(49f6e7a06ebc5aa8).;
3517 oNestedClass.SetNamecxx . . $ GMLASFeatureClass#SetName(42786403379ca8d8).(oClass.GetNamecxx . . $ GMLASFeatureClass#GetName(1b8c726d1b99eee0).() + "_" +
3518 osPrefixedEltName);
3519 oNestedClass.SetXPathcxx . . $ GMLASFeatureClass#SetXPath(42786403379ca8d8).(osElementXPath);
3520 oNestedClass.AppendFieldscxx . . $ GMLASFeatureClass#AppendFields(3a9c1b984d0b7afa).(aoFields);
3521 oNestedClass.SetDocumentationcxx . . $ GMLASFeatureClass#SetDocumentation(42786403379ca8d8).(GetAnnotationDoccxx . . $ GetAnnotationDoc(c42646b806debdc2).(poElt));
3522 oClass.AddNestedClasscxx . . $ GMLASFeatureClass#AddNestedClass(d64d5814e030c1b7).(oNestedClass);
3523
3524 GMLASFieldcxx . . $ GMLASField# oFieldcxx . . $ GMLASField#GMLASField(49f6e7a06ebc5aa8).;
3525 oField.SetNamecxx . . $ GMLASField#SetName(42786403379ca8d8).(osPrefixedEltName);
3526 oField.SetXPathcxx . . $ GMLASField#SetXPath(42786403379ca8d8).(osElementXPath);
3527 oField.SetMinOccurscxx . . $ GMLASField#SetMinOccurs(d4f767463ce0a6b3).((bIsChoice) ? 0 : nMinOccurs);
3528 oField.SetMaxOccurscxx . . $ GMLASField#SetMaxOccurs(d4f767463ce0a6b3).(nMaxOccurs);
3529 oField.SetCategorycxx . . $ GMLASField#SetCategory(7d753e80d748751c).(
3530 GMLASFieldcxx . . $ GMLASField#::PATH_TO_CHILD_ELEMENT_NO_LINKcxx . . $ GMLASField#PATH_TO_CHILD_ELEMENT_NO_LINK.);
3531 oField.SetRelatedClassXPathcxx . . $ GMLASField#SetRelatedClassXPath(42786403379ca8d8).(oField.GetXPathcxx . . $ GMLASField#GetXPath(1b8c726d1b99eee0).());
3532 oClass.AddFieldcxx . . $ GMLASFeatureClass#AddField(18625785520e30ac).(oField);
3533 }
3534 else
3535 {
3536 oClass.AppendFieldscxx . . $ GMLASFeatureClass#AppendFields(3a9c1b984d0b7afa).(aoFields);
3537 for (size_t j = 0; j < aoNestedClasses.size(); j++)
3538 {
3539 oClass.AddNestedClasscxx . . $ GMLASFeatureClass#AddNestedClass(d64d5814e030c1b7).(aoNestedClasses[j]);
3540 }
3541 }
3542 }
3543 }
3544 else if (poParticle->getTermTypecxx . . $ xercesc_3_2/XSParticle#getTermType(8b4c3756b6b7510b).() == XSParticlecxx . . $ xercesc_3_2/XSParticle#::TERM_MODELGROUPcxx . . $ xercesc_3_2/XSParticle#TERM_MODELGROUP.)
3545 {
3546 XSModelGroupcxx . . $ xercesc_3_2/XSModelGroup# *psSubModelGroup = poParticle->getModelGroupTermcxx . . $ xercesc_3_2/XSParticle#getModelGroupTerm(4782e22670138a8b).();
3547 if (bRepeatedParticle)
3548 {
3549 GMLASFeatureClasscxx . . $ GMLASFeatureClass# oNestedClasscxx . . $ GMLASFeatureClass#GMLASFeatureClass(49f6e7a06ebc5aa8).;
3550 CPLString osGroupName;
3551 XSModelGroupDefinitioncxx . . $ xercesc_3_2/XSModelGroupDefinition# *psGroupDefinition =
3552 GetGroupDefinitioncxx . . $ GMLASSchemaAnalyzer#GetGroupDefinition(35e7176071efce57).(psSubModelGroup);
3553 if (psGroupDefinition != nullptr)
3554 {
3555 osGroupName = transcodecxx . . $ transcode(39fd9df5ac67f380).(psGroupDefinition->getNamecxx . . $ xercesc_3_2/XSModelGroupDefinition#getName(b92850b821c2ebdb).());
3556 oNestedClass.SetDocumentationcxx . . $ GMLASFeatureClass#SetDocumentation(42786403379ca8d8).(
3557 GetAnnotationDoccxx . . $ GetAnnotationDoc(29613dfbf7736e29).(psGroupDefinition->getAnnotationcxx . . $ xercesc_3_2/XSModelGroupDefinition#getAnnotation(44ae4ca8aaeb5ed9).()));
3558 }
3559 else
3560 {
3561 // Is it a <xs:choice maxOccurs=">1|unbounded"
3562 if (psSubModelGroup->getCompositorcxx . . $ xercesc_3_2/XSModelGroup#getCompositor(cb9708a35e0ab97a).() ==
3563 XSModelGroupcxx . . $ xercesc_3_2/XSModelGroup#::COMPOSITOR_CHOICEcxx . . $ xercesc_3_2/XSModelGroup#COMPOSITOR_CHOICE.)
3564 {
3565 stdcxx . . $ std/::setcxx . . $ std/set#<XSModelGroupcxx . . $ xercesc_3_2/XSModelGroup# *> oSetNewVisitedModelGroupscxx . . $ std/set#set(a5cb4082b223c231).(
3566 oSetVisitedModelGroups);
3567 GMLASFeatureClasscxx . . $ GMLASFeatureClass# oTmpClasscxx . . $ GMLASFeatureClass#GMLASFeatureClass(49f6e7a06ebc5aa8).;
3568 oTmpClass.SetNamecxx . . $ GMLASFeatureClass#SetName(42786403379ca8d8).(oClass.GetNamecxx . . $ GMLASFeatureClass#GetName(1b8c726d1b99eee0).());
3569 oTmpClass.SetXPathcxx . . $ GMLASFeatureClass#SetXPath(42786403379ca8d8).(oClass.GetXPathcxx . . $ GMLASFeatureClass#GetXPath(1b8c726d1b99eee0).());
3570 if (!ExploreModelGroupcxx . . $ GMLASSchemaAnalyzer#ExploreModelGroup(e6fd9903c30f114c).(psSubModelGroup, nullptr,
3571 oTmpClass, nRecursionCounter + 1,
3572 oSetNewVisitedModelGroups,
3573 poModel,
3574 oMapCountOccurrencesOfSameName))
3575 {
3576 return false;
3577 }
3578 bool bHasArray = false;
3579 stdcxx . . $ std/::vector<GMLASFieldcxx . . $ GMLASField#> &oTmpFields =
3580 oTmpClass.GetFieldscxx . . $ GMLASFeatureClass#GetFields(9b2e6b53619bff0e).();
3581 for (size_t j = 0; j < oTmpFields.size(); ++j)
3582 {
3583 if (oTmpFields[j].IsArraycxx . . $ GMLASField#IsArray(50ce9a9e25b4a850).())
3584 {
3585 bHasArray = true;
3586 break;
3587 }
3588 }
3589 if (!bHasArray)
3590 {
3591 for (size_t j = 0; j < oTmpFields.size(); ++j)
3592 {
3593 oTmpFields[j].SetMayAppearOutOfOrdercxx . . $ GMLASField#SetMayAppearOutOfOrder(b45ddcbc8423892c).(true);
3594 oClass.AddFieldcxx . . $ GMLASFeatureClass#AddField(18625785520e30ac).(oTmpFields[j]);
3595 }
3596 return true;
3597 }
3598 }
3599
3600 nGroup++;
3601 osGroupName = CPLSPrintf("_group%d", nGroup);
3602 }
3603 oNestedClass.SetNamecxx . . $ GMLASFeatureClass#SetName(42786403379ca8d8).(oClass.GetNamecxx . . $ GMLASFeatureClass#GetName(1b8c726d1b99eee0).() + "_" + osGroupName);
3604 oNestedClass.SetIsGroupcxx . . $ GMLASFeatureClass#SetIsGroup(b45ddcbc8423892c).(true);
3605 oNestedClass.SetIsRepeatedSequencecxx . . $ GMLASFeatureClass#SetIsRepeatedSequence(b45ddcbc8423892c).(true);
3606 // Caution: we will change it afterwards !
3607 oNestedClass.SetXPathcxx . . $ GMLASFeatureClass#SetXPath(42786403379ca8d8).(oClass.GetXPathcxx . . $ GMLASFeatureClass#GetXPath(1b8c726d1b99eee0).());
3608 stdcxx . . $ std/::setcxx . . $ std/set#<XSModelGroupcxx . . $ xercesc_3_2/XSModelGroup# *> oSetNewVisitedModelGroupscxx . . $ std/set#set(a5cb4082b223c231).(
3609 oSetVisitedModelGroups);
3610 if (!ExploreModelGroupcxx . . $ GMLASSchemaAnalyzer#ExploreModelGroup(e6fd9903c30f114c).(psSubModelGroup, nullptr, oNestedClass,
3611 nRecursionCounter + 1,
3612 oSetNewVisitedModelGroups, poModel,
3613 oMapCountOccurrencesOfSameName))
3614 {
3615 return false;
3616 }
3617 // This is a nasty hack. We set a unique fake xpath *AFTER*
3618 // processing the group, so that we can add a fake GROUP field
3619 // pointing to the nested class
3620 oNestedClass.SetXPathcxx . . $ GMLASFeatureClass#SetXPath(42786403379ca8d8).(oClass.GetXPathcxx . . $ GMLASFeatureClass#GetXPath(1b8c726d1b99eee0).() + szEXTRA_SUFFIXcxx . . $ GMLASConstants/szEXTRA_SUFFIX. +
3621 osGroupName);
3622
3623 if (m_bUseArrayscxx . . $ GMLASSchemaAnalyzer#m_bUseArrays. && oNestedClass.GetFieldscxx . . $ GMLASFeatureClass#GetFields(9b2e6b53619bff0e).().size() == 1 &&
3624 IsCompatibleOfArraycxx . . $ IsCompatibleOfArray(58f33dce0e756b8f).(oNestedClass.GetFieldscxx . . $ GMLASFeatureClass#GetFields(9b2e6b53619bff0e).()[0].GetTypecxx . . $ GMLASField#GetType(91ae572febc0467e).()))
3625 {
3626 GMLASFieldcxx . . $ GMLASField# oField(oNestedClass.GetFieldscxx . . $ GMLASFeatureClass#GetFields(9b2e6b53619bff0e).()[0]);
3627 oField.SetMinOccurscxx . . $ GMLASField#SetMinOccurs(d4f767463ce0a6b3).(
3628 ComposeMinOccurscxx . . $ ComposeMinOccurs(9b79fb6aee4c0440).(oField.GetMinOccurscxx . . $ GMLASField#GetMinOccurs(455f465bc33b4cdf).(), nMinOccurs));
3629 oField.SetMaxOccurscxx . . $ GMLASField#SetMaxOccurs(d4f767463ce0a6b3).(
3630 ComposeMaxOccurscxx . . $ ComposeMaxOccurs(9b79fb6aee4c0440).(oField.GetMaxOccurscxx . . $ GMLASField#GetMaxOccurs(455f465bc33b4cdf).(), nMaxOccurs));
3631 oField.SetArraycxx . . $ GMLASField#SetArray(b45ddcbc8423892c).(true);
3632 oClass.AddFieldcxx . . $ GMLASFeatureClass#AddField(18625785520e30ac).(oField);
3633 }
3634 else
3635 {
3636 oClass.AddNestedClasscxx . . $ GMLASFeatureClass#AddNestedClass(d64d5814e030c1b7).(oNestedClass);
3637
3638 GMLASFieldcxx . . $ GMLASField# oFieldcxx . . $ GMLASField#GMLASField(49f6e7a06ebc5aa8).;
3639 oField.SetCategorycxx . . $ GMLASField#SetCategory(7d753e80d748751c).(GMLASFieldcxx . . $ GMLASField#::GROUPcxx . . $ GMLASField#GROUP.);
3640 oField.SetMinOccurscxx . . $ GMLASField#SetMinOccurs(d4f767463ce0a6b3).(nMinOccurs);
3641 oField.SetMaxOccurscxx . . $ GMLASField#SetMaxOccurs(d4f767463ce0a6b3).(nMaxOccurs);
3642 oField.SetRelatedClassXPathcxx . . $ GMLASField#SetRelatedClassXPath(42786403379ca8d8).(oNestedClass.GetXPathcxx . . $ GMLASFeatureClass#GetXPath(1b8c726d1b99eee0).());
3643 oClass.AddFieldcxx . . $ GMLASFeatureClass#AddField(18625785520e30ac).(oField);
3644 }
3645 }
3646 else
3647 {
3648 stdcxx . . $ std/::setcxx . . $ std/set#<XSModelGroupcxx . . $ xercesc_3_2/XSModelGroup# *> oSetNewVisitedModelGroupscxx . . $ std/set#set(a5cb4082b223c231).(
3649 oSetVisitedModelGroups);
3650 if (!ExploreModelGroupcxx . . $ GMLASSchemaAnalyzer#ExploreModelGroup(e6fd9903c30f114c).(psSubModelGroup, nullptr, oClass,
3651 nRecursionCounter + 1,
3652 oSetNewVisitedModelGroups, poModel,
3653 oMapCountOccurrencesOfSameName))
3654 {
3655 return false;
3656 }
3657 }
3658 }
3659 else if (poParticle->getTermTypecxx . . $ xercesc_3_2/XSParticle#getTermType(8b4c3756b6b7510b).() == XSParticlecxx . . $ xercesc_3_2/XSParticle#::TERM_WILDCARDcxx . . $ xercesc_3_2/XSParticle#TERM_WILDCARD.)
3660 {
3661 /* Special case for a layer that matches everything, as found */
3662 /* in swe:extension */
3663 XSWildcardcxx . . $ xercesc_3_2/XSWildcard# *poWildcard = poParticle->getWildcardTermcxx . . $ xercesc_3_2/XSParticle#getWildcardTerm(ecfb7c5d94f34a3f).();
3664 GMLASFieldcxx . . $ GMLASField# oFieldcxx . . $ GMLASField#GMLASField(49f6e7a06ebc5aa8).;
3665 oField.SetXPathcxx . . $ GMLASField#SetXPath(42786403379ca8d8).(oClass.GetXPathcxx . . $ GMLASFeatureClass#GetXPath(1b8c726d1b99eee0).() + szMATCH_ALLcxx . . $ GMLASConstants/szMATCH_ALL.);
3666 oField.SetNamecxx . . $ GMLASField#SetName(42786403379ca8d8).("value");
3667 oField.SetTypecxx . . $ GMLASField#SetType(1457e335bf1abcdb).(GMLAS_FT_ANYTYPEcxx . . $ GMLAS_FT_ANYTYPE., szXS_ANY_TYPEcxx . . $ GMLASConstants/szXS_ANY_TYPE.);
3668 oField.SetIncludeThisEltInBlobcxx . . $ GMLASField#SetIncludeThisEltInBlob(b45ddcbc8423892c).(true);
3669 oField.SetMinOccurscxx . . $ GMLASField#SetMinOccurs(d4f767463ce0a6b3).(nMinOccurs);
3670 oField.SetMaxOccurscxx . . $ GMLASField#SetMaxOccurs(d4f767463ce0a6b3).(1);
3671 oField.SetDocumentationcxx . . $ GMLASField#SetDocumentation(42786403379ca8d8).(
3672 GetAnnotationDoccxx . . $ GetAnnotationDoc(29613dfbf7736e29).(poWildcard->getAnnotationcxx . . $ xercesc_3_2/XSWildcard#getAnnotation(44ae4ca8aaeb5ed9).()));
3673 oClass.AddFieldcxx . . $ GMLASFeatureClass#AddField(18625785520e30ac).(oField);
3674 }
3675 }
3676
3677 return true;
3678 }