Python 2.7 has reached end of support
and will be
deprecated
on January 31, 2026. After deprecation, you won't be able to deploy Python 2.7
applications, even if your organization previously used an organization policy to
re-enable deployments of legacy runtimes. Your existing Python
2.7 applications will continue to run and receive traffic after their
deprecation date. We recommend that
you
migrate to the latest supported version of Python.
Stay organized with collections
Save and categorize content based on your preferences.
google.appengine.ext.bulkload.simplexml_connector module
Summary
Bulkloader XML reading and writing.
Handle the XML format specified in a bulkloader.yaml file.
Contents
- class google.appengine.ext.bulkload.simplexml_connector.SimpleXmlConnector(xpath_to_nodes, xml_style)source
-
Bases: google.appengine.ext.bulkload.connector_interface.ConnectorInterface
Read/write a simply-structured XML file and convert dicts for each record.
A simply-structed XML file is one where we can locate all interesting nodes
with a simple (ElementTree supported) xpath, and each node contains either
all the info we care about as child (and not grandchild) nodes with text or
as attributes.
We’ll also pass the entire node in case the developer wants to do something
more interesting with it (occasional grandchildren, parents, etc.).
This is of course a fairly expensive way to read XML–we build a DOM, then
copy parts of it into a dict. A pull model would work well with the interface
too.
- classmethod create_from_options(options, name)source
Factory using an options dictionary.
Parameters
-
options – Dictionary of options. Must contain:
* xpath_to_nodes: The xpath to select a record.
* style: ‘element_centric’ or ‘attribute_centric’
-
name – The name of this transformer, for use in error messages.
ReturnsXmlConnector connector object described by the specified options.
RaisesInvalidConfiguration – If the config is invalid.
- generate_import_record(filename, bulkload_state)source
-
Generator, yields dicts for nodes found as described in the options.
- initialize_export(filename, bulkload_state)source
-
Initialize the output file.
- write_dict(dictionary)source
-
Write one record for the specified entity.
- write_iterable_as_elements(values)source
-
Write a dict as elements, possibly recursively.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-06-16 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-06-16 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eSimpleXmlConnector\u003c/code\u003e class handles reading and writing XML data for bulk loading, specifically designed for a straightforward XML structure.\u003c/p\u003e\n"],["\u003cp\u003eIt uses an XPath to locate the relevant nodes in the XML file and converts them into dictionaries for each record.\u003c/p\u003e\n"],["\u003cp\u003eThe connector supports two XML styles: 'element_centric' and 'attribute_centric', determined by the structure of the data within the XML.\u003c/p\u003e\n"],["\u003cp\u003eIt can be created from a configuration dictionary that defines the \u003ccode\u003expath_to_nodes\u003c/code\u003e and the \u003ccode\u003estyle\u003c/code\u003e of the XML.\u003c/p\u003e\n"],["\u003cp\u003eIt functions as a connector that manages the import and export of data through the use of methods such as \u003ccode\u003egenerate_import_record\u003c/code\u003e, \u003ccode\u003ewrite_dict\u003c/code\u003e, and more.\u003c/p\u003e\n"]]],[],null,[]]