Function prototypes in XML format?

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
User avatar
mattcooper
Forum Contributor
Posts: 210
Joined: Thu Mar 17, 2005 5:51 am
Location: London, UK

Function prototypes in XML format?

Post by mattcooper »

Hi all,

Don't ask why I want this... :) Does anyone know if the function prototypes from the manual have ever been put in XML format? Something like:

Code: Select all

 
<php-prototypes>
    <functions category="string functions">
        <function name="strip_tags">
            <prototype>
                <!-- string string strip_tags  ( string $str  [, string $allowable_tags  ] ) -->
                <function max-num-args="2" />
                <args>
                    <arg type="string" optional="false">$str</arg>
                    <arg type="string" optional="true">$allowable_tags</arg>
                </args>
                <return type="string" />
            </prototype>
        </function>
    </functions>
    <functions category="array functions">
        <function name="array_push">
            <prototype>
                <!-- int array_push  ( array &$array  , mixed $var  [, mixed $...  ] ) -->
                <function max-num-args="3" />
                <args>
                    <arg type="array" optional="false">$array</arg>
                    <arg type="mixed" optional="false">$var</arg>
                    <arg type="mixed" optional="true">$...</arg>
                </args>
                <return type="int" />
            </prototype>
        </function>
    </functions>
</php-prototypes>
 
This is for a huge project I'm scoping out at the moment and it won't really be possible in terms of time to actually do it myself :(

Any pointers and suggestions gratefully received, as always.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Function prototypes in XML format?

Post by Christopher »

One of our members works on the PHP manual and may know the internal formats. I don't recall who it is though.
(#10850)
User avatar
mattcooper
Forum Contributor
Posts: 210
Joined: Thu Mar 17, 2005 5:51 am
Location: London, UK

Re: Function prototypes in XML format?

Post by mattcooper »

arborint wrote:One of our members works on the PHP manual and may know the internal formats. I don't recall who it is though.
Lulz :D Oh well, if you do recall sometime, let me know! Ta... rofl
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Re: Function prototypes in XML format?

Post by Ambush Commander »

Yes, indeed there is, although you'll need to do a bit of processing to get it into the form you gave us. PHP's documentation uses Docbook 5's function documentation syntax.

Some examples can be found here: array_change_key_case()
and so forth at http://cvs.php.net/viewvc.cgi/phpdoc/
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Re: Function prototypes in XML format?

Post by Ollie Saunders »

You might find the various methods of ReflectionParameter and ReflectionFunction a useful guide.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Function prototypes in XML format?

Post by Chris Corbyn »

arborint wrote:One of our members works on the PHP manual and may know the internal formats. I don't recall who it is though.
It's ThePhoenix ;)

It's actually really easy to "rip" the manual in any format you like though. Download, the HTML version is multiple files, then rip away... all the pages follow the same conventions so even simple regex works well. I've done it before but I don't have the code.

I ripped all the functions along with their synopses so that when you rolled over a function in a

Code: Select all

 block here on the forum you got a link to the manual, and a tooltip showing the function synopsis.
Post Reply