Changeset 4426:a63788f18c28 in livinglogic.python.xist for src/ll/xist/scripts/dtd2xsc.py

Show
Ignore:
Timestamp:
03/17/11 17:40:44 (9 years ago)
Author:
Walter Doerwald <walter@…>
Branch:
default
Message:

Full docstring for dtd2xsc. Remove docstrings from helper functions.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/ll/xist/scripts/dtd2xsc.py

    r4423 r4426  
    1111 
    1212""" 
    13 ``dtd2xsc`` is a script that helps to create XIST namespace modules from DTDs. 
     13``dtd2xsc`` is a script that helps create XIST namespace modules from DTDs. 
    1414It reads one or more DTDs and outputs a skeleton namespace module. 
    1515 
    16  
    17 ``dtd2xsc`` requires xmlproc__. 
    18  
    19 __ http://www.garshol.priv.no/download/software/xmlproc/ 
    20  
    21 For usage information type:: 
    22  
    23     $ dtd2xsc --help 
     16``dtd2xsc`` supports the following options: 
     17 
     18    ``urls`` 
     19        One or more URLs (or filenames) of DTDs to be parsed 
     20 
     21    ``-x``, ``--xmlns`` 
     22        The default namespace name. All elements that don't belong to any 
     23        namespace will be assigned to this namespace. 
     24 
     25    ``-s``, ``--shareattrs`` : ``none``, ``dupes``, ``all`` 
     26        Should attributes be shared among the elements? ``none`` means that each 
     27        element will have its own standalone :class:`Attrs` class directly derived 
     28        from :class:`ll.xist.Elements.Attrs`. For ``dupes`` each attribute that is 
     29        used by more than one element will be moved into its own :class:`Attrs` 
     30        class. For ``all`` this will be done for all attributes. 
     31 
     32    ``-m``, ``--model`` : ``no``, ``simple``, ``fullall``, ``fullonce`` 
     33        Add model information to the namespace. ``no`` doesn't add any model 
     34        information. ``simple`` only adds ``model = False`` or ``model = True`` 
     35        (i.e. only the information whether the element must be empty or not). 
     36        ``fullall`` adds a :mod:`ll.xist.sims` model object to each element class. 
     37        ``fullonce`` adds full model information to, but reuses model objects for 
     38        elements which have the same model. 
     39 
     40    ``-d``, ``--defaults`` : ``false``, ``no``, ``0``, ``true``, ``yes`` or ``1`` 
     41        Should default values for attributes specified in the DTD be added to the 
     42        XIST namespace (as the ``default`` specification in the attribute class)? 
     43 
     44    ``--duplicates`` : ``reject``, ``allow``, ``merge`` 
     45        If more that one DTD is specified on the command line, some elements 
     46        might be specified in more than one DTD. ``--duplicates`` specifies how 
     47        to handle this case: ``reject`` doesn't allow multiple element 
     48        specifications. ``allow`` allows them, but only if both specifications 
     49        are identical (i.e. have the same attributes). ``merge`` allows them and 
     50        adds the attribute specification of all element specifications to the 
     51        resulting XIST namespace. 
     52 
     53Note that ``dtd2xsc`` requires xmlproc_ to work. 
     54 
     55    .. _xmlproc: http://www.garshol.priv.no/download/software/xmlproc/ 
     56 
    2457""" 
    2558 
     
    4376 
    4477def getxmlns(dtd): 
    45     """ 
    46     Extract the value of all fixed ``xmlns`` attributes 
    47     """ 
     78    # Extract the value of all fixed ``xmlns`` attributes 
    4879    found = set() 
    4980    for elemname in dtd.get_elements(): 
     
    5990 
    6091def adddtd2xnd(ns, dtd): 
    61     """ 
    62     Append DTD information from :var:`dtd` to the :class:`xnd.Module` object 
    63     :var:`ns`. 
    64     """ 
    65  
     92    # Appends DTD information from :var:`dtd` to the :class:`xnd.Module` object 
    6693    dtd = dtdparser.load_dtd_string(dtd) 
    6794