26 #include <boost/algorithm/string.hpp> 28 #include "../../../../../common/StringUtils.h" 29 #include "../../../../core/Utils.h" 30 #include "../../../../core/Exception.h" 44 reader->setValidationScheme(
false);
45 reader->setDoSchema(
false);
46 reader->setIgnoreWhiteSpaces(
true);
47 reader->setCacheGrammarFromParse(
false);
48 reader->setUseCachedGrammarInParse(
false);
50 reader->read(xmlPath);
58 if(!boost::iequals(reader->getElementLocalName(),
"WMT_MS_Capabilities"))
65 while (reader->next())
67 if(boost::iequals(reader->getElementLocalName(),
"Capability"))
80 if (reader->hasAttrs())
82 for (
size_t i = 0; i < reader->getNumberOfAttrs(); i++)
84 if(boost::iequals(reader->getAttrLocalName(i),
"queryable"))
85 layer.
m_queryable = (reader->getAttrAsInt32(
"queryable") != 0) ?
true :
false;
86 else if (boost::iequals(reader->getAttrLocalName(i),
"cascaded"))
87 layer.
m_cascaded = (reader->getAttrAsInt32(
"cascaded") != 0) ?
true :
false;
88 else if (boost::iequals(reader->getAttrLocalName(i),
"opaque"))
89 layer.
m_opaque = (reader->getAttrAsInt32(
"opaque") != 0) ?
true :
false;
90 else if (boost::iequals(reader->getAttrLocalName(i),
"noSubsets"))
91 layer.
m_noSubsets = (reader->getAttrAsInt32(
"noSubsets") != 0) ?
true :
false;
92 else if (boost::iequals(reader->getAttrLocalName(i),
"fixedWidth"))
93 layer.
m_fixedWidth = (reader->getAttrAsInt32(
"fixedWidth") != 0) ?
true :
false;
94 else if (boost::iequals(reader->getAttrLocalName(i),
"fixedHeight"))
95 layer.
m_fixedHeight = (reader->getAttrAsInt32(
"fixedHeight") != 0) ?
true :
false;
99 std::vector<std::string> srsList;
101 while (reader->next() && !(reader->getNodeType() ==
te::xml::END_ELEMENT && boost::iequals(reader->getElementLocalName(),
"Layer")))
103 if(reader->getNodeType() ==
te::xml::VALUE && boost::iequals(reader->getElementLocalName(),
"Name"))
105 layer.
m_name = reader->getElementValue();
107 else if(reader->getNodeType() ==
te::xml::VALUE && boost::iequals(reader->getElementLocalName(),
"Title"))
109 layer.
m_title = reader->getElementValue();
111 else if(reader->getNodeType() ==
te::xml::VALUE && boost::iequals(reader->getElementLocalName(),
"Abstract"))
115 else if(reader->getNodeType() ==
te::xml::VALUE && boost::iequals(reader->getElementLocalName(),
"SRS"))
117 srsList.push_back(reader->getElementValue());
119 else if(reader->getNodeType() ==
te::xml::START_ELEMENT && boost::iequals(reader->getElementLocalName(),
"KeywordList"))
121 std::vector<std::string> keywordList;
123 while (reader->next() && !(reader->getNodeType() ==
te::xml::END_ELEMENT && boost::iequals(reader->getElementLocalName(),
"KeywordList")))
125 if(reader->getNodeType() ==
te::xml::VALUE && boost::iequals(reader->getElementLocalName(),
"Keyword"))
127 keywordList.push_back(reader->getElementValue());
133 else if (reader->getNodeType() ==
te::xml::START_ELEMENT && boost::iequals(reader->getElementLocalName(),
"LatLonBoundingBox"))
137 else if (reader->getNodeType() ==
te::xml::START_ELEMENT && boost::iequals(reader->getElementLocalName(),
"BoundingBox") && reader->hasAttrs())
141 else if (boost::iequals(reader->getElementLocalName(),
"Dimension") && reader->hasAttrs())
145 else if (reader->getNodeType() ==
te::xml::START_ELEMENT && boost::iequals(reader->getElementLocalName(),
"Style"))
149 else if (reader->getNodeType() ==
te::xml::START_ELEMENT && boost::iequals(reader->getElementLocalName(),
"ScaleHint") && reader->hasAttrs())
151 for (
unsigned int i = 0; i < reader->getNumberOfAttrs(); i++)
153 if(boost::iequals(reader->getAttrLocalName(i),
"min"))
155 else if (boost::iequals(reader->getAttrLocalName(i),
"max"))
159 else if (reader->getNodeType() ==
te::xml::START_ELEMENT && boost::iequals(reader->getElementLocalName(),
"Layer"))
166 layer.
m_crs = srsList;
181 return latLonBoundingBox;
189 for (
unsigned int i = 0; i < reader->getNumberOfAttrs(); i++)
191 if(boost::iequals(reader->getAttrLocalName(i),
"name"))
192 dimension.
m_name = reader->getAttr(
"name");
193 else if (boost::iequals(reader->getAttrLocalName(i),
"units"))
194 dimension.
m_units = reader->getAttr(
"units");
195 else if (boost::iequals(reader->getAttrLocalName(i),
"unitSymbol"))
202 if (boost::iequals(reader->getElementLocalName(),
"Extent"))
204 for (
unsigned int i = 0; i < reader->getNumberOfAttrs(); i++)
206 if (boost::iequals(reader->getAttrLocalName(i),
"default"))
207 dimension.
m_default = reader->getAttr(
"default");
208 else if (boost::iequals(reader->getAttrLocalName(i),
"nearestValue"))
209 dimension.
m_nearestValue = (reader->getAttrAsInt32(
"nearestValue") != 0) ?
true :
false;
212 while (reader->next() && !(reader->getNodeType() ==
te::xml::END_ELEMENT && boost::iequals(reader->getElementLocalName(),
"Extent")))
216 std::string allowedValuesStr = reader->getElementValue();
232 box.
m_crs = reader->getAttr(
"SRS");
234 box.
m_minX = reader->getAttrAsDouble(
"minx");
235 box.
m_minY = reader->getAttrAsDouble(
"miny");
236 box.
m_maxX = reader->getAttrAsDouble(
"maxx");
237 box.
m_maxY = reader->getAttrAsDouble(
"maxy");
virtual BoundingBox parseBoundingBox(const std::unique_ptr< te::xml::Reader > &reader)
TECOMMONEXPORT std::vector< std::string > SplitString(const std::string &str, const char &delimiter)
virtual Style parseStyle(const std::unique_ptr< te::xml::Reader > &reader)
std::vector< std::string > m_crs
double m_southBoundLatitude
double m_westBoundLongitude
static te::xml::Reader * make()
It creates a new XML reader using the dafault implementation.
#define TE_TR(message)
It marks a string in order to get translated.
std::vector< Layer > m_layers
unsigned int m_fixedWidth
boost::error_info< struct tag_error_description, std::string > ErrorDescription
The base type for error report messages.
The Capability WMS 1.3.0 struct.
std::vector< Dimension > m_dimensions
te::da::DataSourceCapabilities capabilities
std::vector< std::string > m_allowedValues
std::vector< Style > m_styles
The Dimension WMS 1.3.0 struct.
The Layer WMS 1.3.0 struct.
virtual Layer parseLayers(const std::unique_ptr< te::xml::Reader > &reader)
virtual WMSCapabilities parseCapabilities(const std::string &xmlPath)
Method responsible to parse a WMS 1.1.1 XML GetCapabilities file and create an WMSCapabilities instan...
Base exception class for WS Core Runtime Library.
double m_northBoundLatitude
double m_minScaleDenominator
std::vector< std::string > m_keywordList
std::string m_version
WMS version that XMLParser instance could read. Default implementation is 1.3.0.
double m_maxScaleDenominator
double m_eastBoundLongitude
virtual Capability parseCapability(const std::unique_ptr< te::xml::Reader > &reader)
Exception to be used when a XML has an unsupported version by XMLParser.
virtual GeographicBoundingBox parseGeographicBoundingBox(const std::unique_ptr< te::xml::Reader > &reader)
GeographicBoundingBox m_geoBoundingBox
The GeographicBoundingBox WMS 1.3.0 struct.
unsigned int m_fixedHeight
virtual Dimension parseDimension(const std::unique_ptr< te::xml::Reader > &reader)
std::vector< BoundingBox > m_boundingBoxes
The BoundingBox WMS 1.3.0 struct.