Book Image

Programming ArcGIS with Python Cookbook, Second Edition

By : Eric Pimpler
Book Image

Programming ArcGIS with Python Cookbook, Second Edition

By: Eric Pimpler

Overview of this book

The book kicks off with the fundamentals of starting to use Python with ArcGIS, followed by recipes on managing map documents and layers, including how to find and fix broken data links in these files. In the second part of the book, you will learn to create custom geoprocessing tools and how to use the Attribute and Location tools to select specific features. The third part of the book covers topics for advanced users including the REST API, and also teaches you how to use Python with ArcGIS Pro. The book finishes with appendices covering how to automate Python scripts, and the five things that should be at the back of every GIS programmer's mind.
Table of Contents (17 chapters)
16
Index

Reading XML files

XML files were designed as a way to transport and store data. They are platform-independent since the data is stored in a plain text file. Although similar to HTML, XML differs from HTML since the former is designed for display purposes, whereas XML data is designed for data. XML files are sometimes used as an interchange format for GIS data that is going between various software systems.

Getting ready

XML documents have a tree-like structure that is composed of a root element, child elements, and element attributes. Elements are also called nodes. All XML files contain a root element. This root element is the parent to all other elements or child nodes. The following code example illustrates the structure of an XML document. Unlike HTML files, XML files are case sensitive:

<root>
 <child att="value">
 <subchild>.....</subchild>
 </child>
</root>

Tip

Python provides several programming modules that you can use to process XML files...