Skip to content

Commit 6ba303e

Browse files
committed
SLD parsing: handling ogc:Literal within CssParameter
1 parent 5abe66b commit 6ba303e

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

‎src/core/symbology-ng/qgssymbollayerutils.cpp‎

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2566,14 +2566,31 @@ QDomElement QgsSymbolLayerUtils::createSvgParameterElement( QDomDocument &doc, c
25662566
QgsStringMap QgsSymbolLayerUtils::getSvgParameterList( QDomElement &element )
25672567
{
25682568
QgsStringMap params;
2569+
QString value;
25692570

25702571
QDomElement paramElem = element.firstChildElement();
25712572
while ( !paramElem.isNull() )
25722573
{
25732574
if ( paramElem.localName() == QLatin1String( "SvgParameter" ) || paramElem.localName() == QLatin1String( "CssParameter" ) )
25742575
{
25752576
QString name = paramElem.attribute( QStringLiteral( "name" ) );
2576-
QString value = paramElem.firstChild().nodeValue();
2577+
if (paramElem.firstChild().nodeType() == QDomNode::TextNode)
2578+
{
2579+
value = paramElem.firstChild().nodeValue();
2580+
}
2581+
else
2582+
{
2583+
if (paramElem.firstChild().nodeType() == QDomNode::ElementNode &&
2584+
paramElem.firstChild().localName() == QLatin1String("Literal"))
2585+
{
2586+
QgsDebugMsg(paramElem.firstChild().localName());
2587+
value = paramElem.firstChild().firstChild().nodeValue();
2588+
}
2589+
else
2590+
{
2591+
QgsDebugMsg(QString("unexpected child of %1").arg(paramElem.localName()));
2592+
}
2593+
}
25772594

25782595
if ( !name.isEmpty() && !value.isEmpty() )
25792596
params[ name ] = value;

0 commit comments

Comments
 (0)