Comments (2)
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.
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)
- Check performance HOT 4
- Add a changelog HOT 1
- Check Configuration class for useless functionality
- Update XmlBuilder to use REXML class HOT 4
- Drop support ruby 1.9.3 HOT 1
- Can't specify adapter in config block HOT 2
- dependencies fails HOT 2
- Delegation removes functionality of 'is_a?' and 'kind_of?' HOT 2
- Release new version. HOT 3
- Problem when passing String element to activeRecord.find_by HOT 4
- Slice does not work on HashElements HOT 2
- Ox SAX Parser not Raising Errors HOT 9
- Slow performance of lamdas HOT 1
- Space in node parsed as empty hash? Can this be changed to string, or nil? HOT 15
- can't convert Saxerator::Builder::StringElement to Array HOT 4
- Does it help to parse large size xml? HOT 1
- How can I get a count of ? HOT 1
- What have to be done for 1.0.0 release? HOT 3
- Output encoding HOT 1
- Optional errors HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from saxerator.