Class: XSD::Include
- Inherits:
-
BaseObject
- Object
- BaseObject
- XSD::Include
- Defined in:
- lib/xsd/objects/include.rb
Overview
The include element is used to add multiple schemas with the same target namespace to a document. Parent elements: schema www.w3schools.com/xml/el_include.asp
Constant Summary
Constants inherited from BaseObject
BaseObject::NO_ATTRIBUTES_CONTAINER, BaseObject::NO_ELEMENTS_CONTAINER, BaseObject::XML_SCHEMA
Instance Attribute Summary collapse
-
#schema_location ⇒ Object
Required.
Attributes inherited from BaseObject
Instance Method Summary collapse
-
#imported_schema ⇒ Object
Get imported schema.
Methods inherited from BaseObject
#[], #collect_attributes, #collect_elements, #documentation, #documentation_for, #get_prefix, #initialize, #inspect, #map_child, #map_children, #namespaces, #node, #node_to_object, #nodes, #object_by_name, #parent, #reader, #schema, #schemas_for_namespace, #strip_prefix
Constructor Details
This class inherits a constructor from XSD::BaseObject
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class XSD::BaseObject
Instance Attribute Details
#schema_location ⇒ Object
Required. Specifies the URI to the schema to include in the target namespace of the containing schema
11 |
# File 'lib/xsd/objects/include.rb', line 11 property :schemaLocation, :string |
Instance Method Details
#imported_schema ⇒ Object
Get imported schema
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/xsd/objects/include.rb', line 15 def imported_schema # cache included schema locally as it has no unique namespace to check in global registry return @imported_schema if @imported_schema xml = reader.resource_resolver.call(schema_location) new_schema = reader.add_schema_xml(xml) unless schema.target_namespace == new_schema.target_namespace raise ImportError, 'Schema targetNamespace does not match included schema targetNamespace' end @imported_schema = new_schema end |