Re: more ideas for the parser
Andras Mantia <[email protected]>
| Newsgroups | gmane.comp.kde.devel.quanta |
|---|---|
| Message-ID | <[email protected]> |
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 _______________________________________________ quanta-devel mailing list [email protected] https://mail.kde.org/mailman/listinfo/quanta-devel
signature.asc
(application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) iD8DBQBD14FUTQdfac6L/08RAmb5AKCPAo+gppNvupbGg35P14bpOuEP/gCdG4gp ZSolh0GVEn2SeApT5xX7F6U= =BBlW -----END PGP SIGNATURE-----