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 -->

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.

License

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

Share

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

 
GeneralMy vote of 5 Pinmemberfredatcodeproject29-Feb-12 4:30 
Generalproper function applied ;) Pinmemberandrei_teodorescu18-May-11 23:51 
GeneralYou totally rock! PinmemberKim Finleyson14-Aug-08 12:03 
QuestionWhat about an XML list of world countries? PinmemberJesse Sedwick2-Jul-08 10:37 
Generalthanx Pinmembersuniltauro5-Oct-07 6:15 
thanx a lot for this list
 
ST
QuestionI need some type of state list and more importantly, a city list Pinmembertejas559-Sep-07 19:27 
GeneralAWESOME Pinmemberregwood7927-Oct-06 10:01 
GeneralThanks! Pinmemberlexzxzx24-Apr-06 18:05 
GeneralCapitals PinsussAnonymous21-Oct-02 4:34 
GeneralRe: Capitals PinsussAnonymous16-Apr-04 4:31 

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.141220.1 | Last Updated 18 Feb 2002
Article Copyright 2002 by Jason Gerard
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid