Selecting a particular element
-
<USA> <State> <Name>Alabama</Name> <Counties> <1>Autauga <2>Baldwin <3>Barbour </Counties> </State> <State> <Name>Alaska</Name> <1>Aleutians East <2>Aleutians West <3>Anchorage Friends this my Xml file I had attached all States names to DropdownList And My problem is when particular state is selected in Dropdown list how can I retrive Counties to a particular state plse suggest me an example
came out of hardwork
-
<USA> <State> <Name>Alabama</Name> <Counties> <1>Autauga <2>Baldwin <3>Barbour </Counties> </State> <State> <Name>Alaska</Name> <1>Aleutians East <2>Aleutians West <3>Anchorage Friends this my Xml file I had attached all States names to DropdownList And My problem is when particular state is selected in Dropdown list how can I retrive Counties to a particular state plse suggest me an example
came out of hardwork
The structure of your XML is flawed. It should look something like this:
<usa> <state name="Alabama"> <county name="Autauga"/> <county name="Baldwin"/> <county name="Barbour"/> </state> <state name="Alaska"> <county name="Aluetians East"/> <county name="Aluetians West"/> <county name="Anchorage"/> </state> </usa>
With this structure, when a state is choosen you can use the XPath:
/usa/state[@name='Alaska']/county/@name
"We make a living by what we get, we make a life by what we give." --Winston Churchill
-
The structure of your XML is flawed. It should look something like this:
<usa> <state name="Alabama"> <county name="Autauga"/> <county name="Baldwin"/> <county name="Barbour"/> </state> <state name="Alaska"> <county name="Aluetians East"/> <county name="Aluetians West"/> <county name="Anchorage"/> </state> </usa>
With this structure, when a state is choosen you can use the XPath:
/usa/state[@name='Alaska']/county/@name
"We make a living by what we get, we make a life by what we give." --Winston Churchill
Thak u for ur suggestion
came out of hardwork