[prev in list] [next in list] [prev in thread] [next in thread] 

List:       quanta-devel
Subject:    Re: [quanta-devel] more ideas for the parser
From:       Andras Mantia <amantia () kde ! org>
Date:       2006-01-25 13:46:59
Message-ID: 200601251547.00092.amantia () kde ! org
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


On Wednesday 25 January 2006 11:50, Jens Herden wrote:
> Hi Andras,
>
> > Back here: is namespace support really needed at this stage of
> > parsing? I mean,  what I described in that diagram finds the
> > beginning of the XML tag and the end of it (and of course the text
> > between the begin and end). I thought that it is the builder's job
> > to break (parse) the found XML tag, so it identifies the:
> > - namespace
> > - tag name
> > - the attributes
> > - the attribute values
> > - if it is a closing/opening tag
>
> I do not think so. My understanding is that the parser breaks this
> apart and the builder only creates the tree from the pieces.
> Please look into kdom/backends/qxml/QXmlParser.cpp to see the
> connection I am thinking about. Here is the point where our new
> parser should drop into KDOM, at least that is what I am currently
> thinking ;-)

Ok, so KDOM expects to feed the completely parsing element with 
namespace, name, attributes and their values. No problem, we can do the 
tag-parsing when the XML End state is entered and call the builder 
there. I am in favor of this approach as otherwise our state machine 
will be overly complicated. So the workflow will be:
- "<" is read: enter the XML start state, remember this position [pos1]
- for other characters just go through the stated below the XML Start 
state
- when ">" is read, enter the XML End state. Here we have the [pos1] and 
the current position. The tag is between them. Find the namespace, the 
name, the attributes, attribute values, if it is a single tag and if it 
is a closing tag and call the QXmlContentHandler::startElement() or 
endElement() or both with the right arguments. 

Do you have a problem with this approach?

Andras

-- 
Quanta Plus developer - http://quanta.kdewebdev.org
K Desktop Environment - http://www.kde.org

[Attachment #5 (application/pgp-signature)]

_______________________________________________
quanta-devel mailing list
quanta-devel@kde.org
https://mail.kde.org/mailman/listinfo/quanta-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic