<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Clojure Q&amp;A - Recent questions tagged xml</title>
<link>https://ask.clojure.org/index.php/tag/xml</link>
<description></description>
<item>
<title>clojure.data.xml.event: EndElementEvent should provide tag and location-info</title>
<link>https://ask.clojure.org/index.php/14184/clojure-data-event-endelementevent-should-provide-location</link>
<description>&lt;p&gt;Additional information on the EndElementEvent would be very helpful, especially for processing large data in a streaming way.&lt;/p&gt;
&lt;p&gt;I would be happy to propose a patch – I've already signed the Contributor Agreement&lt;/p&gt;
</description>
<category>data.xml</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14184/clojure-data-event-endelementevent-should-provide-location</guid>
<pubDate>Thu, 10 Oct 2024 14:34:39 +0000</pubDate>
</item>
<item>
<title>data.xml : disable support-dtd by default</title>
<link>https://ask.clojure.org/index.php/13523/data-xml-disable-support-dtd-by-default</link>
<description>&lt;p&gt;As defined by OWASP recommendations [1], both &lt;code&gt;supporting-external-entities&lt;/code&gt; and &lt;code&gt;support-dtd&lt;/code&gt; should be disabled by default.&lt;br&gt;
While it's the case for the former (but not released as part of the 0.0.8 version), it's not the case for the latter.&lt;/p&gt;
&lt;p&gt;Can we consider having both defined to &lt;code&gt;false&lt;/code&gt; as part of a stable version?&lt;/p&gt;
&lt;p&gt;[1] : &lt;a rel=&quot;nofollow&quot; href=&quot;https://cheatsheetseries.owasp.org/cheatsheets/XML_External_Entity_Prevention_Cheat_Sheet.html#xmlinputfactory-a-stax-parser&quot;&gt;https://cheatsheetseries.owasp.org/cheatsheets/XML_External_Entity_Prevention_Cheat_Sheet.html#xmlinputfactory-a-stax-parser&lt;/a&gt;.&lt;/p&gt;
</description>
<category>data.xml</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13523/data-xml-disable-support-dtd-by-default</guid>
<pubDate>Mon, 04 Dec 2023 19:14:34 +0000</pubDate>
</item>
<item>
<title>clojure.data.xml.node.Element doesn't implement clojure.lang.Associative/entryAt</title>
<link>https://ask.clojure.org/index.php/12625/clojure-element-doesnt-implement-clojure-associative-entryat</link>
<description>&lt;p&gt;Repro:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(find {:tag :a :attrs {} :content ()} :tag)
;;=&amp;gt; [:tag :a]

(find (clojure.data.xml/element :a) :tag)
;;=&amp;gt; Execution error (AbstractMethodError) at clojure.data.xml.node.Element/entryAt (node.cljc:-1).
;;   Method clojure/data/xml/node/Element.entryAt(Ljava/lang/Object;)Lclojure/lang/IMapEntry; is abstract
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Having &lt;code&gt;Element&lt;/code&gt; implement &lt;code&gt;entryAt&lt;/code&gt; would make it possible e.g. to write &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/metosin/malli&quot;&gt;Malli&lt;/a&gt; schemas for clojure.data.xml data structures without having to transform &lt;code&gt;Element&lt;/code&gt;s to maps beforehand.&lt;/p&gt;
</description>
<category>data.xml</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12625/clojure-element-doesnt-implement-clojure-associative-entryat</guid>
<pubDate>Thu, 02 Feb 2023 09:30:55 +0000</pubDate>
</item>
<item>
<title>clojure.xml processes XXE by default</title>
<link>https://ask.clojure.org/index.php/10338/clojure-xml-processes-xxe-by-default</link>
<description>&lt;p&gt;clojure.xml by default processes &lt;a rel=&quot;nofollow&quot; href=&quot;https://owasp.org/www-community/vulnerabilities/XML_External_Entity_(XXE)_Processing&quot;&gt;XML external entities&lt;/a&gt;. This allows inclusion of external files in the processed XML, both from local file system and from remote servers. This seems like a bad idea when &lt;a rel=&quot;nofollow&quot; href=&quot;https://quanttype.net/posts/2021-03-13-clojure-xml-and-untrusted-input.html&quot;&gt;processing untrusted input&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Here's an example that includes &lt;code&gt;/etc/hostname&lt;/code&gt; in the result (if you do not have that file on your computer, the result is a FileNotFoundException):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(require 'clojure.xml)

(def xml-str &quot;&amp;lt;?xml version=\&quot;1.0\&quot; encoding=\&quot;UTF-8\&quot; ?&amp;gt;
&amp;lt;!DOCTYPE foo [
  &amp;lt;!ELEMENT foo ANY &amp;gt;
  &amp;lt;!ENTITY xxe SYSTEM \&quot;file:///etc/hostname\&quot; &amp;gt;]&amp;gt;
&amp;lt;foo&amp;gt;&amp;amp;xxe;&amp;lt;/foo&amp;gt;&quot;)

(with-open [input (java.io.ByteArrayInputStream. (.getBytes xml-str))]
  (clojure.xml/parse input))
;; =&amp;gt; {:tag :foo, :attrs nil, :content [&quot;nixos\n&quot;]}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;As far as I know, this feature is rarely used and e.g. data.xml disables it by default. Could it be disabled in clojure.xml as well to make it safer by default?&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/10338/clojure-xml-processes-xxe-by-default</guid>
<pubDate>Sun, 14 Mar 2021 08:14:34 +0000</pubDate>
</item>
<item>
<title>Deprecate clojure.xml</title>
<link>https://ask.clojure.org/index.php/9686/deprecate-clojure-xml</link>
<description>&lt;p&gt;The clojure.xml namespace is at this point pretty out of date with modern Java options. It should be marked as deprecated and point to using org.clojure/data.xml instead.&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/9686/deprecate-clojure-xml</guid>
<pubDate>Tue, 06 Oct 2020 16:55:11 +0000</pubDate>
</item>
</channel>
</rss>