diff options
author | Rich Hickey <richhickey@gmail.com> | 2008-03-29 22:29:32 +0000 |
---|---|---|
committer | Rich Hickey <richhickey@gmail.com> | 2008-03-29 22:29:32 +0000 |
commit | 540e3dcaa17c6c7e5a03f055c9aecbdd7050720d (patch) | |
tree | 4c5f345fb40db6c53b5b44af782870e104c5c29d /src/xml.clj | |
parent | 1e31c582bfa5fbf73285efdfcf5448efc3a3935a (diff) |
got rid of implement, added docs
Diffstat (limited to 'src/xml.clj')
-rw-r--r-- | src/xml.clj | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/xml.clj b/src/xml.clj index abc3844c..7ad8198c 100644 --- a/src/xml.clj +++ b/src/xml.clj @@ -31,7 +31,7 @@ (some (complement #(. Character (isWhitespace %))) (str *sb*))) (set! *current* (push-content *current* (str *sb*)))))] (new clojure.lang.XMLHandler - (implement [ContentHandler] + (proxy [ContentHandler] [] (startElement [uri local-name q-name #^Attributes atts] (let [attrs (fn [ret i] (if (neg? i) @@ -61,12 +61,27 @@ (let [#^StringBuilder sb *sb*] (. sb (append ch start length)) (set! *state* :chars)) - nil))))) + nil) + (setDocumentLocator [locator]) + (startDocument []) + (endDocument []) + (startPrefixMapping [prefix uri]) + (endPrefixMapping [prefix]) + (ignorableWhitespace [ch start length]) + (processingInstruction [target data]) + (skippedEntity [name]) + )))) (defn startparse-sax [s ch] (.. SAXParserFactory (newInstance) (newSAXParser) (parse s ch))) (defn parse + "Parses and loads the source s, which can be a File, InputStream or + String naming a URI. Returns a tree of the xml/element struct-map, + which has the keys :tag, :attrs, and :content. and accessor fns tag, + attrs, and content. Other parsers can be supplied by passing + startparse, a fn taking a source and a ContentHandler and returning + a parser" ([s] (parse s startparse-sax)) ([s startparse] (binding [*stack* nil |