Re: PULL Parser in PHP

"lrargerich" <[email protected]>
Newsgroups gmane.text.xml.xmlpull.devel
Message-ID <[email protected]>
--- In xmlpull-dev@y..., Aleksander Slominski <aslom@e...> wrote:
> lrargerich wrote:
> 
> > I find the initiative of xmlpull.org quite ineteresting, as an
> > excercise I'm implementing an XML-PULL parser in PHP, I'll point to
> > the code/documentation as soon as I have it ready so you can test it
> > or comment about it.
> 
> hi,
> 
> that is fantastic!

Great!

> 
> > The API will be respected except when PHP doesn't let me, for example
> > I can't overload methods so I created
> > getAttributeValueByName($namespace,$local-name) and
> > getAttributeName($index) as two different methods. Is there an API for
> > non-overloading languages? :-) I guess not.
> 
> actually API is generally very simple and it not much more than methods
> in one XmlPullParser interface.
> 
> there are only two overloaded methods: getAttributeName and getNamespace
>     (1) public String getNamespace ();
>     (2) public String getNamespace (String prefix);
>     --> getNamespaceFromPrefix
>    (3) public String getAttributeValue(int index);
>    (4) public String getAttributeValue(String namespace, String name);
>    ---> getAttributeValueFromName
> and i think to add maybe to next version those two methods
> (getNamespaceFromPrefix and getAttributeValueFromName)
> and to deprecate overloaded methods (2) and (4) but not to
> remove them until next major release of XMLPULL API (V2).
> 

Ok,I changed the I-can't-overload methods to getAttributeValueFromName
and getNamespaceFromPrefix. 

> i was thinking about providing C/C++ version of API soon however i >
>have
> never sorted out how to handle exceptions in C, how to get nice IO
and finally
> what is best representation for String in C (use wchar_t or char but
point that it
> is UTF8 encoded). how did you approach it on PHP, what were other
> changes to API that you have to do?

Well, you know you have to rely on the language you use, along as the
API is respected there will be some behavioural changes due to the
nature of the language, in PHP instead of exceptions I throw PHP
warnings, the user can intercept them if he wants. In PHP5 there will
be exceptions and I'll change this class as well as several others in
order to use exceptions, a much nicer error handling mechanism.

I'll have some gamma version of the parser soon (Monday I guess) so
I'll send it to you and check if it is ok as a XML-PULL implementation.

Do you have an email address to send me for files and so?

Luis
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.