Skip to content
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

multi_xml tests fails since ox 2.4.13 #179

Closed
valtri opened this issue May 18, 2017 · 5 comments
Closed

multi_xml tests fails since ox 2.4.13 #179

valtri opened this issue May 18, 2017 · 5 comments

Comments

@valtri
Copy link
Contributor

valtri commented May 18, 2017

Hi,

multi_xml testuite fails since ox 2.4.13. The commit causing it is 238607c (later there has been changed default options for skip mode in ox, which fixed two errors in multi_xml, but one error still remains).

I guess the problem is in different behavior between ox 2.4.11 and 2.4.13 of this:

#! /usr/bin/ruby
require 'ox'
p Ox.parse("<tag>\n </tag>")

The failing multi_xml test (it somehow interprets the yaml part, so I think the problem are vanished the \n characters):

#! /usr/bin/ruby
require 'multi_xml'
xml = "<tag type=\"yaml\">--- \n1: returns an integer\n:message: Have a nice day\narray: \n- has-dashes: true\n  has_underscores: true\n</tag>"
p MultiXml.parse(xml, :disallowed_types => [])['tag']

I don't know, if this is a problem in ox or not.

@ohler55
Copy link
Owner

ohler55 commented May 18, 2017

There is an Ox option for what to do with white space. Look at the :skip option.

@valtri
Copy link
Contributor Author

valtri commented May 18, 2017

So it is issue at multi_xml part and there should be added :skip => :skip_none in sax_parse() call. I've tested it works!

If I understand correctly, it was better to use this option also before ox 2.4.13?

What puzzles me this doesn't work: (maybe I'm using it wrong?)

Ox.default_options[:skip] = :skip_none
p Ox.parse("<tag>\n </tag>")

But this is not related to the problem with multi_xml.

@ohler55
Copy link
Owner

ohler55 commented May 18, 2017

The correct approach to setting the defaults is

Ox.default_options = { skip: :skip_none }

@valtri
Copy link
Contributor Author

valtri commented May 18, 2017

Thanks!

Sent pull-request to multi_xml: sferik/multi_xml#60

@valtri valtri closed this as completed May 18, 2017
@ohler55
Copy link
Owner

ohler55 commented May 18, 2017

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants