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

Explicit namespace support for as-hickory for XML #29

Closed
lvh opened this issue Sep 23, 2015 · 2 comments
Closed

Explicit namespace support for as-hickory for XML #29

lvh opened this issue Sep 23, 2015 · 2 comments
Labels
status: dubious Where do I even begin? type: feature request Feature requests

Comments

@lvh
Copy link

lvh commented Sep 23, 2015

Right now, when you parse some XML (using e.g. the open PR, or just DOMParser), and then as-hiccup it, you turn something like this:

<?xml version="1.0"?>
<soap:Envelope
    xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
    soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">

    <soap:Body
        xmlns:m="http://www.example.org/stock">
        <m:GetStockPrice>
            <m:StockName>RAX</m:StockName>
        </m:GetStockPrice>
    </soap:Body>

</soap:Envelope>

... and turns it into:

bubbles.xml-test> (h/as-hiccup (bx/parse-xml soap-request))
([:soap:envelope
  {:xmlns:soap "http://www.w3.org/2001/12/soap-envelope",
   :soap:encodingstyle "http://www.w3.org/2001/12/soap-encoding"}
  "\n\n    "
  [:soap:body
   {:xmlns:m "http://www.example.org/stock"}
   "\n        "
   [:m:getstockprice {} "\n            " [:m:stockname {} "RAX"] "\n        "]
   "\n    "]
  "\n\n"])

... or with as-hickory:

bubbles.xml-test> (h/as-hickory (bx/parse-xml soap-request))
{:type :document,
 :content
 [{:type :element,
   :attrs
   {:xmlns:soap "http://www.w3.org/2001/12/soap-envelope",
    :soap:encodingstyle "http://www.w3.org/2001/12/soap-encoding"},
   :tag :soap:envelope,
   :content
   ["\n\n    "
    {:type :element,
     :attrs {:xmlns:m "http://www.example.org/stock"},
     :tag :soap:body,
     :content
     ["\n        "
      {:type :element,
       :attrs nil,
       :tag :m:getstockprice,
       :content
       ["\n            "
        {:type :element, :attrs nil, :tag :m:stockname, :content ["RAX"]}
        "\n        "]}
      "\n    "]}
    "\n\n"]}]}

You'll notice that in both hiccup and hickory mode, the tags are something like :m:getstockprice. That's unfortunate, because if the XML namespaces change name, an identical document will parse quite differently. I'm not sure how to "fix" this though.

@davidsantiago
Copy link
Collaborator

Hickory has never had support for XML. I'm not against it, I just don't know XML well enough to think through all these ins and outs. So unfortunately I'm not surprised that sending XML through it isn't a smooth process. I am pretty sure the Hickory data format is missing features that are needed to express the fullness of XML, one of which you've flagged here. If I had a better understanding of the issues I might be able to offer some advice here.

@port19x port19x mentioned this issue Apr 11, 2023
@port19x
Copy link
Contributor

port19x commented Apr 11, 2023

Closing, as rejected as per #22

@port19x port19x closed this as not planned Won't fix, can't repro, duplicate, stale Apr 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: dubious Where do I even begin? type: feature request Feature requests
Projects
None yet
Development

No branches or pull requests

3 participants