Add description collected onto xsd node onto XMLElement

authorSylvain Thénault <sylvain.thenault@logilab.fr>
changeset19aac3e93bcb
branchdefault
phasepublic
hiddenno
parent revision#8f60b7a3f080 Keeps documentation defined in the XML Schema
child revision#845365d54c6a Prepare 0.2.0
files modified by this revision
pyxst/xml_struct/graph.py
pyxst/xml_struct/graph_nodes.py
# HG changeset patch
# User Sylvain Thénault <sylvain.thenault@logilab.fr>
# Date 1507550560 -7200
# Mon Oct 09 14:02:40 2017 +0200
# Node ID 19aac3e93bcbbf70b014dc7965ed596d6b4359b7
# Parent 8f60b7a3f080322b01222e13604f6e92cf2490c9
Add description collected onto xsd node onto XMLElement

diff --git a/pyxst/xml_struct/graph.py b/pyxst/xml_struct/graph.py
@@ -235,11 +235,12 @@
1                  if parent_elt is not None:
2                      gr_elt.add_parent_elt(parent_elt)
3                  return gr_elt
4          # Creates the new graph element
5          gr_elt = XMLElement(xsd_elt.name,
6 -                            (xsd_elt in self._high_level_elts))
7 +                            (xsd_elt in self._high_level_elts),
8 +                            desc= xsd_elt.desc,)
9          if parent_elt is not None:
10              gr_elt.add_parent_elt(parent_elt)
11          # Adds the element in the list of elements and in the index
12          self.elements.append(gr_elt)
13          self._elts_def_index.setdefault(xsd_elt.name, [])
diff --git a/pyxst/xml_struct/graph_nodes.py b/pyxst/xml_struct/graph_nodes.py
@@ -619,11 +619,11 @@
14         :class:`~pyxst.xml_struct.graph_nodes.Occurence` indexed
15         with :class:`unicode`.
16 
17      .. automethod:: __init__
18      """
19 -    def __init__(self, qname, is_high_level=False):
20 +    def __init__(self, qname, is_high_level=False, desc=None):
21          """
22          Initializes a new XML element.
23 
24          :param qname:
25              Qualified name of the XML node (namespace + local
@@ -636,10 +636,11 @@
26          :type is_high_level:
27              :class:`bool`
28          """
29          super(XMLElement, self).__init__(qname)
30          self.is_high_level = is_high_level
31 +        self.desc = desc
32          self.content_type = UNKNOWN
33          self.content = None
34          self.attributes = {}
35          # The two following attributes are used for analyzing a library of XML
36          # documents whose structure is given by the graph. They are used to