我正在尝试为Geocoder API中使用的Go生成数据类型。
类型应该在XSD方案中定义,可以在以下位置找到:https : //geocoder.api.here.com/6.2/xsd/LBSP-Search-Search.xsd
但是,当我开始将xsd方案与文档进行比较时,xsd似乎并不正确。
文档:https : //developer.here.com/documentation/geocoder/topics/resource-type-response-geocode.html
该文档为我提供了这种结构:
"Response" of type SearchResponseType
- "MetaInfo" of type SearchResponseMetaInfoType
- "View" of type SearchResultsViewType
- "ViewID"
- "PerformedSearch"
- "Results" of type SearchResultType
另一方面,XSD方案为我提供了这一点:
"Response" of type SearchResponseType
- "MetaInfo" of type SearchResponseMetaInfoType
- "View" of type SearchResponseViewType
- "ViewId" of type int
- "Label" of type string
如果我是正确的话,View
in SearchResponseType
应该是SearchResultsViewType
。将SearchResultsViewType
在XSD方案定义,但从未使用过。
的SearchResponseViewType
在XSD是一个abstract
类型,因此不能在响应XML直接使用。在SearchResultsViewType
从派生SearchResponseViewType
抽象类型。这就是为什么您看到SearchResultsViewType
而不是SearchResponseViewType
在文档中看到的原因。