I'm about to play around with writing an XML parser for Roc. (I want to parse RSS and Atom feeds.)
My current approach is to port https://github.com/miniBill/elm-xml-parser/blob/master/src/XmlParser.elm using https://github.com/lukewilliamboswell/roc-parser.
If anyone has already worked on an XML parser or is interested in helping out, feel free to reach out. Currently I'm just toying around with it locally.
I was thinking about this just this week. I haven't started or anything. Happy to help :smiling_face:
I was just researching the license issues with porting. Do you have any ideas on that? :D Right now I'm guessing, I'll just program it from scratch, orienting myself around specs.
Otherwise, feel free to suggest how you would like to collaborate. I can't guarantee that I'll be reliably working on this, so if you're planning on writing one anyway, it might smoother if I contribute to your code? Just throwing out ideas, we'll find a way that works for us. :)
You are free to port the code as long as you include the elm-xml-parser license in your project.
Anton said:
You are free to port the code as long as you include the elm-xml-parser license in your project.
Yes, thanks. I think, it'll still be easier to do it from scratch so that we can choose our own license.
I've already started out simplifying it a lot, so that I can just parse the types of files I'm interested in. So I think this should work out.
it'll still be easier to do it from scratch so that we can choose our own license.
You can still choose your own license, you just need to have the elm-xml-parser license in your project and in any distribution (e.g. release archive).
Oh, good to know, thanks!
This kind of confusion is why I like the CC0-1.0 license :)
I started out a week ago XD using roc-parser, I didn't know about elm-xml-parser
I stopped because I couldn't figure out something about graphemes (and went down that rabbit hole) like how to use "bigger" graphemes that where not U8.
I'm not at my laptop right now but I'm curious how to solve that.
like how to use "bigger" graphemes that where not U8.
We plan to release the roc unicode package for that but I think it still needs some work.
Any tips on how to get started? How can I help?
Thanks @Ricardo Valero de la Rosa :)
The main problem I'm aware of is that all code in Scalar.roc is commented out, can you try checking if that just works when uncommented?
Graphemes and scalars got removed from Roc in PR#6395, so that may be useful to look at as well.
Ricardo Valero de la Rosa said:
I stopped because I couldn't figure out something about graphemes (and went down that rabbit hole) like how to use "bigger" graphemes that where not U8.
I'm curious what the thing was! Do you remember by any chance?
When trying to do a spec compliant parser there are other graphemes that the roc-parser wouldn't accept
For example NameChar (sorry this is the name in the spec) uses NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040]
https://www.w3.org/TR/xml/#NT-NameChar
It's dirty but I have some comments in here
https://github.com/lukewilliamboswell/roc-parser/pull/12
ah, so those would be code points - they fit in U32, and shouldn't need to go all the way to graphemes! :big_smile:
Just noticed unicode needs updating for Nat removal, I can fix that today so we can use it for xml
Specifically the CodePoint.roc parts.
I've had some fun playing around with parsing XML. The current result is here: https://github.com/j-maas/roc-xml-parser
Feel free to look around and use this code. If someone would like to just take over the code by forking, please do so!
However, Roc seems to hang when running roc test package/main.roc... Not sure what is going on.
roc test dependencies/roc-parser/pakcage/main.roc works, and from playing around with it, it seems that as soon as I import something in package/Xml.roc from the parser package it just hangs without output.
I’m not sure if it is related in your case, but if you import a package in an app module and then want to use that package in an interface module, you need to also import the module you are going to use in the app module (even if you aren’t using it there)
I only have a package, no app, and I'm exporting the module there. I'm also importing another package to be used in my module. If I remove the imports in my module, it doesn't hang.
ah this is probably the known bug about packages not being able to depend on other packages currently
For reference, I believe this is the issue with not being able to import other packages: https://github.com/roc-lang/roc/issues/5654
Last updated: Jun 16 2026 at 16:19 UTC