Python geoLink Formatter
  • Module geolink_formatter
  • Module geolink_formatter.entity
  • Module geolink_formatter.format
  • Module geolink_formatter.parser
    • XML
Python geoLink Formatter

    license build status coverage report python version format status

  • »
  • Module geolink_formatter.parser

Module geolink_formatter.parser¶

XML¶

class geolink_formatter.parser.XML(host_url=None, version='1.2.2', dtd_validation=False, xsd_validation=True)[source]¶

Bases: object

Create a new XML parser instance containing the geoLink XSD for validation.

Parameters:
  • host_url (str) – URL of the OEREBlex host to resolve relative URLs. The complete URL until but without the /api part has to be set, starting with http:// or https://.
  • version (str) – The version of the geoLink schema to be used. Defaults to 1.2.0.
  • dtd_validation (bool) – Enable/disable validation of document type definition (DTD). Optional, defaults to False.
  • xsd_validation (bool) – Enable/disable validation against XML schema (XSD). Optional, defaults to True.
from_string(xml)[source]¶

Parses XML into internal structure.

The specified XML string is gets validated against the geoLink XSD on parsing.

Parameters:xml (str or bytes) – The XML to be parsed.
Returns:A list containing the parsed document elements.
Return type:list[geolink_formatter.entity.Document]
Raises:lxml.etree.XMLSyntaxError – Raised on failed validation.
from_url(url, params=None, **kwargs)[source]¶

Loads the geoLink of the specified URL and parses it into the internal structure.

Parameters:
  • url (str) – The URL of the geoLink to be parsed.
  • params (dict) – Dictionary or bytes to be sent in the query string for the requests.models.Request.
  • **kwargs – Optional arguments that requests.api.request takes.
Returns:

A list containing the parsed document elements.

Return type:

list[geolink_formatter.entity.Document]

Raises:
  • lxml.etree.XMLSyntaxError – Raised on failed validation.
  • requests.HTTPError – Raised on failed HTTP request.
host_url¶

str – The OEREBlex host URL to resolve relative URLs.

Previous

© Copyright 2017, Amt für Geoinformation, Kanton Basel-Landschaft.

Built with Sphinx using a theme provided by Read the Docs.
Fork me on Fork me on GitLab GitLab
Other Versions v: v1.0.0
Tags
v2.0.1
v2.0.0
v1.5.4
v1.5.3
v1.5.2
v1.5.1
v1.5.0
v1.4.0
v1.3.1
v1.3.0
v1.2.0
v1.1.2
v1.1.1
v1.1.0
v1.0.0
Branches
master