<< Back to previous view

[DZIP-3] Not returning expected result for 'tag=' Created: 17/Apr/14  Updated: 17/Apr/14

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

Type: Defect Priority: Major
Reporter: Frank Castellucci Assignee: Aaron Bedra
Resolution: Unresolved Votes: 0
Labels: None
Environment:

:dependencies [[org.clojure/clojure "1.5.1"]
[uk.org.russet/tawny-owl "1.0"]
[clj-http "0.9.1"]
[hickory "0.5.3"]
[instaparse "1.3.0"]
[cheshire "5.3.1"]
[org.clojure/data.zip "0.1.1"]]



 Description   

With this raw data:
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<result>\n <status>success</status>\n <message>success</message>\n <format>xml</format>\n <language>en</language>\n <ip>208.67.220.220</ip>\n <country_code>US</country_code>\n <country>United States</country>\n <region>California</region>\n <city>San Francisco</city>\n <latitude>37.7757</latitude>\n <longitude>-122.3952</longitude>\n <zip_code>94107</zip_code>\n <timezone>-08:00</timezone>\n <localtime>2014-04-17 06:52:45</localtime>\n</result>\n"

And resulting parse/zipper (def _sd ...)
[{:tag :result, :attrs nil, :content [{:tag :status, :attrs nil, :content ["success"]} {:tag :message, :attrs nil, :content ["success"]} {:tag :format, :attrs nil, :content ["xml"]} {:tag :language, :attrs nil, :content ["en"]} {:tag :ip, :attrs nil, :content ["208.67.220.220"]} {:tag :country_code, :attrs nil, :content ["US"]} {:tag :country, :attrs nil, :content ["United States"]} {:tag :region, :attrs nil, :content ["California"]} {:tag :city, :attrs nil, :content ["San Francisco"]} {:tag :latitude, :attrs nil, :content ["37.7757"]} {:tag :longitude, :attrs nil, :content ["-122.3952"]} {:tag :zip_code, :attrs nil, :content ["94107"]} {:tag :timezone, :attrs nil, :content ["-08:00"]} {:tag :localtime, :attrs nil, :content ["2014-04-17 06:52:45"]}]} nil]

The following returns nil:

NS (:require [clojure.data.zip.xml :as dzx])
(dzx/xml1-> _sd (dzx/tag= :result))
(dzx/xml1-> _sd (dzx/tag= :result) (dzx/tag= :status) dzx/text)

But this works:
(dzx/xml1-> _sd (dzx/tag= :ip) dzx/text)
"208.67.220.220"






[DZIP-2] Empty file src/test/clojure/clojure/data/zip.clj should be removed Created: 15/Dec/13  Updated: 27/Dec/13

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

Type: Defect Priority: Minor
Reporter: Andy Fingerhut Assignee: Aaron Bedra
Resolution: Unresolved Votes: 0
Labels: None


 Description   

It serves no purpose being in the library, since it is empty.

Secondarily, it inhibits the use of Leiningen with the project, because if one sets :source-paths ["src/main/clojure"] and :test-paths ["src/test/clojure"], its position in the file system implies that it should have a namespace of clojure.data.zip, the same as the source file src/main/clojure/clojure/data/zip.clj, and even causes (require '[clojure.data.zip :as z]) to throw an exception.



 Comments   
Comment by Aaron Bedra [ 27/Dec/13 2:16 PM ]

Sorry, I just saw this pop up in a Google search. I didn't get the JIRA notification. I will take a closer look soon.





[DZIP-1] tag= doesn't work with records Created: 03/Feb/12  Updated: 30/Mar/12  Resolved: 30/Mar/12

Status: Resolved
Project: data.zip
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Major
Reporter: Justin Kramer Assignee: Aaron Bedra
Resolution: Completed Votes: 1
Labels: None

Attachments: Text File 0001-fix-clojure.data.zip.xml-tag-to-work-with-records.patch    
Patch: Code and Test
Approval: Ok

 Description   

clojure.data.zip.xml/tag= throws when given a record instead of a map, even if it has fields for tag, attrs, and content. Reason: tag= calls (node :tag) instead of (:tag node).

This was uncovered while trying to use data.zip with Ryan Senior's new data.xml, which produces Element records.

Patch with fix and test attached.



 Comments   
Comment by Aaron Bedra [ 30/Mar/12 4:08 PM ]

Thanks! I just gave it quick once over and I think it should cover things nicely. I will take a closer look this evening and if things are proper i'll cut a new version and release right away. This is an issue that bit me just last week that I never got around to reporting.

Comment by Aaron Bedra [ 30/Mar/12 4:48 PM ]

This has been committed and a release 0.1.1 has been pushed. It is staged to Sonatype now and should hit Maven Central within a few hours.





Generated at Fri Oct 24 06:39:37 CDT 2014 using JIRA 4.4#649-r158309.