-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
XSD parser using LutaML-Model #2
Conversation
lib/lutaml/xsd/element.rb
Outdated
|
||
map_attribute :name, to: :name | ||
map_attribute :type, to: :type | ||
map_element :annotation, to: :annotation, namespace: "http://www.w3.org/2001/XMLSchema", prefix: "xsd" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find it strange that we need to repeat the namespace in every single element. Instead, we should respect the default namespace of the element, and only override it with a nil prefix if we want no namespace?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add additional fixtures and test against round-tripping? One of the next steps is to handle the “imports”.
For additional XSD files, try the MathML one, the NIST Metaschema one and the OGC GML one. |
spec/spec_helper.rb
Outdated
@@ -13,3 +15,9 @@ | |||
c.syntax = :expect | |||
end | |||
end | |||
|
|||
def to_xml(parsed_schema, escape_content_tags: false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@suleman-uzair can you see if the xml-c14n
gem helps? We want to share code across all of these gems. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you see if the xml-c14n gem helps?
@ronaldtse I have replaced equivalent-xml
with xml-c14n
gem, it works fine but the gsub!
used in this method is still needed though.
The reason for using gsub
is that when using map_all
to process documentation
tags in the schema that contain elements (tags), it is treated as text, which converts <
and >
to <
and >
, respectively, causing a failure in the matcher.
@suleman-uzair could you please help resolve the conflict with the gemspec file and we can merge this? Thanks! |
8a4c0f9
to
4c86de0
Compare
lib/lutaml/xsd/xsd.rb
Outdated
module_function | ||
|
||
def parse(xsd) | ||
Lutaml::Model::Config.xml_adapter_type = :nokogiri |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do not need to set the adapter inside every method call this can be done outside the method.
This PR adds XSD parsing support using LutaML-Model.
closes #1