Click here to Skip to main content
Click here to Skip to main content

State names and abbrev in XML

, 17 Feb 2002 BSD
Rate this:
Please Sign up or sign in to vote.
An XML file containing US state and territory names and their two letter abbreviation.
<!-- Add the rest of your HTML here -->


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:

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

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


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


About the Author

Jason Gerard
Web Developer 20k inc.
United States United States
I've been coding professionally since 1998. I'm proficient with C# and .NET. I used to be really good with Java and even VB! Currently, I spend most of my coding time writing JavaScript (client and server-side) and Python.
Follow on   Twitter   LinkedIn

Comments and Discussions

QuestionI need some type of state list and more importantly, a city list Pinmembertejas559-Sep-07 19:27 

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

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

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150331.1 | Last Updated 18 Feb 2002
Article Copyright 2002 by Jason Gerard
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid