Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] Lexical information?

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Elliotte Rusty Harold <elharo AT ibiblio.org>
  • To: XOM API for Processing XML with Java <xom-interest AT lists.ibiblio.org>
  • Subject: Re: [XOM-interest] Lexical information?
  • Date: Tue, 31 May 2016 11:31:33 -0700

No, Xerces/SAX throws away a lot of lexical information; and XOM throws
away more. General purpose parsers are not adequate for the rare use cases
such as editors that actually need to preserve the lexical information.

On Tue, May 31, 2016 at 8:04 AM, <nu.xom AT io7m.com> wrote:

> Hello.
>
> I'm writing a program that accepts a XOM-produced AST and performs
> various operations on it.
>
> There are various properties of the AST that cannot be expressed by a
> RELAX-NG or XSD schema, so there are inevitably errors that need to be
> raised when the AST is invalid in some way. In order to allow those
> errors to be acceptable to users, I need to be able to show them
> line and column numbers indication the locations of the errors.
>
> The problem: XOM appears to discard all lexical information (if any is
> even provided by the underlying parser). Is there any way I can arrange
> for lexical information to be preserved in any way? I'm open to any
> suggestion whatsoever (even populating an IdentityHashMap that maps XOM
> produced nodes to lexical information would be fine).
>
> I would assume that the solution would first involve getting SAX or
> whatever is doing the parsing to supply that information (which it
> presumably does at some point, because many of the exception types have
> line and column information). I would then somehow need to intercept
> that information before XOM consumes it, and then somehow associate the
> produced XOM nodes with the information I intercepted.
>
> M
> _______________________________________________
> XOM-interest mailing list
> XOM-interest AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/xom-interest
>



--
Elliotte Rusty Harold
elharo AT ibiblio.org




Archive powered by MHonArc 2.6.24.

Top of Page