hello, i would like to use cxml to parse a XML TV file
i try like this :
CL-USER> (cxml:parse-file "/home/nicolas/src/cl-freetv/var/xmltv.xml" (cxml-dom:make-dom-builder) :validate t)
and i have this error :
Document not valid: (03) Element Valid: title Context: Line 19655, column 12 in file://+/home/nicolas/src/cl-freetv/var/xmltv.xml
[Condition of type CXML:VALIDITY-ERROR]
Restarts: 0: [ABORT-REQUEST] Abort handling SLIME request. 1: [TERMINATE-THREAD] Terminate this thread (#<THREAD "repl-thread" {B322659}>)
Backtrace: 0: (CXML::%ERROR CXML:VALIDITY-ERROR NIL "Document not valid: (03) Element Valid: title") 1: (CXML::%ERROR CXML:VALIDITY-ERROR NIL "Document not valid: (03) Element Valid: title") 2: (CXML:VALIDITY-ERROR "(03) Element Valid: ~A" "title") 3: (CXML:VALIDITY-ERROR "(03) Element Valid: ~A") 4: (CXML::VALIDATE-START-ELEMENT #S(CXML::CONTEXT :HANDLER #<RUNE-DOM::DOM-BUILDER {ADCA581}> :DTD #S(CXML::DTD :ELEMENTS #<HASH-TABLE :TEST EQUAL :COUNT 40 {B06DE09}> :GENTITIES #<HASH-TABLE :TEST EQUAL :COUNT 5 {B06DE51}> :PENTITIES #<HASH-TABLE :TEST EQUAL :COUNT 0 {B06DE99}> :NOTATIONS #<HASH-TABLE :TEST EQUAL :COUNT 0 {B06DEE1}>) :MODEL-STACK ((#<FUNCTION CXML::CMODEL-DONE> . #<FUNCTION # {BC7AF15}>) (#<CLOSURE #1=# {B1191C5}> . #<CLOSURE #2=# {B0C7C4D}>) (#<CLOSURE #1# {B5A51A5}> . #<CLOSURE #2# {B5A520D}>) (#<FUNCTION # {B0E023D}> . #<FUNCTION # {B0E0155}>)) :REFERENCED-NOTATIONS NIL :ID-TABLE #<HASH-TABLE :TEST EQUAL :COUNT 0 {AFEE5F1}> :NAME-HASHTABLE #S(CXML::ROD-HASHTABLE :SIZE 2003 :TABLE #(NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL ...)) :STANDALONE-P NIL :ENTITY-RESOLVER NIL :DISALLOW-INTERNAL-SUBSET NIL :MAIN-ZSTREAM #S(CXML::ZSTREAM :TOKEN-CATEGORY NIL :TOKEN-SEMANTIC NIL :INPUT-STACK (#<RUNES:XSTREAM [main document :MAIN file://+/home/nicolas/src/cl-freetv/var/xmltv.xml]>))) "title") 5: (CXML::P/ELEMENT #S(CXML::ZSTREAM :TOKEN-CATEGORY NIL :TOKEN-SEMANTIC NIL :INPUT-STACK (#<RUNES:XSTREAM [main document :MAIN file://+/home/nicolas/src/cl-freetv/var/xmltv.xml]>))) 6: (CXML::P/CONTENT #S(CXML::ZSTREAM :TOKEN-CATEGORY NIL :TOKEN-SEMANTIC NIL :INPUT-STACK (#<RUNES:XSTREAM [main document :MAIN file://+/home/nicolas/src/cl-freetv/var/xmltv.xml]>))) 7: (CXML::P/ELEMENT #S(CXML::ZSTREAM :TOKEN-CATEGORY NIL :TOKEN-SEMANTIC NIL :INPUT-STACK (#<RUNES:XSTREAM [main document :MAIN file://+/home/nicolas/src/cl-freetv/var/xmltv.xml]>))) 8: (CXML::P/CONTENT #S(CXML::ZSTREAM :TOKEN-CATEGORY NIL :TOKEN-SEMANTIC NIL :INPUT-STACK (#<RUNES:XSTREAM [main document :MAIN file://+/home/nicolas/src/cl-freetv/var/xmltv.xml]>))) 9: (CXML::P/ELEMENT #S(CXML::ZSTREAM :TOKEN-CATEGORY NIL :TOKEN-SEMANTIC NIL :INPUT-STACK (#<RUNES:XSTREAM [main document :MAIN file://+/home/nicolas/src/cl-freetv/var/xmltv.xml]>))) 10: (CXML::P/CONTENT #S(CXML::ZSTREAM :TOKEN-CATEGORY NIL :TOKEN-SEMANTIC NIL :INPUT-STACK (#<RUNES:XSTREAM [main document :MAIN file://+/home/nicolas/src/cl-freetv/var/xmltv.xml]>))) 11: (CXML::P/ELEMENT #S(CXML::ZSTREAM :TOKEN-CATEGORY NIL :TOKEN-SEMANTIC NIL :INPUT-STACK (#<RUNES:XSTREAM [main document :MAIN file://+/home/nicolas/src/cl-freetv/var/xmltv.xml]>))) 12: (CXML::P/DOCUMENT #S(CXML::ZSTREAM :TOKEN-CATEGORY NIL :TOKEN-SEMANTIC NIL :INPUT-STACK (#<RUNES:XSTREAM [main document :MAIN file://+/home/nicolas/src/cl-freetv/var/xmltv.xml]>)) #<RUNE-DOM::DOM-BUILDER {ADCA581}> :VALIDATE T :DTD NIL :ROOT NIL :ENTITY-RESOLVER NIL :DISALLOW-INTERNAL-SUBSET NIL :RECODE T) 13: (CXML::PARSE-XSTREAM #<RUNES:XSTREAM [main document :MAIN file://+/home/nicolas/src/cl-freetv/var/xmltv.xml]> #<RUNE-DOM::DOM-BUILDER {ADCA581}> :VALIDATE T) 14: (CXML::CALL-WITH-OPEN-XFILE #<CLOSURE (LAMBDA (CXML::INPUT)) {ADCA605}> "/home/nicolas/src/cl-freetv/var/xmltv.xml") 15: (SB-INT:EVAL-IN-LEXENV (CXML:PARSE-FILE "/home/nicolas/src/cl-freetv/var/xmltv.xml" (RUNE-DOM:MAKE-DOM-BUILDER) :VALIDATE T) #<NULL-LEXENV>) 16: (SWANK::EVAL-REGION "(cxml:parse-file "/home/nicolas/src/cl-freetv/var/xmltv.xml" (cxml-dom:make-dom-builder) :validate t) " T) 17: ((LAMBDA NIL)) 18: ((SB-PCL::FAST-METHOD SWANK-BACKEND:CALL-WITH-SYNTAX-HOOKS (T)) #<unused argument> #<unused argument> #<CLOSURE (LAMBDA NIL) {AD6871D}>) 19: (SWANK::CALL-WITH-BUFFER-SYNTAX #<CLOSURE (LAMBDA NIL) {AD6871D}>) 20: (SB-INT:EVAL-IN-LEXENV (SWANK:LISTENER-EVAL "(cxml:parse-file "/home/nicolas/src/cl-freetv/var/xmltv.xml" (cxml-dom:make-dom-builder) :validate t) ") #<NULL-LEXENV>) 21: ((LAMBDA NIL)) 22: ((SB-PCL::FAST-METHOD SWANK-BACKEND:CALL-WITH-DEBUGGER-HOOK (T T)) #<unused argument> #<unused argument> #<FUNCTION SWANK:SWANK-DEBUGGER-HOOK> #<CLOSURE (LAMBDA NIL) {AD67F75}>)
but with the XML validator (http://www.stg.brown.edu/service/xmlvalid/) the result is the document is valid
so i try without validate argument :
CL-USER> (cxml:parse-file "/home/nicolas/src/cl-freetv/var/xmltv.xml" (cxml-dom:make-dom-builder))
and the error :
Document not well-formed: Bad nesting. "category" / (:ETAG "programme") Context: Line 19659, column 15 in file://+/home/nicolas/src/cl-freetv/var/xmltv.xml
[Condition of type CXML:WELL-FORMEDNESS-VIOLATION]
Restarts: 0: [ABORT-REQUEST] Abort handling SLIME request. 1: [TERMINATE-THREAD] Terminate this thread (#<THREAD "repl-thread" {B322659}>)
Backtrace: 0: (CXML::%ERROR CXML:WELL-FORMEDNESS-VIOLATION #S(CXML::ZSTREAM :TOKEN-CATEGORY NIL :TOKEN-SEMANTIC NIL :INPUT-STACK (#<RUNES:XSTREAM [main document :MAIN file://+/home/nicolas/src/cl-freetv/var/xmltv.xml]>)) "Document not well-formed: Bad nesting. "category" / (:ETAG "programme")") 1: (CXML::%ERROR CXML:WELL-FORMEDNESS-VIOLATION #S(CXML::ZSTREAM :TOKEN-CATEGORY NIL :TOKEN-SEMANTIC NIL :INPUT-STACK (#<RUNES:XSTREAM [main document :MAIN file://+/home/nicolas/src/cl-freetv/var/xmltv.xml]>)) "Document not well-formed: Bad nesting. "category" / (:ETAG "programme")") 2: (CXML::WF-ERROR #S(CXML::ZSTREAM :TOKEN-CATEGORY NIL :TOKEN-SEMANTIC NIL :INPUT-STACK (#<RUNES:XSTREAM [main document :MAIN file://+/home/nicolas/src/cl-freetv/var/xmltv.xml]>)) "Bad nesting. ~S / ~S" "category" (:ETAG "programme")) 3: (CXML::WF-ERROR #S(CXML::ZSTREAM :TOKEN-CATEGORY NIL :TOKEN-SEMANTIC NIL :INPUT-STACK (#<RUNES:XSTREAM [main document :MAIN file://+/home/nicolas/src/cl-freetv/var/xmltv.xml]>)) "Bad nesting. ~S / ~S") 4: (CXML::P/ELEMENT #S(CXML::ZSTREAM :TOKEN-CATEGORY NIL :TOKEN-SEMANTIC NIL :INPUT-STACK (#<RUNES:XSTREAM [main document :MAIN file://+/home/nicolas/src/cl-freetv/var/xmltv.xml]>))) 5: (CXML::P/CONTENT #S(CXML::ZSTREAM :TOKEN-CATEGORY NIL :TOKEN-SEMANTIC NIL :INPUT-STACK (#<RUNES:XSTREAM [main document :MAIN file://+/home/nicolas/src/cl-freetv/var/xmltv.xml]>))) 6: (CXML::P/ELEMENT #S(CXML::ZSTREAM :TOKEN-CATEGORY NIL :TOKEN-SEMANTIC NIL :INPUT-STACK (#<RUNES:XSTREAM [main document :MAIN file://+/home/nicolas/src/cl-freetv/var/xmltv.xml]>))) 7: (CXML::P/CONTENT #S(CXML::ZSTREAM :TOKEN-CATEGORY NIL :TOKEN-SEMANTIC NIL :INPUT-STACK (#<RUNES:XSTREAM [main document :MAIN file://+/home/nicolas/src/cl-freetv/var/xmltv.xml]>))) 8: (CXML::P/ELEMENT #S(CXML::ZSTREAM :TOKEN-CATEGORY NIL :TOKEN-SEMANTIC NIL :INPUT-STACK (#<RUNES:XSTREAM [main document :MAIN file://+/home/nicolas/src/cl-freetv/var/xmltv.xml]>))) 9: (CXML::P/DOCUMENT #S(CXML::ZSTREAM :TOKEN-CATEGORY NIL :TOKEN-SEMANTIC NIL :INPUT-STACK (#<RUNES:XSTREAM [main document :MAIN file://+/home/nicolas/src/cl-freetv/var/xmltv.xml]>)) #<RUNE-DOM::DOM-BUILDER {AC29D31}> :VALIDATE NIL :DTD NIL :ROOT NIL :ENTITY-RESOLVER NIL :DISALLOW-INTERNAL-SUBSET NIL :RECODE T) 10: (CXML::PARSE-XSTREAM #<RUNES:XSTREAM [main document :MAIN file://+/home/nicolas/src/cl-freetv/var/xmltv.xml]> #<RUNE-DOM::DOM-BUILDER {AC29D31}>) 11: (CXML::CALL-WITH-OPEN-XFILE #<CLOSURE (LAMBDA (CXML::INPUT)) {AC29D65}> "/home/nicolas/src/cl-freetv/var/xmltv.xml") 12: (SB-INT:EVAL-IN-LEXENV (CXML:PARSE-FILE "/home/nicolas/src/cl-freetv/var/xmltv.xml" (RUNE-DOM:MAKE-DOM-BUILDER)) #<NULL-LEXENV>)
so i don't really understand the problem. could you help me to solve it ?
the XML file could be find there :
http://xmltvfree.free.fr/xmltv.xml.gz
and the DTD attached to this mail
thanks for any help
-- Nicolas Lamirault
Hi,
Quoting Nicolas Lamirault (lam@tuxfamily.org):
CL-USER> (cxml:parse-file "/home/nicolas/src/cl-freetv/var/xmltv.xml" (cxml-dom:make-dom-builder) :validate t)
and i have this error :
Document not valid: (03) Element Valid: title
[...]
so i try without validate argument :
CL-USER> (cxml:parse-file "/home/nicolas/src/cl-freetv/var/xmltv.xml" (cxml-dom:make-dom-builder))
and the error :
Document not well-formed: Bad nesting. "category" / (:ETAG "programme")
I cannot reproduce these errors with the file you made available for download. I've tried SBCL with and without Unicode as well as an older cxml on Allegro. All fine.
Did you put up the exact same file you tried this with?
Regards, David