Skip to content
Permalink
Browse files

wfs fix also for the 0.8 branch

git-svn-id: http://svn.osgeo.org/qgis/branches/Release-0_8_0@6444 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent
mhugent committed Jan 19, 2007
1 parent 554a74a commit a7f69c6e4219facdf01ff019566696545f156b08
Showing with 34 additions and 21 deletions.
  1. +34 −21 src/providers/wfs/qgswfsprovider.cpp
@@ -472,33 +472,46 @@ int QgsWFSProvider::readAttributesFromSchema(QDomDocument& schemaDoc, QString& g
return 1;
}
QDomElement schemaElement = schemaNodeList.at(0).toElement();

//find <element name="tname" type = ...>
QString complexTypeType;
QDomNodeList typeElementNodeList = schemaElement.elementsByTagNameNS("http://www.w3.org/2001/XMLSchema", "element");
QDomElement typeElement = typeElementNodeList.at(0).toElement();
complexTypeType = typeElement.attribute("type");
QDomElement complexTypeElement; //the <complexType> element corresponding to the feature type

if(complexTypeType.isEmpty())
{
return 3;
}
//find out, on which lines the first <element> or the first <complexType> occur. If <element> occurs first (mapserver), read the type of the relevant <complexType> tag. If <complexType> occurs first (geoserver), search for information about the feature type directly under this first complexType element

int firstElementTagPos = schemaElement.elementsByTagNameNS("http://www.w3.org/2001/XMLSchema", "element").at(0).toElement().columnNumber();
int firstComplexTypeTagPos = schemaElement.elementsByTagNameNS("http://www.w3.org/2001/XMLSchema", "complexType").at(0).toElement().columnNumber();

//remove the namespace on complexTypeType
if(complexTypeType.contains(":"))
if(firstComplexTypeTagPos < firstElementTagPos)
{
complexTypeType = complexTypeType.section(":", 1, 1);
//geoserver
complexTypeElement = schemaElement.elementsByTagNameNS("http://www.w3.org/2001/XMLSchema", "complexType").at(0).toElement();
}

//find <complexType name=complexTypeType
QDomElement complexTypeElement;
QDomNodeList complexTypeNodeList = schemaElement.elementsByTagNameNS("http://www.w3.org/2001/XMLSchema", "complexType");
for(int i = 0; i < complexTypeNodeList.length(); ++i)
else
{
if(complexTypeNodeList.at(i).toElement().attribute("name") == complexTypeType)
//UMN mapserver
QString complexTypeType;
QDomNodeList typeElementNodeList = schemaElement.elementsByTagNameNS("http://www.w3.org/2001/XMLSchema", "element");
QDomElement typeElement = typeElementNodeList.at(0).toElement();
complexTypeType = typeElement.attribute("type");

if(complexTypeType.isEmpty())
{
complexTypeElement = complexTypeNodeList.at(i).toElement();
break;
return 3;
}

//remove the namespace on complexTypeType
if(complexTypeType.contains(":"))
{
complexTypeType = complexTypeType.section(":", 1, 1);
}

//find <complexType name=complexTypeType
QDomNodeList complexTypeNodeList = schemaElement.elementsByTagNameNS("http://www.w3.org/2001/XMLSchema", "complexType");
for(int i = 0; i < complexTypeNodeList.length(); ++i)
{
if(complexTypeNodeList.at(i).toElement().attribute("name") == complexTypeType)
{
complexTypeElement = complexTypeNodeList.at(i).toElement();
break;
}
}
}

0 comments on commit a7f69c6

Please sign in to comment.
You can’t perform that action at this time.