Skip to content

Commit

Permalink
2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ekzobrain committed Jul 10, 2023
1 parent 9b9dc65 commit 2c1327b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
## [Unreleased]

## [2.1.0] - 2023-07-10

- Add support for <xs:include> element
- Changed method "schema_for_namespace(namespace) -> XSD::Schema" signature to "schemas_for_namespace(namespace) -> Array<XSD::Schema>"

## [2.0.0] - 2023-07-07

- Change XSD::XML.new(file, **options) -> XSD::XML.open(file, **options)
Expand Down
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,29 @@ require 'xsd'
# Load ruby-xsd
reader = XSD::XML.open('some.xsd')

# Get elements and their child elements
element = reader['NewReleaseMessage']
element.collect_elements.map(&:name) # => ['MessageHeader', 'UpdateIndicator', 'IsBackfill', 'CatalogTransfer', 'WorkList', 'CueSheetList', 'ResourceList', 'CollectionList', 'ReleaseList', 'DealList']

# Get attributes
attribute = reader['NewReleaseMessage']['@MessageSchemaVersionId']

# Get atrribute information
# Get attribute information
attribute.name # => 'MessageSchemaVersionId'
attribute.type # => 'xs:string'
attribute.required? # => true
attribute.optional? # => false
attribute.prohibited? # => true

# Get element information
element = reader['NewReleaseMessage']['ResourceList']['SoundRecording']
element = reader['NewReleaseMessage']['ResourceList']['SoundRecording'] # => XSD::Element
element.min_occurs # => 0
element.max_occurs # => :unbounded
element.type # => 'ern:SoundRecording'
element.complex_type # => XSD::ComplexType
element.complex? # => true
element.multiple_allowed? # => true
element.required? # => false
```

## Development
Expand Down
2 changes: 1 addition & 1 deletion lib/xsd/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module XSD
VERSION = '2.0.0'
VERSION = '2.1.0'
end

0 comments on commit 2c1327b

Please sign in to comment.