-
Notifications
You must be signed in to change notification settings - Fork 44
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
Make sax_ltx recognize CDATA #51
Conversation
@swissmanu what your use case? IIRC CDATA isn't XMPP valid |
ltx isn't limited to XMPP |
@astro true but if there is very low demand on ltx for non-XMPP usage I'd be very careful about adding this. ltx is grrrreat but there might be better alternative out there for non-XMPP. (maybe not, no idea) |
I've always reached out to ltx for any XML parsing needs. The API feels incredibly intuitive, having designed it myself. :-P |
Thank you for your responses 👍 I got into this problem when tinker with the XMPP server of Logitechs Harmony hub (a small device that emits IR and radio commands to your entertainment system) My intention was to extend |
So, there are XMPP implementations that use CDATA? I vote for ignoring all specifications and implementing this. |
@astro I don't think that is what @swissmanu is suggesting. He's saying that if |
Maybe we should have |
@sonnyp that sounds like a good compromise as long as i'm allowed to interchange them as a like since i have the situation where a an xmpp server emits a CDATA. |
Personally I don't think mixing xmpp specific stuff into ltx is worthwhile, it should just be a generic xml parser/builder. If people have cdata in their stanzas then that's up to them :) |
@lloydwatkin parsing XML 1.1 and CDATA has a performance impact and in 99% cases you don't need those for XMPP where it's not standard. @swissmanu you could use the sax_saxjs.js parser (you'll probably need to map more events) Overall I don't really see the point in re-writting a XML 1.1 compliant sax JS parser as sax-js seems to do the job pretty well. |
Ahh sorry, wasn't aware of the performance impact!
|
closing this due to inactivity. @swissmanu if you still have interest in this I'll accept the PR if you copy current sax_ltx to sax_xmpp or something like that |
aaaah totally missed your reply @sonnyp. i'll revise my change and integrate it into |
I was wrong, cdata is XMPP compliant (and probably a must have for node-xmpp). @swissmanu no need to create a new parser, just rebase your PR / fix tests |
github doesn't allow me to re-open the PR, @swissmanu I believe you'll have to create a new one |
} else { | ||
recordStart = undefined | ||
state = STATE_IGNORE_TAG | ||
} |
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.
what do you think about the implementation? i dont like the way how i had to implement the look ahead for detecting CDATA at all. any other ideas?
I get the feeling but I like how it doesn't interfere too much with the rest of the code. 👍 and maybe we can come up with a more 'elegant' solution to this in the future.
@swissmanu your PR was rebased by @timdp Released as |
as suggested by issue #19, this PR introduces correct CDATA parsing for
sax_ltx
. unit test is available.what do you think about the implementation? i dont like the way how i had to implement the look ahead for detecting CDATA at all. any other ideas?