19.1.55. camcops_server.cc_modules.cc_xml¶
Copyright (C) 2012-2018 Rudolf Cardinal (rudolf@pobox.com).
This file is part of CamCOPS.
CamCOPS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
CamCOPS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with CamCOPS. If not, see <http://www.gnu.org/licenses/>.
-
class
camcops_server.cc_modules.cc_xml.
XmlElement
(name: str, value: Any = None, datatype: str = None, comment: str = None)[source]¶ Represents XML data in a tree. See functions in cc_xml.py
-
camcops_server.cc_modules.cc_xml.
get_xml_blob_element
(name: str, blobdata: Union[bytes, NoneType], comment: str = None) → camcops_server.cc_modules.cc_xml.XmlElement[source]¶ Returns an XmlElement representing a base-64-encoded BLOB.
-
camcops_server.cc_modules.cc_xml.
get_xml_datatype_from_sqla_column
(column: sqlalchemy.sql.schema.Column) → Union[str, NoneType][source]¶ Returns the XML schema datatype from an SQLAlchemy Column.
-
camcops_server.cc_modules.cc_xml.
get_xml_datatype_from_sqla_column_type
(coltype: sqlalchemy.sql.type_api.TypeEngine) → str[source]¶ Returns the XML schema datatype from an SQLAlchemy column type, such as Integer.
-
camcops_server.cc_modules.cc_xml.
get_xml_document
(root: camcops_server.cc_modules.cc_xml.XmlElement, indent_spaces: int = 4, eol: str = '\n', include_comments: bool = False) → str[source]¶ Returns an entire XML document as text, given the root XmlElement.
-
camcops_server.cc_modules.cc_xml.
get_xml_tree
(element: Union[camcops_server.cc_modules.cc_xml.XmlElement, camcops_server.cc_modules.cc_simpleobjects.XmlSimpleValue, str, List[Union[camcops_server.cc_modules.cc_xml.XmlElement, camcops_server.cc_modules.cc_simpleobjects.XmlSimpleValue, str]]], level: int = 0, indent_spaces: int = 4, eol: str = '\n', include_comments: bool = False) → str[source]¶ Returns an entire XML tree as text, given the root XmlElement.
-
camcops_server.cc_modules.cc_xml.
make_xml_branches_from_columns
(obj, skip_fields: List[str] = None) → List[camcops_server.cc_modules.cc_xml.XmlElement][source]¶ Returns a list of XML branches, each an XmlElement, from an object, using the list of SQLAlchemy Column objects that define/describe its fields.
-
camcops_server.cc_modules.cc_xml.
make_xml_branches_from_summaries
(summaries: List[SummaryElement], skip_fields: List[str] = None, sort_by_name: bool = True) → List[camcops_server.cc_modules.cc_xml.XmlElement][source]¶ Returns a list of XML branches, each an XmlElement, from a list of summary data provided by a task.