<< Back to previous view

[DXML-41] README - applicability of xml-seq, xml-zip? Created: 12/Feb/17  Updated: 14/Feb/17

Status: Open
Project: data.xml
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Enhancement Priority: Minor
Reporter: Phill Wolf Assignee: Ryan Senior
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Clojure's core library includes clojure.xml and two other very useful functions evidently designed to work with data from clojure.xml: xml-seq and clojure.zip/xml-zip.

Is it intended that xml-seq and xml-zip work with data from clojure.data.xml and, in particular, its release-0.2 XML-namespace-related improvements?

Let's enhance the clojure.data.xml README to clarify whether, or to what degree, it should be OK to use clojure.data.xml with xml-seq and xml-zip.



 Comments   
Comment by Herwig Hochleitner [ 14/Feb/17 5:17 AM ]

I have used clojure.data.xml with xml-zip (as well as with clojure.data.zip.xml) and it worked as expected. I'd expect the same from xml-seq.

We should verify this behavior in the test suite and announce it in the readme.
Patches welcome.





[DXML-40] README FileWriter example fails if platform default encoding is not UTF-8 Created: 12/Feb/17  Updated: 12/Feb/17

Status: Open
Project: data.xml
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Enhancement Priority: Minor
Reporter: Phill Wolf Assignee: Ryan Senior
Resolution: Unresolved Votes: 0
Labels: None


 Description   

README.md illustrates writing an XML file with java.io.FileWriter. Therefore the example works only if the Java platform's default encoding is UTF-8. Suggestion: The README would present a more widely usable technique by using clojure.java.io/writer, whose default encoding is UTF-8 everywhere.

Sample program using the README example:

Unable to find source-code formatter for language: clojure. Available languages are: javascript, sql, xhtml, actionscript, none, html, xml, java
(ns garble
  (:require [clojure.data.xml :refer [element emit]]))
(defn -main
  "Tries to write an XML file"
  []
  (let [tags (element :foo {:foo-attr "foo value"}
             (element :bar {:bar-attr "bar value"}
               (element :baz {} "The baz value")))]
  (with-open [out-file (java.io.FileWriter. "/tmp/foo.xml")]
    (emit tags out-file))))

Invocation 1 (overriding Java's default encoding because Java is inclined to use UTF-8 on my computer):

java -cp ... -Dfile.encoding=US-ASCII clojure.main -m garble

Result:

java.lang.Exception: Output encoding of stream (UTF-8) doesn't match declaration (ASCII)

Invocation 2:

java -cp ... -Dfile.encoding=UTF-8 clojure.main -m garble

Result: successfully writes /tmp/foo.xml






[DXML-22] Adding hiccup generation function for elements Created: 24/Feb/14  Updated: 07/Dec/16

Status: Open
Project: data.xml
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Enhancement Priority: Minor
Reporter: Chris Zheng Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Environment:

N/a



 Description   

This is for completeness really. See pull request https://github.com/clojure/data.xml/pull/10

I would like to:

  • generate an element using hiccup (already exists)
  • generate hiccup using an element (proposed)


 Comments   
Comment by Chris Zheng [ 28/Mar/14 7:22 AM ]

I'm hoping someone can at least give some feedback to this ticket.

Comment by Ryan Senior [ 28/Mar/14 7:53 AM ]

Hi Chris,

Thanks for the reminder on this. I'll have more time to dig in this weekend, but off the top of my head I think more will need to be done on this, both on implementation and on testing. I think what you have now won't work with comments or cdata. One way to flesh some of that out is to create round trip types of tests in src/test/clojure/clojure/data/xml/test_sexp.clj.





Generated at Thu Feb 23 17:27:41 CST 2017 using JIRA 4.4#649-r158309.