rng_file = ro_database.get_handler(rng_file, RelaxNGFile) namespaces = rng_file.get_namespaces() # Apply the metadata for uri, element_name in inline_elements: element = namespaces[uri].get_element_schema(element_name) element.is_inline = True for uri, element_name in skip_content_elements: element = namespaces[uri].get_element_schema(element_name) element.skip_content = True for uri, element_name in unknown_elements: elements = namespaces[uri].elements if element_name in elements: raise ValueError, 'element "%s" is defined twice' % element_name elements[element_name] = ElementSchema(element_name, default_datatype=String) for uri, element_name, context in contexts: element = namespaces[uri].get_element_schema(element_name) element.context = context # The namespaces fo and svg have two names fo_uri_2 = 'http://www.w3.org/1999/XSL/Format' duplicate_ns(namespaces, fo_uri, fo_uri_2) svg_uri_2 = 'http://www.w3.org/2000/svg' duplicate_ns(namespaces, svg_uri, svg_uri_2) # Register the namespaces for uri, namespace in namespaces.iteritems(): if not has_namespace(uri): register_namespace(namespace)
rng_file = ro_database.get_handler(rng_file, RelaxNGFile) namespaces = rng_file.get_namespaces() # Apply the metadata for uri, element_name in inline_elements: element = namespaces[uri].get_element_schema(element_name) element.is_inline = True for uri, element_name in skip_content_elements: element = namespaces[uri].get_element_schema(element_name) element.skip_content = True for uri, element_name in unknown_elements: elements = namespaces[uri].elements if element_name in elements: raise ValueError, 'element "%s" is defined twice' % element_name elements[element_name] = ElementSchema(element_name, default_datatype=String) for uri, element_name, context in contexts: element = namespaces[uri].get_element_schema(element_name) element.context = context # The namespaces fo and svg have two names fo_uri_2 = 'http://www.w3.org/1999/XSL/Format' duplicate_ns(namespaces, fo_uri, fo_uri_2) svg_uri_2 = 'http://www.w3.org/2000/svg' duplicate_ns(namespaces, svg_uri, svg_uri_2) # Register the namespaces for uri, namespace in namespaces.iteritems(): if not has_namespace(uri): register_namespace(namespace)
def auto_register(self): for uri, namespace in self.namespaces.iteritems(): if not has_namespace(uri): register_namespace(namespace)
def auto_register(self): for uri, namespace in self.namespaces.iteritems(): if not has_namespace(uri): register_namespace(namespace)