-
Notifications
You must be signed in to change notification settings - Fork 209
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
Add XML fragment parsing to xml5ever #271
Comments
(Digression)
What? Why delete the repository? A number of existing links are gonna be broken :/
|
(Digression)
I was doing some spring cleaning and removing repositories I didn't need. I wasn't aware there were _any_ links to it.
I'll fix any breakage if possible. The only issue I see is xml5ever Travis badge. Unless there are some invisible Git links. |
(Digression)
The code and git history lives on, but a *github* repository also houses a pull request and issue tracker. These contain discussion of why things were done they way they were. For example https://github.com//issues/266 links to https://github.com/Ygg01/xml5ever/issues/30. These discussions can still be relevant later.
That’s how the web works. Everything has an URL, and someone doesn’t need to tell you when they start using that URL somewhere. This is why cool URLs don’t change. |
(Digression)
What can I say - Mea culpa. I'll keep that in mind in future.
|
Sorry for going off-topic. Back to the actual issue, is an actual |
(Digression)
No worries, you were right about it. It was a foolish decision on my part.
-------
If I understood spec correctly when it says:
That means function parsing XML fragment needs pairs of To answer the question, I don't think it's necessary to send a |
Ah, I see. The part I was missing is that the "starting point" of |
I think the question that remains is
fn parse_fragment<Sink>(mut sink: Sink, opts: ParseOpts,
context_name: StrTendril, context_namespace: NamespaceMap)
-> Parser<Sink>
fn parse_fragment<Sink>(mut sink: Sink, opts: ParseOpts,
context_name: IntoIter<(Prefix, Namespace)>,
default_namespace: Option<Namespace>)
-> Parser<Sink>
fn parse_fragment<Sink>(mut sink: Sink, opts: ParseOpts,
context_name: IntoIter<(Option<prefix>, ns_url)>)
-> Parser<Sink>
|
In https://github.com/servo/servo/blob/master/components/selectors/parser.rs#L106-L113 fn default_namespace(&self) -> Option<<Self::Impl as SelectorImpl>::NamespaceUrl> {
None
}
fn namespace_for_prefix(&self, _prefix: &<Self::Impl as SelectorImpl>::NamespacePrefix)
-> Option<<Self::Impl as SelectorImpl>::NamespaceUrl> {
None
} ( |
Maybe not. Servo does not use I don’t know if there is a use for fragment parsing outside of a browser engine. To the extend that Servo is the only user, there is no need to spend too much time working on a nice API that minimize the amount of user code. I’m considering removing |
Is there any progress or plan? From the above discussion, I understand that only a Maybe I will work on this, in order to implement |
Dunno. I had some plans but they have fallen down to the wayside due to RL issues and other projects. You can have a crack at it. It's not super complicated, but also not super newbie-friendly. |
Since I deleted the xml5ever repostiory, I've decided to move this issue here. This was a feature @nox asked, and it seems that it's a pain point in servo as well see servo/servo#11995.
The algorithm for parsing xml fragment is in HTML5 spec.
Basically, what's needed is to construct a
context
element with given name, aNamespaceMap
, and input string.It's advised to use
parse_fragment
from h5e as reference point.The text was updated successfully, but these errors were encountered: