Git Product home page Git Product logo

Comments (2)

soulcutter avatar soulcutter commented on July 22, 2024

Thanks for submitting this. I think this is a use case where Saxerator is not-yet fully-baked. I'm still actively developing this gem, so I'll very likely use your example as a test case.

My current thinking is that I may move away from yielding a HashWithAttributes instance in favor of a class which extends a Nokogiri node class with one additional method, to_hash. That way you will be able to treat the document fragment as an xml document in its own right if you want to do something like you suggest. I have not fully thought this through yet, but it's something I'm kicking around.

To answer you question on whether or not there is an easy way to get back the HTML in your case... the answer is not right now. I hope to support this very soon - within a week I should have more to share on this.

If you have any control over the xml itself, maybe you could put it into a cdata block...

from saxerator.

soulcutter avatar soulcutter commented on July 22, 2024

This week has been incredibly busy, so I haven't gotten back around to this. I have given it some thought, though, and I think my comment at the end about the cdata block is a good point - any html document fragments within an xml document really must be inside a cdata block.

I know that you may not have much control over the source document, and the solution I'm thinking of with Saxerator is to write an accumulator that uses Nokogiri's document/node classes, which would allow you to have a better representation for that use-case... however this is a bit on the back-burner right now since the main goal of this library is xml-to-hash conversion.

I'd be willing to accept a pull request (with tests please!) if you wanted to take a crack at it.

from saxerator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.