Ejemplo n.º 1
0
 def set_mapping(self, mapping):
     # First, record the namespace and prefix, if necessary.
     xml_ns = mapping.configuration.get_option(XML_NAMESPACE_OPTION)
     if not xml_ns is None:
         xml_prefix = mapping.configuration.get_option(XML_PREFIX_OPTION)
         if not xml_prefix is None:
             ns = self.__ns_map.get(xml_prefix)
             if ns is None:
                 # New prefix - register.
                 self.__ns_map[xml_prefix] = xml_ns
             elif xml_ns != ns:
                 raise ValueError('Prefix "%s" is already registered for '
                                  'namespace %s.' % (xml_prefix, ns))
         # Make sure we rebuild the lookup.
         if not self.__ns_lookup is None:
             self.__ns_lookup = None
     MappingRegistry.set_mapping(self, mapping)
Ejemplo n.º 2
0
Archivo: xml.py Proyecto: b8va/everest
 def set_mapping(self, mapping):
     # First, record the namespace and prefix, if necessary.
     xml_ns = mapping.configuration.get_option(XML_NAMESPACE_OPTION)
     if not xml_ns is None:
         xml_prefix = mapping.configuration.get_option(XML_PREFIX_OPTION)
         if not xml_prefix is None:
             ns = self.__ns_map.get(xml_prefix)
             if ns is None:
                 # New prefix - register.
                 self.__ns_map[xml_prefix] = xml_ns
             elif xml_ns != ns:
                 raise ValueError('Prefix "%s" is already registered for '
                                  'namespace %s.' % (xml_prefix, ns))
         # Make sure we rebuild the lookup.
         if not self.__ns_lookup is None:
             self.__ns_lookup = None
     MappingRegistry.set_mapping(self, mapping)
Ejemplo n.º 3
0
 def __init__(self):
     MappingRegistry.__init__(self)
     self.__ns_map = self.__class__.NS_MAP.copy()
     self.__ns_lookup = None
Ejemplo n.º 4
0
Archivo: xml.py Proyecto: b8va/everest
 def __init__(self):
     MappingRegistry.__init__(self)
     self.__ns_map = self.__class__.NS_MAP.copy()
     self.__ns_lookup = None