Click here to Skip to main content
15,867,686 members
Articles / Programming Languages / XML
Article

State names and abbrev in XML

Rate me:
Please Sign up or sign in to vote.
4.80/5 (15 votes)
17 Feb 2002BSD 98.2K   2.2K   15   10
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:

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

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

License

This article, along with any associated source code and files, is licensed under The BSD License


Written By
Founder
United States United States
I've been coding professionally since 1998, staring with VB5/6, Classic ASP, and C++ with MFC/ATL. Since then I've done Java, C#/.NET, Node, Python, and Go. Currently I focus on containerization and cloud migrations.

Comments and Discussions

 
GeneralMy vote of 5 Pin
fredatcodeproject29-Feb-12 3:30
professionalfredatcodeproject29-Feb-12 3:30 
Generalproper function applied ;) Pin
andrei_teodorescu18-May-11 22:51
andrei_teodorescu18-May-11 22:51 
GeneralYou totally rock! Pin
Kim Finleyson14-Aug-08 11:03
Kim Finleyson14-Aug-08 11:03 
QuestionWhat about an XML list of world countries? Pin
Jesse Sedwick2-Jul-08 9:37
Jesse Sedwick2-Jul-08 9:37 
Generalthanx Pin
suniltauro5-Oct-07 5:15
suniltauro5-Oct-07 5:15 
QuestionI need some type of state list and more importantly, a city list Pin
tejas559-Sep-07 18:27
tejas559-Sep-07 18:27 
GeneralAWESOME Pin
regwood7927-Oct-06 9:01
regwood7927-Oct-06 9:01 
GeneralThanks! Pin
lexzxzx24-Apr-06 17:05
lexzxzx24-Apr-06 17:05 
GeneralCapitals Pin
Anonymous21-Oct-02 3:34
Anonymous21-Oct-02 3:34 
GeneralRe: Capitals Pin
Anonymous16-Apr-04 3:31
Anonymous16-Apr-04 3:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.