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

[SR-11608] XMLParser is missing a function to insert new chunk of data to parse #3383

Open
swift-ci opened this issue Oct 13, 2019 · 3 comments

Comments

@swift-ci
Copy link
Contributor

Previous ID SR-11608
Radar None
Original Reporter mremond (JIRA User)
Type Improvement
Additional Detail from JIRA
Votes 0
Component/s Foundation
Labels Improvement
Assignee None
Priority Medium

md5: 6f396923a1fdc684da1df03d58fab156

Issue Description:

Hello,

I am in the process of moving my XMPP library implementation from libxml2 to XMLParser.
One of the feature I am missing currently is the ability to start the parser in a non blocking way, and be able to inject the data to the parser as they are received.

It is possible to implement that having a custom InputStream in between, to bridge what I receive from the network to the XMLParser. However, to implement it nicely with SwiftNIO non blocking approach, it would be better to let SwiftNIO receiver inject the data in the parser as they are received.
Without that feature, one thread would be blocked on the XMLParser.parse() call until the end of the XMPP session, which is not efficient.

Would such a feature be more widely interesting?
Would a patch / Pull Request implementing such a feature be considered for integration?

Thanks!

@swift-ci
Copy link
Contributor Author

Comment by Mickaël Rémond (JIRA)

Possibly, changing access restriction of `parseData(_ data: Data) -> Bool` to public may be enough to support that use case.

@belkadan
Copy link

Note: I don't work on Foundation myself, but the need for parity between the corelibs and Apple implementations is likely to make this take a lot more consideration than otherwise. (As in, the feature can't be added to corelibs Foundation unless it's also added to Apple OS Foundation, which is not open source.)

@swift-ci
Copy link
Contributor Author

Comment by Mickaël Rémond (JIRA)

Thanks. That’s what I guess, that’s why I am asking for a bit of guidance on how I could best help.
I am not in hurry, but I think this change would make the framework better, as it will free a thread on the client and would make it possible to implement an XMPP server based on such a XML stream parsing lib.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants