-
Notifications
You must be signed in to change notification settings - Fork 7
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
Easier Interface for Creating XML Documents? #25
Comments
I just realized it's not released, but on main there is a simpler syntax https://github.com/JuliaComputing/XML.jl?tab=readme-ov-file#writing-element-nodes-with-xmlh Is that sufficient for you? I'll get a release out soon. |
Could you point me at the source code for Thanks. |
There's not much to add. The example demonstrates this:
Here's the source: Line 174 in 11a6a55
|
I was hoping to have a fast XML creator with low allocation... but It has been really tough try to understand the API. Headache. Hope you can give more details or examples. |
It's unfrtunate that there are no doc strings and the examples in the README aren't general enough. I just updated what version of XML.jl I'm using and I wanted to give the new Note that
I have no clue why the document isn't getting written properly. It works in my package code. I'll leave that to the folks who are paid to work on this package. |
@MarkNahabedian Almost there! You don't need to wrap children in a using XML
using XML: h
doc = h.html(
h.head(
h.title("My Document")
),
h.body(
h.h1("My Document"),
h.p("This is a paragraph."; class="MaybeStyyles"),
h.ul(
h.li("Item 1"),
h.li("Item 2")
)
)
)
XML.write(doc) Frankly I don't understand what's missing from the README example (https://github.com/JuliaComputing/XML.jl?tab=readme-ov-file#writing-element-nodes-with-xmlh) that makes this unclear, but I'll try to improve it. @eoteroe In general, please make actionable requests (e.g. what part of the API is hard to understand?). I'll close this issue as the original comment has been addressed. Open new issues for any additional problems you encounter.
I should clarify here: Nobody is paid to work on this. I wrote XML.jl to tangentially support some paid work, but it wasn't necessary to do so. I simply wanted the project to be 100% Julia and the XML parser was the only non-Julia part. Maintaining XML.jl and the other packages I've written under the JuliaComputing org are (typically) outside of my duties at the company. It's just that me (and many others at JuliaHub) enjoy doing open source work on the side. |
Thanks Josh.
On May 21, 2024 10:16 AM, Josh Day ***@***.***> wrote:
@MarkNahabedian<https://github.com/MarkNahabedian> Almost there! You don't need to wrap children in a Vector.
using XML
using XML: h
doc = h.html(
h.head(
h.title("My Document")
),
h.body(
h.h1("My Document"),
h.p("This is a paragraph."; class="MaybeStyyles"),
h.ul(
h.li("Item 1"),
h.li("Item 2")
)
)
)
XML.write(doc)
Frankly I don't understand what's missing from the README example (https://github.com/JuliaComputing/XML.jl?tab=readme-ov-file#writing-element-nodes-with-xmlh) that makes this unclear, but I'll try to improve it.
@eoteroe<https://github.com/eoteroe> In general, please make actionable requests (e.g. what part of the API is hard to understand?).
I'll close this issue as the original comment has been addressed. Open new issues for any additional problems you encounter.
…________________________________
I'll leave that to the folks who are paid to work on this package.
I should clarify here: Nobody is paid to work on this. I wrote XML.jl to tangentially support some paid work, but it wasn't necessary to do so. I simply wanted the project to be 100% Julia and the XML parser was the only non-Julia part. Maintaining XML.jl and the other packages I've written under the JuliaComputing org are (typically) outside of my duties at the company. It's just that me (and many others at the company) enjoy doing open source work on the side.
—
Reply to this email directly, view it on GitHub<#25 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AIBY3E23FM4A3SFUETHY6VDZDNJM3AVCNFSM6AAAAABH5LM62WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMRSG42DEOBVGY>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
I use XML.jl to construct HTML files and SVG graphics programatically. I've found using just the XML.jl constructors to be cumbersome though.
It's a hack, but for several of my projects I've defined
https://github.com/MarkNahabedian/SquareDanceReasoning.jl/blob/main/src/xml/elt.jl.
the function
elt
allows using nesting of expressions to nest elements and attributes. It also exploitsdo
syntax to allow one to run additional code that adds elements and attributes if one can't wedge them into the expression hierarchy.I was wondering if XML.jl might eventually adopt some easier way to construct and nest XML elements. I don't think my implementation linked above has a clean enough interface for general use, but I have found it very convenient.
Thanks.
The text was updated successfully, but these errors were encountered: