module DDEX
Do not edit. Automatically generated by ‘rake generate:main`.
Do not edit. Automatically generated by ‘rake generate:main`.
Do not edit. Automatically generated by ‘rake generate:main`.
Do not edit. Automatically generated by ‘rake generate:main`.
Do not edit. Automatically generated by ‘rake generate:main`.
Do not edit. Automatically generated by ‘rake generate:main`.
Do not edit. Automatically generated by ‘rake generate:main`.
Do not edit. Automatically generated by ‘rake generate:main`.
Do not edit. Automatically generated by ‘rake generate:main`.
Do not edit. Automatically generated by ‘rake generate:main`.
Do not edit. Automatically generated by ‘rake generate:main`.
Do not edit. Automatically generated by ‘rake generate:main`.
Do not edit. Automatically generated by ‘rake generate:main`.
Do not edit. Automatically generated by ‘rake generate:main`.
Do not edit. Automatically generated by ‘rake generate:main`.
Do not edit. Automatically generated by ‘rake generate:main`.
Do not edit. Automatically generated by ‘rake generate:main`.
Constants
- SPECS
- VERSION
- XML_SCHEMA_INSTANCE_ATTR
- XML_SCHEMA_INSTANCE_NS
- XML_SCHEMA_INSTANCE_PREFIX
Public Class Methods
Read DDEX
metadata
Parameters¶ ↑
- xml (String|IO|path)
-
The XML to read
- options (Hash)
-
Options to control reading
Options¶ ↑
- :encoding
-
Parse
xml
using the given encoding - :version
-
Parse
xml
as the given version, this must be aMessageSchemaVersionId
inSPEC/VERSION
format; by default this will be taken from theMessageSchemaVersionId
attribute of the root element
Returns¶ ↑
DDEX::Element
subclass-
A root element, as defined by the
DDEX
spec ofxml
or the:version
option
Errors¶ ↑
DDEX::XMLLoadError
-
Problem parsing the XML or a required element is missing
DDEX::UnknownVersionError
-
The given or detected spec version is not known or supported
- ArgumentError
-
options
is not aHash
or is notnil
# File lib/ddex.rb, line 51 def self.read(xml, options = nil) # TODO: figure out what top level spec... DDEX::ERN.read(xml, options) end
# File lib/ddex.rb, line 17 def self.supported_versions SPECS.flat_map do |spec| klass = const_get(spec) klass.supported_versions.map { |v| "#{spec} #{v}" } end end
# File lib/ddex.rb, line 24 def self.supports?(name) SPECS.any? { |spec| const_get(spec).supports?(name) } end
Turn a DDEX
object into an XML string. You can also turn the object into a Hash
via to_hash.
Parameters¶ ↑
- xml (
DDEX::Element
subclass) -
The object to create XML from
- options (Hash)
-
Options to control writing
Options¶ ↑
- :schema
-
Schema URI to use in the XSI schemaLocation attribute, defaults to
DDEX::NAME.config["VER"][:schema]
whereNAME
is the spec name andVER
is the version. This is only used ifxml
is a the root node of a spec.
Returns¶ ↑
- String
-
The XML
Errors¶ ↑
- ArgumentError
-
options
is not aHash
or is notnil
, orxml
is not a subclass ofDDEX::Element
# File lib/ddex.rb, line 77 def self.write(xml, options = nil) DDEX::ERN.write(xml, options) end
Protected Instance Methods
# File lib/ddex.rb, line 82 def require_standard(name, version) root = File.dirname(File.expand_path(__FILE__)) Dir["#{root}/ddex/#{name.downcase}/v#{ version.downcase.tr(".", "") }/*.rb"].each { |path| require path } end