Class: WSDL::QName Private
- Inherits:
-
Data
- Object
- Data
- WSDL::QName
- Defined in:
- lib/wsdl/qname.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Represents a fully qualified XML name (QName).
A QName consists of a namespace URI and a local name. This value object is used as a stable collection key across imported documents and for resolving type/element/attribute references in schemas.
Instance Attribute Summary collapse
-
#local ⇒ Object
readonly
Returns the value of attribute local.
-
#namespace ⇒ Object
readonly
Returns the value of attribute namespace.
Class Method Summary collapse
-
.document_namespace(root) ⇒ String?
private
Returns the effective namespace for top-level WSDL components.
-
.parse(qname, namespaces:, default_namespace: nil) ⇒ QName
private
Parses a lexical QName into a fully qualified name.
Instance Method Summary collapse
-
#to_s ⇒ String
private
Returns a readable representation used in errors.
Instance Attribute Details
#local ⇒ Object (readonly)
Returns the value of attribute local
11 12 13 |
# File 'lib/wsdl/qname.rb', line 11 def local @local end |
#namespace ⇒ Object (readonly)
Returns the value of attribute namespace
11 12 13 |
# File 'lib/wsdl/qname.rb', line 11 def namespace @namespace end |
Class Method Details
.document_namespace(root) ⇒ String?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the effective namespace for top-level WSDL components.
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/wsdl/qname.rb', line 17 def document_namespace(root) namespace = root['targetNamespace'] return namespace if namespace && !namespace.empty? raise UnresolvedReferenceError.new( 'WSDL definitions element is missing required targetNamespace', reference_type: :namespace, reference_name: root.name, context: 'wsdl:definitions' ) end |
.parse(qname, namespaces:, default_namespace: nil) ⇒ QName
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Parses a lexical QName into a fully qualified name.
35 36 37 38 39 40 41 42 |
# File 'lib/wsdl/qname.rb', line 35 def parse(qname, namespaces:, default_namespace: nil) raise ArgumentError, 'QName must be a non-empty String' unless qname.is_a?(String) && !qname.empty? local, prefix = split(qname) namespace = prefix ? namespaces["xmlns:#{prefix}"] : namespaces['xmlns'] || default_namespace new(namespace, local) end |
Instance Method Details
#to_s ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a readable representation used in errors.
61 62 63 64 65 |
# File 'lib/wsdl/qname.rb', line 61 def to_s return local unless namespace "{#{namespace}}#{local}" end |