I do not really understand this case. It is supposed to get the list of layers by parsing the GetCapabilities document with a real XML parser, but text search with a well selected string can work as well.
It is also possible to use some utilities like ogrinfo
ogrinfo WFS:"https://data.wien.gv.at/daten/geo?version=2.0.0&service=WFS&request=GetCapabilities"
Ogrinfo finds 335 feature Types. But there are really 339 complexType elements in the DescribeFeatureType response. This is one that appears only in DescribeFeatureType:
<xsd:complexType name="PLANUNGASTOGDType">
<xsd:complexContent>
<xsd:extension base="gml:AbstractFeatureType">
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="OBJECTID" nillable="false" type="xsd:decimal"/>
<xsd:element maxOccurs="1" minOccurs="0" name="SHAPE" nillable="true" type="gml:GeometryPropertyType"/>
<xsd:element maxOccurs="1" minOccurs="0" name="NAME" nillable="true" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="0" name="QUELLE" nillable="true" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="0" name="FERTIG" nillable="true" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="0" name="STAND" nillable="true" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="0" name="SE_ANNO_CAD_DATA" nillable="true" type="xsd:hexBinary"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
I tried GetFeature with this "extra" feature type but it fails maybe due to timeout.
https://data.wien.gv.at/daten/geo?version=2.0.0&service=WFS&request=GetFeature&typeNames=PLANUNGASTOGD
The server still believes that it could do something with that feature type, because a type name like "PLANUNGASTOGDfoo" yields an error message Feature type :PLANUNGASTOGDfoo unknown
.
I would say that the WFS server at data.wien.gv.at is now somehow misconfigured. Maybe they have removed 4 feature types from the service but for some reason the server has not removed them from DescribeFeatureType. I would contact the service provider and report the issue. As an answer to your original question, GetCapabilities is the right document for counting the number of feature types.