New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

xsd_model

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xsd_model

  • 0.7.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

XsdModel Build Status

Schema Definition (XSD) parser.

Content:

  1. About
  2. Usage
  3. License

About

XsdModel parses a XML Schema Definition (XSD) and returns tree structure of objects representing XSD nodes. Each object implements specific API simplify the work with XSD.

Usage

Basics

Suppose you have following schema in a schema.xsd file:

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:element name="note">
  <xs:complexType>
    <xs:sequence>
      <xs:element name="to" type="xs:string"/>
      <xs:element name="from" type="xs:string"/>
      <xs:element name="heading" type="xs:string"/>
      <xs:element name="body" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>
</xs:element>

</xs:schema>

To parse it:

require('xsd_model')
raw = File.read('schema.xsd')
xsd = XsdModel.parse(raw)
#=> #<XsdModel::Elements::Document:0x000056471a3b7cb8
#@children=
# [#<XsdModel::Elements::Schema:0x000056471a4659a8
#   @children=
#    [#<XsdModel::Elements::Text:0x000056471a4307d0>,
#     #<XsdModel::Elements::Element:0x000056471a400dc8
#      @children=
#       [#<XsdModel::Elements::Text:0x000056471a3b3898>,
#        #<XsdModel::Elements::ComplexType:0x000056471a403668
#         @children=
#          [#<XsdModel::Elements::Text:0x000056471a3b2a10>,
#           #<XsdModel::Elements::Sequence:0x000056471a3d8ff8
#            @children=
#             [#<XsdModel::Elements::Text:0x000056471a3b19f8>,
#              #<XsdModel::Elements::Element:0x000056471a3b0cd8>,
#              #<XsdModel::Elements::Text:0x000056471a3c71b8>,
#              #<XsdModel::Elements::Element:0x000056471a3c62b8>,
#              #<XsdModel::Elements::Text:0x000056471a3c54f8>,
#              #<XsdModel::Elements::Element:0x000056471a3c47b0>,
#              #<XsdModel::Elements::Text:0x000056471a3dbaa0>,
#              #<XsdModel::Elements::Element:0x000056471a3da830>,
#              #<XsdModel::Elements::Text:0x000056471a3d9930>]>,
#           #<XsdModel::Elements::Text:0x000056471a403cf8>]>,
#        #<XsdModel::Elements::Text:0x000056471a4014a8>]>,
#     #<XsdModel::Elements::Text:0x000056471a4660b0>],
#   >],
#>

TODO

  • basic parsing
  • ignore option
  • collect only option
  • basic api - children, attributes, namespaces
  • navigation shorthands(#elements)
  • imports
  • includes
  • Schema api
  • comparison

...

License

The gem is available as open source under the terms of the MIT License.

FAQs

Package last updated on 20 Oct 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc