module documentation
XML namespace manager.
Manage XML namespaces.
Function | clarkify |
Returns an XML name in the Clark notation. |
Function | declarations |
Returns an xmlns declaration block as dictionary of attributes. |
Function | find |
Locate the Namespace by an Uri. |
Function | find |
Locate the Namespace by a name. |
Function | get |
Undocumented |
Function | parse |
Undocumented |
Function | qualify |
Qualifies an XML name. |
Function | register |
Register a Namespace. |
Function | split |
Parses an XML name. |
Function | unqualify |
Removes the default namespace prefx. |
Function | unqualify |
Returns an unqualified XML name. |
Class | _ |
Undocumented |
Function | _collect |
Undocumented |
Function | _load |
Undocumented |
Function | _parse |
Undocumented |
Constant | _INDEX |
Undocumented |
Constant | _KNOWN |
Undocumented |
Constant | _XMLNS |
Undocumented |
Constant | _XSI |
Undocumented |
Constant | _XSI |
Undocumented |
def declarations(default_ns:
t.Optional[ gws.XmlNamespace]
= None, for_element: gws.IXmlElement
= None, extra_ns: t.Optional[ list[ gws.XmlNamespace]]
= None, with_schema_locations: bool
= False) -> dict
:
(source)
¶
Returns an xmlns declaration block as dictionary of attributes.
Parameters | |
defaultt.Optional[ | Default namespace. |
forgws.IXmlElement | If given, collect namespaces from this element and its descendants. |
extrat.Optional[ | Extra namespaces to create declarations for. |
withbool | Add the "schema location" attribute. |
Returns | |
dict | A dict of attributes. |
Locate the Namespace by an Uri.
If the Uri ends with a version number, and there is no namespace for this specific Uri, try to locate a non-versioned Uri. That is, http://www.opengis.net/gml/9999 will look up for http://www.opengis.net/gml.
Parameters | |
uri:str | An Uri like http://www.opengis.net/gml. |
Returns | |
t.Optional[ | A Namespace. |
Locate the Namespace by a name.
Parameters | |
xmlns:str | A name like gml. |
Returns | |
t.Optional[ | A Namespace. |
Qualifies an XML name.
If the name contains a namespace, return as is, otherwise, prepend the namespace.
Parameters | |
name:str | An XML name. |
ns:gws.XmlNamespace | A namespace. |
replace | If true, replace the existing namespace. |
Returns | |
str | A quailified name. |
Parses an XML name.
Parameters | |
name:str | XML name. |
Returns | |
tuple[ | A tuple (xmlns, uri, proper name). |
Removes the default namespace prefx.
If the name contains the default namespace, remove it, otherwise return the name as is.
Parameters | |
name:str | An XML name. |
defaultgws.XmlNamespace | A namespace. |
Returns | |
str | The name. |