Re: Error loading ultra-edit XML files and line numbers

[email protected] Thu, 14 Sep 2006 15:19:39 -0700 (PDT)
Newsgroups gmane.lisp.scheme.ssax-sxml
Message-ID <[email protected]>
Hello!

> When I try to load an xml file edited with ultra-edit (find it attached) 
> using sxml:document, I get the following error:
> 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. 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. Incidentally, the parser
does not read more than needed, so it is possible to have two XML
document in one file, one after another with no delimiters, and read
them by two successive invocations of the SSAX parser.

> Another question is, once parsed a file using sxml:document, is it 
> possible to obtain the line number at the XML file that corresponds to a 
> (sxml) node ?

Generally, the answer is yes. Although this is not a standard feature,
many Scheme systems track line/column positions in text ports. The
small problem is then that the element handlers don't take a port as
an argument (they have too many arguments already). I guess the best
solution is to have a special kind of handler that takes the port
argument too. That is not too difficult to arrange. I will be out of
town though for a week.

	Cheers,
	Oleg

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642