Class: WSDL::QName Private

Inherits:
Data
  • Object
show all
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

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#localObject (readonly)

Returns the value of attribute local



11
12
13
# File 'lib/wsdl/qname.rb', line 11

def local
  @local
end

#namespaceObject (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.

Raises:

  • (ArgumentError)


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_sString

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