2016-12-29 15:42 GMT+01:00 Francis Hitchens <fhitc...@gmail.com>: > Herwig, > > Thanks, I upgraded. The tip about the reader was very useful. So I can now > pass a string representation of my element tag like so and it works... > > (zx/xml1-> zipper > (zx/tag= (eval (read-string "::can/mqMessageHeader")))) >
Here, you're using eval to interact with the alias map of *ns* at runtime. Please don't do that! It will break in extremely random ways. For runtime processing, don't use the reader at all. Use constructors and accessors provided by data.xml. See below. Now I have another problem. With the 0.1.0 version that used the > javax.xml.namespace.QName representation of the tag, I could use the > .getPrefix and .getLocalPart methods to generate my flattened > representation of the XML document that I am putting into a text table to > allow testers to easily set values int the documents as part of their > testing... > > | tag > | value | > | "::can/mqMessageHeader>::can/messageHeaderVersion" | "1" | > | "::can/mqMessageHeader>::can/serviceName" | "getSubBasicInfoBt" | > | "::can/mqMessageHeader>::can/serviceVersion" | "1" | > | "::can/mqMessageHeader>::can/dialogTypeCode" | "2" | > | "::can/mqMessageHeader>::can/dialogSubTypeCode" | "1" | > | "::can/mqMessageHeader>::can/dialogReference" | "DSA-MSG" | > | "::can/mqMessageHeader>::can/applicationGroup" | "99S" | > | "::can/mqMessageHeader>::can/componentGroup" | "Subscription" | > | "::can/mqMessageHeader>::can/componentName" | > "querySubscriberBasicInfoBt" | > | "::can/mqMessageHeader>::can/reqSentDateTime" | "2016-12-19T01:54:09" | > | "::can/mqMessageHeader>::can/applicationUserId" | "DSAUSER" | > | "Data>Info>ptn" | "4094335396" | > | "Data>AddressInfo" | "true" | > | "Data>DetailInfo" | "true" | > > Now the tag is represented as a keyword :xmlns.http%3A%2F%2Fin > tegration.sprint.com%2Fv2%2Fcommon%2FCanonicalDataModel.xsd/mqMessageHeader > which as you pointed out does not have the alias representation. > > I think I am still missing something on how I can interact with the xmlns > namespace. I am aliasing the uri, but I don't know how to reverse that, and > I found that I still needed to alias the namespace with the new version. > Did I misunderstand how that was auto setup? > You don't need to reverse anything. Aliases are a purely a _read-time_ convenience for use in source code. If you're processing qnames at runtime, just use uris, like so: (qname "http://integration.sprint.com/v2/common/CanonicalDataModel.xsd" "mqMessageHeader") => :xmlns.http%3A%2F%2Fintegration.sprint.com <http://2fintegration.sprint.com/>%2Fv2%2Fcommon%2FCanonicalDataModel. xsd/mqMessageHeader (qname-uri :xmlns.http%3A%2F%2Fintegration.sprint.com <http://2fintegration.sprint.com/>%2Fv2%2Fcommon%2FCanonicalDataModel. xsd/mqMessageHeader) => "http://integration.sprint.com/v2/common/CanonicalDataModel.xsd" (qname-local :xmlns.http%3A%2F%2Fintegration.sprint.com <http://2fintegration.sprint.com/>%2Fv2%2Fcommon%2FCanonicalDataModel. xsd/mqMessageHeader) => "mqMessageHeader" (xml/alias-uri 'v1 "http://integration.sprint.com/integration/interfaces/ > getSubBasicInfoBt/v1" > 'can "http://integration.sprint.com/v2/common/ > CanonicalDataModel.xsd") > That alias is just so that you can use a short form to denote the full uri in _clojure source code_: ::can/mqMessageHeader => :xmlns.http%3A%2F%2Fintegration.sprint.com <http://2fintegration.sprint.com/>%2Fv2%2Fcommon%2FCanonicalDataModel. xsd/mqMessageHeader It's intended to be a one-way avenue, just like prefixes in xml. The alias cannot ever make it past read time, because that would be semantically unsound (who decides what ::can/ would mean outside of a clojure namespace?) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.