    ;; FIXME XDM keys have only been mocked; unknown if it matches getValueType
 
    ;; XdmAtomic TODO
-   ;; XdmAttribute TODO
+   "attribute()" #(.asString %) ;; XdmAttribute TODO
    "binary()" #(.asString %) ;; XdmBinary -- XXX unknown if the key used matches getValueType
-   "comment()" #(.asString %) ;; XdmComment -- XXX unknown if the key used matches getValueType
-   "document()" #(.asString % ) ;; XdmDocument
-   "duration()" #(.toString %) ;; XdmDuration
+   "comment()" #(.asString %) ;; XdmComment
+   "document-node()" #(.asString %) ;; XdmDocument
+   "duration()" #(.toString %) ;; XdmDuration XXX may only ever come through as xs:duration
    "element()" #(.asString %) ;; XdmElement
    ;; XdmItem TODO
-   ;; XdmNode TODO
-   ;; XdmProcessingInstruction TODO
-   ;; XdmSequence<I extends XdmItem> TODO
-   "text()" #(.asString %)   ;; XdmText -- XXX unknown if the key used matches getValueType
+   "text()" #(.asString %)
+   ;; XdmText -- XXX unknown if the key used matches getValueType
    "variable()" #(hash-map (.toString (.getName %))
                            (.asString (.getValue %))) ;; XdmVariable -- XXX unknown if the key used matches getValueType
 

   "xs:date" str
   "xs:dateTime" str
   "xs:dayTimeDuration" str
   "xs:decimal" coerce-number
   "xs:double" coerce-number
   "xs:duration" str
   "xs:float" coerce-number
   ;; Maybe strip hyphens from all Gregorian date-parts?
   ;; or make conform to a particular date type?
   "xs:gDay" str

;;;; Type coercion
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defn convert-number
  "Reads a number from a numeric Java object of a type from
  com.marklogic.xcc.types. Returns nil if not a number. Designed for
  robust number-handling while preventing read-string security
