Expand|Select|Wrap|Line Numbers
- # Import system modules
- import sys, string, os, xml.dom.minidom
- from xml.dom.minidom import parse, parseString
- metadata_xml_file = "C:\\Temp\\county_simp2.shp.xml"
- parseXMLdoc = parse(metadata_xml_file)
- elements = parseXMLdoc.getElementsByTagName("abstract")
- xValue = elements[3].attributes['abstract'].value
- print xValue
- ##openFile = open(metadata_xml_file, "r")
- ##
- ##line = openFile.readline()
- ##
- ##checkList = ["abstract", "purpose", "origin", "pubdate", "current", "caldate", "progress", "update"]
- ##
- ##print checkList[0]
- ####
- ##while line:
- ## if checkList[0] in line:
- ## while ("/" + checkList[0]) not in line:
- ## start, end = line.find(">"), line.find("<")
- ## value = line[start+1:end]
- ##
- ## if value == "":
- ## print checklist[0] + " item has no value!"
- ##
- ## if value == "REQUIRED:":
- ## print checklist[0] + " item must be chnaged!"
- ##
- ##
- print "done!"
**[HTML]
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
- <metadata>
- <Esri>
<CreaDate>20070606</CreaDate>
<CreaTime>11054200</CreaTime>
<SyncOnce>FALSE</SyncOnce>
<SyncDate>20081119</SyncDate>
<SyncTime>14174300</SyncTime>
<ModDate>20081119</ModDate>
<ModTime>14192600</ModTime>
- <DataProperties>
- <lineage>
<Process Name="SimplifyPolygon_1" ToolSource="C:\Program Files\ArcGIS\ArcToolbox\Toolboxes\Data Management Tools.tbx\SimplifyPolygon" Date="20060623" Time="111251">SimplifyPolygon COUNTY C:\projects\SP6\district_gen.mdb\COUNTY_SimplifyPo lygon POINT_REMOVE "0.0003 DecimalDegrees" "0 Unknown" PRESERVE_SHARED NO_KEEP C:\projects\SP6\district_gen.mdb\COUNTY_SimplifyPo lygon_Pnt</Process>
<Process Name="FeatureClassToFeatureClass_1" ToolSource="F:\Program Files\ArcGIS\ArcToolbox\Toolboxes\Conversion Tools.tbx\FeatureClassToFeatureClass" Date="20060624" Time="120113">Connections\Connection to jenner.phsc.esri.com.sde\TRACKING.COUNTY_SIMP"</Process>
<Process Name="FeatureClassToFeatureClass_1" ToolSource="C:\Program Files\ArcGIS\ArcToolbox\Toolboxes\Conversion Tools.tbx\FeatureClassToFeatureClass" Date="20070605" Time="103617">"C:\Documents and Settings\jenn5214\My Documents\Projects\sweat reports\features\county_simp.shp"</Process>
<Process Name="Project_11" ToolSource="C:\Program Files\ArcGIS\ArcToolbox\Toolboxes\Data Management Tools.tbx\Project" Date="20070606" Time="110543">Project "C:\Documents and Settings\jenn5214\My Documents\Projects\SWEAT reports\features\county_simp.shp"</Process>
</lineage>
</DataProperties>
<MetaID>{A0F30B95-144D-495E-B754-5EA3274FFBD1}</MetaID>
</Esri>
- <idinfo>
<native Sync="TRUE">Microsoft Windows XP Version 5.1 (Build 2600) Service Pack 2; ESRI ArcCatalog 9.2.5.1450</native>
- <descript>
<langdata Sync="TRUE">en</langdata>
<abstract>test jenn added wed</abstract>
<purpose>REQUIRED: A summary of the intentions with which the data set was developed.</purpose>
</descript>
- <citation>
- <citeinfo>
<origin>REQUIRED: The name of an organization or individual that developed the data set.</origin>
<pubdate>REQUIRED: The date when the data set is published or otherwise made available for release.</pubdate>
<title Sync="TRUE">county_simp2</title>
<ftname Sync="TRUE">county_simp2</ftname>
<geoform Sync="TRUE">vector digital data</geoform>
<onlink Sync="TRUE">\\JDUERR\C$\Documents and Settings\jenn5214\My Documents\Projects\SWEAT reports\features\county_simp2.shp</onlink>
</citeinfo>
</citation>
...
[/HTML]