Skip to content

Commit

Permalink
fix doctest, skip validation for gx:CascadingStyle
Browse files Browse the repository at this point in the history
  • Loading branch information
cleder committed Nov 12, 2024
1 parent 3a5d706 commit e3aecf9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions docs/working_with_kml.rst
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,14 @@ And register the new element with the KML Document object:
The CascadingStyle object is now part of the KML document and can be accessed like any
other element.
Now we can create a new KML object and confirm that the new element is parsed correctly:
When parsing the document we have to skip the validation as the ``gx:CascadingStyle`` is
not in the XSD Schema.

Create a new KML object and confirm that the new element is parsed correctly:

.. code-block:: pycon
>>> cs_kml = KML.parse("examples/gx_cascading_style.kml")
>>> cs_kml = KML.parse("examples/gx_cascading_style.kml", validate=False)
>>> cs = find(cs_kml, of_type=CascadingStyle)
>>> cs.style # doctest: +ELLIPSIS
fastkml.styles.Style(...
Expand All @@ -181,7 +184,7 @@ Now we can remove the CascadingStyle from the document and have a look at the re
.. code-block:: pycon
>>> document.gx_cascading_style = []
>>> print(document.to_string(prettyprint=True))
>>> print(document)
<kml:Document xmlns:kml="http://www.opengis.net/kml/2.2">
<kml:name>Test2</kml:name>
<kml:StyleMap id="__managed_style_0D301BCC0014827EFCCB">
Expand Down

0 comments on commit e3aecf9

Please sign in to comment.