outputting all info from child nodes



I need to output all the information from a nodes children that are not empty.


What I have currently(not working): Country/State/cities/city[string-length() != 0]/


Each city element has 4 child nodes: name, population, size, foundingDate.


I need to print all info for all the cities of all the states, but only the values that aren't null.


Odd sounding, I know.


What would be the proper way to do this?


EDIT: This is how the xml is formed. (I had written the path line above wrong, but fixed it.) Of course there are multiple State and City elements.



<Country>
<State>
<Name>stateName</name>
<Cities>
<City>
<Name>cityName</Name>
<Population>popNum</Population>
<Size>citySize</Size>
<foundingDate>foundingYear</foundingDate>
</City>
</Cities>
</State>
</Country>


The objective is to output all the City info for the Country that does not have empty values. (The xml value isn't completed, but still needs to be searched.


No comments:

Post a Comment