Sha256: 317a2f96abcf8b08fae1fd6a9b6f511ae6c515a10c68f858554c79e5cd662627
Contents?: true
Size: 815 Bytes
Versions: 30
Compression:
Stored size: 815 Bytes
Contents
require 'junoser/xsd/complex_type' require 'junoser/xsd/element' require 'nokogiri' module Junoser module Xsd module Parsable def to_config rule = "rule(:#{self['name'].underscore}) do\n" case name when 'complexType' rule << Junoser::Xsd::ComplexType.new(self, depth: 1).to_s when 'element' rule << Junoser::Xsd::Element.new(self, depth: 1).content else raise "ERROR: unknown element: #{name}" end rule << "\nend\n\n" end def remove_unused xpath('/xsd:schema/*[self::xsd:import]').remove xpath('//xsd:element[@ref="undocumented" or @ref="junos:comment" or @name="apply-advanced"]').remove self end end end end Nokogiri::XML::Element.include Junoser::Xsd::Parsable
Version data entries
30 entries across 30 versions & 1 rubygems