[antlr-interest] Re: XML parsing

Matt Benson gudnabrsam at yahoo.com
Wed Jun 11 14:05:11 PDT 2003


It seems there would be a couple of alternatives:

1)  Use the wildcard feature of XPA with semantic
predicates to test actual text value.

2)  Modify XPA's XMLTokenTypeManager to map the
alternatives to one generic token type.

-Matt
 
--- Oliver Zeigermann <oliver at zeigermann.de> wrote:
> As with ANTLR every token needs to have a type which
> can be matched 
> by the parser, there is no way to do it dynamically.
> You would have to list all the alternatives. If this
> is your main 
> problem you might consider using SAX and RE.
> 
> --- In antlr-interest at yahoogroups.com, Matt Benson
> <gudnabrsam at y...> 
> wrote:
> > I am staying on the list in case any of this is of
> > interest to anyone else--if not, I apologize. 
> What I
> > have, Oliver, is an XML file that has been created
> so
> > that tags of similar types, that I could process
> in
> > the same way, have different names which are an
> > indication of context.  The names might both match
> a
> > given RE, but be different.  Can you think of any
> > slick way I could use the RE with XPA, or would I
> have
> > to allow for each possible value as alternatives
> of
> > the same rule (doable, but messy)?
> > 
> > Thanks,
> > Matt
> > 
> > --- Oliver Zeigermann <oliver at z...> wrote:
> > > ASTFactory had to be extended in order to allow
> AST
> > > creation from 
> > > strings (no type). This is fully compatible with
> the
> > > original ANTLR 
> > > code as it simply involves making "AST
> > > create(String)" public (was 
> > > protected). You will find the new source of
> > > ASTFactory in the 
> > > distribution. 
> > > 
> > > You will also find the file "Open-Issues.txt" in
> the
> > > distribution 
> > > which summarises what is missing. For short I
> can
> > > tell, XPA is very 
> > > stable and functional. I left the status to
> alpha to
> > > indicated 
> > > things may still change a bit on request of
> users.
> > > So, this is your 
> > > chance to make me adapt XPA to your needs ;)
> > > 
> > > Oliver
> > > 
> > > --- In antlr-interest at yahoogroups.com, Matt
> Benson
> > > <gudnabrsam at y...> 
> > > wrote:
> > > > The first things I notice are that the latest
> > > version
> > > > is named like an alpha, and that the ANTLR jar
> is
> > > > labeled as having been patched.  Can you give
> a
> > > quick
> > > > run-down on the current status of XPA and the
> > > nature
> > > > of the ANTLR patching taking place?
> > > > 
> > > > Thanks,
> > > > Matt
> > > > 
> > > > 
> > > > --- Oliver Zeigermann <oliver at z...> wrote:
> > > > > I have implemented a framework of what you
> > > describe:
> > > > > 
> > > > > http://www.zeigermann.de/xpa/index.html
> > > > > 
> > > > > It allows you to feed XML SAX events into
> ANTLR
> > > > > parsers as token 
> > > > > streams. Optionally, if you do not care for
> > > space,
> > > > > you can create an 
> > > > > AST from a SAX parser and transform it using
> > > ANTLR
> > > > > tree parsers.
> > > > > 
> > > > > Oliver
> > > > > 
> > > > > --- In antlr-interest at yahoogroups.com, Matt
> > > Benson
> > > > > <gudnabrsam at y...> 
> > > > > wrote:
> > > > > > I am involved with a project of which one
> of
> > > the
> > > > > most
> > > > > > daunting components is to take a large XML
> > > > > document
> > > > > > and insert its contents in a relational
> > > database. 
> > > > > The
> > > > > > structure of the document allows for
> > > repetitions
> > > > > of
> > > > > > many of its elements, and may include the
> same
> > > > > types
> > > > > > of elements with different meanings based
> on
> > > > > context. 
> > > > > > I was trying to decide whether something
> like
> > > XSLT
> > > > > > might help with this problem, when I was
> > > struck by
> > > > > the
> > > > > > idea that a recursive-descent parser might
> be
> > > the
> > > > > > thing to use.  This way we could specify
> > > structure
> > > > > by
> > > > > > use of rules, and Antlr's use of
> parameters
> > > and
> > > > > return
> > > > > > values could allow us to specify a
> contextual
> > > > > > interpretation to an element, and receive
> a
> > > value
> > > > > by
> > > > > > which to associate it with a parent
> relational
> > > > > > database record.  Does this sound like a
> good
> > > > > > approach?  Can anyone offer a better
> > > alternative?
> > > > > > 
> > > > > > TIA,
> > > > > > Matt
> > > > > > 
> > > > > > __________________________________
> > > > > > Do you Yahoo!?
> > > > > > Yahoo! Calendar - Free online calendar
> with
> > > sync
> > > > > to Outlook(TM).
> > > > > > http://calendar.yahoo.com
> > > > > 
> > > > > 
> > > > >  
> > > > > 
> > > > > Your use of Yahoo! Groups is subject to
> > > > > http://docs.yahoo.com/info/terms/ 
> > > > > 
> > > > > 
> > > > 
> > > > 
> > > > __________________________________
> > > > Do you Yahoo!?
> > > > Yahoo! Calendar - Free online calendar with
> sync
> > > to Outlook(TM).
> > > > http://calendar.yahoo.com
> > > 
> > > 
> > >  
> > > 
> > > Your use of Yahoo! Groups is subject to
> > > http://docs.yahoo.com/info/terms/ 
> > > 
> > > 
> > 
> > 
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! Calendar - Free online calendar with sync
> to Outlook(TM).
> > http://calendar.yahoo.com
> 
> 
>  
> 
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/ 
> 
> 


__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list