Re: [ssax-sxml] Error loading ultra-edit XML files and line numbers
Brought to you by:
oleg
From: Dmitry L. <liz...@is...> - 2006-09-18 14:00:05
|
Hello! >> The problem seems to be related to three characters that ultra-edit >> includes at the beginning of the file. However, other parsers (xerces >> for instance) work fine. > > I guess this is the question for Dmitry as to how customizable > sxml:document is. It is certain however that sxml:document quite soon > calls the SSAX parser, ssax:xml->sxml. Oleg, you are right. For an XML document requested by URI via sxml:document function, the semantics of the sxml:document function is roughly as follows: (lambda (req-uri) (ssax:xml->sxml (open-input-resource req-uri) '())) > The parser accepts the input > port (rather than the file name or URL). It is quite possible to open > a file on one's own, use peek-char to check if the file starts with > extra characters (could be the BOM mark), skip these characters if > needed, and then pass the port to the parser. Victor, for your project, you can use a variation that provides skipping several starting characters, for example, thus: (lambda (req-uri) (let ((port (open-input-resource req-uri))) (let loop () (if (char=? (peek-char port) #\<) (ssax:xml->sxml port '()) (begin (read-char port) (loop)))))) We can probably think of making the sxml:document function customizable for providing such a semantics. Dmitry |