65.9K
CodeProject is changing. Read more.
Home

State names and abbrev in XML

starIconstarIconstarIconstarIcon
emptyStarIcon
starIcon

4.80/5 (14 votes)

Feb 18, 2002

BSD
viewsIcon

99645

downloadIcon

2225

An XML file containing US state and territory names and their two letter abbreviation.

Introduction

I figured this could come in handy to anyone who needed it so I just threw it together. I got tired of not having a list of states. I so often have to implement a dropdown or validate an input that takes an abbreviation and always have to get the information from some website that has a similar list. So this time I finally got smart and made an XML file out of it. I got the information from the USPS website.

The file uses a very simple structure:

<states>
  <state name="ALABAMA" abbreviation="AL" /> 
  <state name="ALASKA" abbreviation="AK" /> 
  ...
</states>

That's all there is to it. Hope you find this useful.