Title: DoD Per Diem Rates with XML Schema
1DoD Per Diem Rates with XML Schema
Ken Sall http//kensall.com/gov/perdiem XML WG
Registry and Repository Meeting May 21, 2003
2Demo Goals
- Convert ASCII files to XML instances
- Generate XML Schema based on one instance
- Refine XML Schema by adding types
- Validate instances against XML Schema
- Use XSLT to convert XML to HTML for display
(server-side and client-side)
3DoD Per Diem Rates Tables
- Available as semi-colon delimited ASCII files
- Connow.txt - Includes Military Installations
1136 entries - Conusnm.txt - No Military Installations 690
entries - Conusmil.txt - Military Installations only 446
entries
4Semi-Colon Delimited ASCII
CONUSALL PLACES NOT LISTED(FOR ALASKA HAWAII
SEE APP B)01/0112/315528188501/01/2000 ALA
BAMAANNISTON ARMY DEPOTCALHOUN01/0112/315528
188501/01/2000 ALABAMABESSEMER NAVAL MC
RES CTRJEFFERSON01/0112/3159402410110/01/2
002 ALABAMABIRMINGHAMJEFFERSON01/0112/31594
02410110/01/2002 ALABAMADANNELLY FIELD
AGSMONTGOMERY01/0112/315740249910/01/2002
ALABAMADECATURMORGAN01/0112/316932201031
0/01/2002 ALABAMAFT. MCCLELLANCALHOUN01/0112/
315528188501/01/2000 ALABAMAFT.
RUCKERDALE01/0112/315528188501/01/2000 AL
ABAMAGADSDEN NAVAL RESERVE CTRCALHOUN01/0112/3
15528188501/01/2000 ALABAMAGULF
SHORESBALDWIN05/1509/04101362213910/01/200
2 ALABAMAGULF SHORESBALDWIN09/0505/1464362
210210/01/2002 ALABAMAHUNTSVILLEMADISON01/01
12/3167362210510/01/2002 ALABAMAMAXWELL
AFBMONTGOMERY01/0112/315740249910/01/2002
5Convert ASCII Files to XML Instances
- XML Spy reads delimited files and lets you assign
element names
6- ltPerDiemRates xmlnsxsi"http//www.w3.org/2001/
XMLSchema-instance" xsinoNamespaceSchemaLocation
"PerDiem.xsd"gt - ltRowgt - ltRowgt
ltStategtALABAMAlt/Stategt ltLocalityOrCitygtANNISTON
ARMY DEPOTlt/LocalityOrCitygt
ltCountygtCALHOUNlt/Countygt ltSeasonBegingt01/01lt/Se
asonBegingt ltSeasonEndgt12/31lt/SeasonEndgt
ltMaxLodginggt55lt/MaxLodginggt ltNoGovernmentMealsgt
28lt/NoGovernmentMealsgt ltProportionalMealsgt18lt/P
roportionalMealsgt ltMaxPerDiemRategt85lt/MaxPerDie
mRategt ltEffectiveDategt01/01/2000lt/EffectiveDate
gt lt/Rowgt - ltRowgt ltStategtALABAMAlt/Stategt
ltLocalityOrCitygtBESSEMER NAVAL MC RES
CTRlt/LocalityOrCitygt ltCountygtJEFFERSONlt/Countygt
7Generate XML Schema
- Based on single XML instance
- Uses enumerations to constrain numbers
- Other two instances fail to validate with this
generated schema - Could prevent the enumerated constraints
8 lt!-- W3C Schema generated by XMLSPY v5 rel. 2
(http//www.xmlspy.com) --gt - ltxsschema
xmlnsxs"http//www.w3.org/2001/XMLSchema"
elementFormDefault"qualified"gt ltxselement
name"County" type"xsstring" /gt - ltxselement
name"EffectiveDate"gt - ltxssimpleTypegt -
ltxsrestriction base"xsstring"gt
ltxsenumeration value"01/01/1999" /gt
ltxsenumeration value"01/01/2000" /gt
ltxsenumeration value"01/01/2002" /gt
ltxsenumeration value"01/15/2003" /gt
ltxsenumeration value"07/15/2002" /gt
ltxsenumeration value"07/21/2000" /gt
ltxsenumeration value"09/01/2000" /gt
ltxsenumeration value"09/01/2002" /gt
ltxsenumeration value"10/01/2000" /gt
ltxsenumeration value"10/01/2001" /gt
ltxsenumeration value"10/01/2002" /gt
ltxsenumeration value"11/08/2002" /gt
ltxsenumeration value"12/15/2002" /gt
lt/xsrestrictiongt lt/xssimpleTypegt
lt/xselementgt
9(No Transcript)
10(No Transcript)
11(No Transcript)
12Refine XML Schema
- Consider all 3 XML instances, looking at range of
data - Define data types
- Date formats (not same as xsddate)
- Restricted integer ranges
- Discovered 4 irregularities in per diem data
- 3 counties missing (one file had delimiters, one
did not) - 1 rate (out of 1136 times 4) contained decimal
value all others were integers
13- ltxssimpleType name"SeasonType"gt -
ltxsrestriction base"xsstring"gt ltxspattern
value"\d2/\d2" /gt lt/xsrestrictiongt
lt/xssimpleTypegt - ltxssimpleType
name"DateType"gt - ltxsrestriction
base"xsstring"gt ltxspattern
value"\d2/\d2/\d4" /gt
lt/xsrestrictiongt lt/xssimpleTypegt -
ltxssimpleType name"Under500Type"gt -
ltxsrestriction base"xsdouble"gt
ltxsminInclusive value"25" /gt
ltxsmaxInclusive value"500" /gt
lt/xsrestrictiongt lt/xssimpleTypegt
ltxselement name"County" type"xsstring" /gt
ltxselement name"EffectiveDate" type"DateType"
/gt
ltxselement name"MaxPerDiemRate"
type"Under500Type" /gt
14Irregular Data Missing County
15Use XSLT to Display as HTML
16XSLT with Sort by Rate
17Next Steps Pending GSA Direction
- Contact DoD about data irregularities
- Make element names ISO/IEC 11179-compliant
- Contribute to Registry
- Consider creating Web services to
- Retrieve entire table
- Retrieve one entry based on location
18(No Transcript)