Shinmera / lquery

A Common Lisp library to allow jQuery-like HTML/DOM manipulation.
https://shinmera.github.io/lquery
zlib License
87 stars 8 forks source link

Cannot parse and query an xml node named "track" #12

Closed mihaiolteanu closed 5 years ago

mihaiolteanu commented 5 years ago

I have an xml file with track nodes from the last.fm api and it seems I cannot query this specific node name. I've simplified and used just a single track node, for testing purposes:

(defparameter *test*
  (plump:parse
     "<lfm>
        <track rank=\"17\">
          <name>Harmonium</name>
        </track>
      </lfm>"))

(lquery:$ *test*
  "track name" (text))
; => #()

The last call returns an empty vector. If I change the node name to trackk, for example, then I get the result Harmonium, which is what I would expect.

(defparameter *test*
  (plump:parse
     "<lfm>
        <trackk rank=\"17\">
          <name>Harmonium</name>
        </trackk>
      </lfm>"))

(lquery:$ *test*
  "trackk name" (text))
 ; => #("Harmonium")

So the structure and the parsing code seems to be fine. Is track a symbol used internally by lquery, maybe, or what might be the problem with this one?

Shinmera commented 5 years ago

No, this is due to it parsing as HTML, which has different rules from XML. Please read the Plump documentation

mihaiolteanu commented 5 years ago

Yup, it works with the *xml-tags*.
Most appreciated.