Package sld :: Class SLDNode
[hide private]
[frames] | no frames]

Class SLDNode

source code


A base class for all python objects that relate directly to SLD elements. An SLDNode contains references to the underlying parent node, underlying element node, and the namespace map.

The SLDNode base class also contains utility methods to construct properties for child SLDNode objects.

Instance Methods [hide private]
 
__init__(self, parent, descendant=True)
Create a new SLDNode.
source code
SLDNode
get_or_create_element(self, ns, name)
Attempt to get the only child element from this SLDNode.
source code
SLDNode
create_element(self, ns, name)
Create an element as a child of this SLDNode.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Static Methods [hide private]
property attribute
makeproperty(ns, cls=None, name=None, docstring='', descendant=True)
Make a property on an instance of an SLDNode.
source code
Class Variables [hide private]
  _nsmap = {'sld': "http://www.opengis.net/sld", 'ogc': "http://...
Defined namespaces in SLD documents.
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, parent, descendant=True)
(Constructor)

source code 

Create a new SLDNode. It is not necessary to call this directly, because all child classes should initialize the SLDNode internally.

Parameters:
  • parent (SLDNode) - The parent class object.
  • descendant (boolean) - Does this element descend from the parent, or is it a sibling?
Overrides: object.__init__

makeproperty(ns, cls=None, name=None, docstring='', descendant=True)
Static Method

source code 

Make a property on an instance of an SLDNode. If cls is omitted, the property is assumed to be a text node, with no corresponding class object. If name is omitted, the property is assumed to be a complex node, with a corresponding class wrapper.

Parameters:
  • ns (string) - The namespace of this property's node.
  • cls (class) - Optional. The class of the child property.
  • name (string) - Optional. The name of the child property.
  • docstring (string) - Optional. The docstring to attach to the new property.
  • descendant (boolean) - Does this element descend from the parent, or is it a sibling?
Returns: property attribute
A property attribute for this named property.

get_or_create_element(self, ns, name)

source code 

Attempt to get the only child element from this SLDNode. If the node does not exist, create the element, attach it to the DOM, and return the class object that wraps the node.

Parameters:
  • ns (string) - The namespace of the new element.
  • name (string) - The name of the new element.
Returns: SLDNode
The wrapped node, in the parent's property class. This will always be a descendent of SLDNode.

create_element(self, ns, name)

source code 

Create an element as a child of this SLDNode.

Parameters:
  • ns (string) - The namespace of the new element.
  • name (string) - The name of the new element.
Returns: SLDNode
The wrapped node, in the parent's property class. This will always be a descendent of SLDNode.

Class Variable Details [hide private]

_nsmap

Defined namespaces in SLD documents.

Value:
{'sld': "http://www.opengis.net/sld", 'ogc': "http://www.opengis.net/o\
gc", 'xlink': "http://www.w3.org/1999/xlink", 'xsi': "http://www.w3.or\
g/2001/XMLSchema-instance"}