这是我的general.xml
文件:general.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<results xmlns="http://gisgraphy.com">
<numFound>1</numFound>
<QTime>67</QTime>
<result>
<distance>1139.81967842778</distance>
<name>Rājkot</name>
<adm1Code>09</adm1Code>
<adm1Name>State of Gujarāt</adm1Name>
<asciiName>Rajkot</asciiName>
<countryCode>IN</countryCode>
<featureClass>P</featureClass>
<featureCode>PPL</featureCode>
<featureId>1258847</featureId>
<gtopo30>139</gtopo30>
<population>1177362</population>
<timezone>Asia/Kolkata</timezone>
<lat>22.299999237060547</lat>
<lng>70.78333282470703</lng>
<placeType>City</placeType>
<oneWay>false</oneWay>
<length>0.0</length>
<google_map_url>http://maps.google.com/maps?f=q&amp;ie=UTF-8&amp;iwloc=addr&amp;om=1&amp;z=12&amp;q=R%C4%81jkot&amp;ll=22.329999237060548,70.78333282470703</google_map_url>
<yahoo_map_url>http://maps.yahoo.com/broadband?mag=6&amp;mvt=m&amp;lon=70.78333282470703&amp;lat=22.299999237060547</yahoo_map_url>
<country_flag_url>/images/flags/IN.png</country_flag_url>
</result>
</results>
这是我的region.xml
文件:
<childrens>
<child_4893 entity_id="4893" value="Gujarat" parent_id="4823">
<child_4894 entity_id="4894" value="Ahmedabad" parent_id="4893"/>
<child_4895 entity_id="4895" value="Anand" parent_id="4893"/>
<child_4896 entity_id="4896" value="Bharuch (Broach)" parent_id="4893"/>
<child_4897 entity_id="4897" value="Bhavnagar" parent_id="4893"/>
<child_4898 entity_id="4898" value="Bhuj" parent_id="4893"/>
<child_4899 entity_id="4899" value="Gandhidham" parent_id="4893"/>
<child_4900 entity_id="4900" value="Gandhinagar" parent_id="4893"/>
<child_4901 entity_id="4901" value="Godhra" parent_id="4893"/>
<child_4902 entity_id="4902" value="Jamnagar" parent_id="4893"/>
<child_4903 entity_id="4903" value="Junagadh" parent_id="4893"/>
<child_4904 entity_id="4904" value="Morvi" parent_id="4893"/>
<child_4905 entity_id="4905" value="Nadiad" parent_id="4893"/>
<child_4906 entity_id="4906" value="Navsari" parent_id="4893"/>
<child_4907 entity_id="4907" value="Patan" parent_id="4893"/>
<child_4908 entity_id="4908" value="Porbandar" parent_id="4893"/>
<child_4909 entity_id="4909" value="Rajkot" parent_id="4893"/>
<child_4910 entity_id="4910" value="Surat" parent_id="4893"/>
<child_4911 entity_id="4911" value="Surendranagar" parent_id="4893"/>
<child_4912 entity_id="4912" value="Vadodara (Baroda)" parent_id="4893"/>
<child_4913 entity_id="4913" value="Vejalpur" parent_id="4893"/>
<child_4914 entity_id="4914" value="Veraval" parent_id="4893"/>
</child_4893>
</childrens>
这是我的product.xml
文件:
<products>
<product_id value="1">
<tab_id>
<tab_name value="test1" />
<dist_region value="4909"/>
<dist_region value="4909"/>
<dist_region value="4909"/>
</tab_id>
</product_id>
</products>
解释
- 在
general.xml
文件中有一个名为 的节点元素<name>
,它是一个store-city
名称。 - 检查该城市名称是否存在于
region.xml
文件中,复制对应entity_id
的 . - 检查文件中是否
entity_id
存在,如果存在则product.xml
返回相应的product_id
。
例如:
<name>Rajkot</name>
取自_general.xml
Rajkot
存在于region.xml
且对应entity_id
的是4909
entity_id
值4909
存在于product.xml
且对应的product_id
属性值为1
- 返回
product_id
值1