[PHP] DOMXML API support needed in PHP5

2004-07-23 Thread Scrumpy
When I had decided to redevelop my website using PHP4's XSLT functions as 
the templating system (as opposed to Smarty, phplib etc.), I looked at 
PHP4's two alternatives:

1. XML (Expat) + XSL (Sablotron)
2. DOMXML (libxml2 & libxslt)

At the time there were early signs that PHP5's XML/XSLT support would be 
based on libxml2/libxslt (and that is what finally happened).

That made me decide to use DOMXML.

If the current situation remains, when my hosting company finally replace 
PHP4 with PHP5 (not in the near future, I hope!) my site will break due to 
PHP5 not supporting the DOMXML function. This will be repeated for all 
other sites that use this function.

On the contrary, under PHP5, PHP4 scripts based on the XML function will 
work, even though the underlying library has changed!

There should also be a transitional solution for DOMXML users rather than 
the present lack of either forwards compatibility in PHP4 or backwards 
compatibility in PHP5.

To workaround this problem there are at least two alternatives:

1. A PHP script could be created to check the running PHP version and if 
it's >=PHP5 then translate the PHP4 DOMXML function calls to their 
equivalent PHP5 DOM function calls. This would allow existing PHP4 scripts 
to work under PHP5 and ease the transition to replacement scripts based on 
PHP5's DOM's XML & XSLT  functions.

2. Have a development system that supports both PHP4 & PHP5 and develop 
PHP5 DOM based replacement scripts. Then work very closely with the hosting 
company so that at the same time they replace PHP4 with PHP5, the new PHP5 
scripts replace the PHP4 ones (or use a PHP script to check the version and 
then point to either the PHP4 or PHP5 scripts).

Neither is a good solution nor are they built-in solutions, therefore they 
will be repeated, perhaps with slight variations, by all(?) DOMXML users 
around the world.

A much better approach would be for PHP5 to include backwards compatibility 
for the DOMXML function (at least for the most common function calls eg. 
domxml_open_file, domxml_xslt_stylesheet_file, result_dump_mem, etc.), as 
PHP5 does with practically every other PHP4 function.

When PHP5 reaches version 5.3 or 5.4, the DOMXML support could be removed 
to avoid bloat (this has been done before with other functions). By then 
people would've had sufficient time to replace their old DOMXML code.

Under PHP4 it was easy for me to create some initial scripts to test it's 
two XSLT related functions, on the same local web server software running a 
single PHP interpreter.

It would be as easy to develop DOM based replacement scripts for DOMXML 
ones if both functions worked under PHP5, rather than the current situation 
of DOMXML only working with PHP4 & DOM only working in PHP5.

Sorry if this post is a bit long but I hope you find my suggestion is 
reasonable?

Cheers,
Scrumpy :)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] DOMXML support should be added to PHP5

2004-07-23 Thread Scrumpy
When I had decided to redevelop my website using PHP4's XSLT functions as 
the templating system (as opposed to Smarty, phplib etc.), I looked at 
PHP4's two alternatives:

1. XML (Expat) + XSL (Sablotron)
2. DOMXML (libxml2 & libxslt)

At the time there were early signs that PHP5's XML/XSLT support would be 
based on libxml2/libxslt (and that is what finally happened).

That made me decide to use DOMXML.

If the current situation remains, when my hosting company finally replace 
PHP4 with PHP5 (not in the near future, I hope!) my site will break due 
to PHP5 not supporting the DOMXML function. This will be repeated for all 
other sites that use this function.

On the contrary, under PHP5, PHP4 scripts based on the XML function will 
work, even though the underlying library has changed!

There should also be a transitional solution for DOMXML users rather than 
the present lack of either forwards compatibility in PHP4 or backwards 
compatibility in PHP5.

To workaround this problem there are at least two alternatives:

1. A PHP script could be created to check the running PHP version and if 
it's >=PHP5 then translate the PHP4 DOMXML function calls to their 
equivalent PHP5 DOM function calls. This would allow existing PHP4 
scripts to work under PHP5 and ease the transition to replacement scripts 
based on PHP5's DOM's XML & XSLT  functions. A PHP user has added a 
comment to the online manual that he has created a partial solution that 
covers XML only.

2. Have a development system that supports both PHP4 & PHP5 and develop 
PHP5 DOM based replacement scripts. Then work very closely with the 
hosting company so that at the same time they replace PHP4 with PHP5, the 
new PHP5 scripts replace the PHP4 ones (or use a PHP script to check the 
version and then point to either the PHP4 or PHP5 scripts).

Neither is a good solution nor are they built-in solutions, therefore 
they will be repeated, perhaps with slight variations, by all(?) DOMXML 
users around the world.

A much better approach would be for PHP5 to include support for the 
DOMXML function (at least for the most common function calls eg. 
domxml_open_file, domxml_xslt_stylesheet_file, result_dump_mem, etc.), as 
PHP5 does with practically every other PHP4 function.

When PHP5 reaches version 5.2 or 5.3, the DOMXML support could be removed 
to avoid bloat (this has been done before with other functions). By then 
people would've had sufficient time to replace their old DOMXML code.

Under PHP4 it was easy for me to create some initial scripts to test it's 
two XSLT related functions on my PC which runs Apache and a single PHP 
interpreter.

It would be as easy to develop DOM based replacement scripts for DOMXML 
ones if both functions worked under PHP5, rather than the current 
situation of DOMXML only working with PHP4 & DOM only working in PHP5.

Sorry if this post is a bit long but I hope you find my 
suggestion/request is reasonable.

Cheers,
Scrumpy :)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] DOMXML support should be added to PHP5

2004-07-23 Thread Scrumpy
When I had decided to redevelop my website using PHP4's XSLT functions as 
the templating system (as opposed to Smarty, phplib etc.), I looked at 
PHP4's two alternatives:

1. XML (Expat) + XSL (Sablotron)
2. DOMXML (libxml2 & libxslt)

At the time there were early signs that PHP5's XML/XSLT support would be 
based on libxml2/libxslt (and that is what finally happened).

That made me decide to use DOMXML.

If the current situation remains, when my hosting company finally replace 

PHP4 with PHP5 (not in the near future, I hope!) my site will break due 
to PHP5 not supporting the DOMXML function. This will be repeated for all 
other sites that use this function.

On the contrary, under PHP5, PHP4 scripts based on the XML function will 
work, even though the underlying library has changed!

There should also be a transitional solution for DOMXML users rather than 
the present lack of either forwards compatibility in PHP4 or backwards 
compatibility in PHP5.

To workaround this problem there are at least two alternatives:

1. A PHP script could be created to check the running PHP version and if 
it's >=PHP5 then translate the PHP4 DOMXML function calls to their 
equivalent PHP5 DOM function calls. This would allow existing PHP4 
scripts to work under PHP5 and ease the transition to replacement scripts 
based on PHP5's DOM's XML & XSLT  functions. A PHP user has added a 
comment to the online manual that he has created a partial solution that 
covers XML only.

2. Have a development system that supports both PHP4 & PHP5 and develop 
PHP5 DOM based replacement scripts. Then work very closely with the 
hosting company so that at the same time they replace PHP4 with PHP5, the 
new PHP5 scripts replace the PHP4 ones (or use a PHP script to check the 
version and then point to either the PHP4 or PHP5 scripts).

Neither is a good solution nor are they built-in solutions, therefore 
they will be repeated, perhaps with slight variations, by all(?) DOMXML 
users around the world.

A much better approach would be for PHP5 to include support for the 
DOMXML function (at least for the most common function calls eg. 
domxml_open_file, domxml_xslt_stylesheet_file, result_dump_mem, etc.), as 
PHP5 does with practically every other PHP4 function.

When PHP5 reaches version 5.2 or 5.3, the DOMXML support could be removed 
to avoid bloat (this has been done before with other functions). By then 
people would've had sufficient time to replace their old DOMXML code.

Under PHP4 it was easy for me to create some initial scripts to test it's 
two XSLT related functions on my PC which runs Apache and a single PHP 
interpreter.

It would be as easy to develop DOM based replacement scripts for DOMXML 
ones if both functions worked under PHP5, rather than the current 
situation of DOMXML only working with PHP4 & DOM only working in PHP5.

Sorry if this post is a bit long but I hope you find my 
suggestion/request is reasonable.

Cheers,
Scrumpy :)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: DOMXML support should be added to PHP5

2004-07-23 Thread Scrumpy
Sorry for the repeated posts. I didn't know that they got queued awaiting 
confirmation of my email address :)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] DOMXML API support needed in PHP5

2004-07-23 Thread Scrumpy
When I had decided to redevelop my website using PHP4's XSLT functions as 
the templating system (as opposed to Smarty, phplib etc.), I looked at 
PHP4's two alternatives:

1. XML (Expat) + XSL (Sablotron)
2. DOMXML (libxml2 & libxslt)

At the time there were early signs that PHP5's XML/XSLT support would be 
based on libxml2/libxslt (and that is what finally happened).

That made me decide to use DOMXML.

If the current situation remains, when my hosting company finally replace 
PHP4 with PHP5 (not in the near future, I hope!) my site will break due to 
PHP5 not supporting the DOMXML function. This will be repeated for all 
other sites that use this function.

On the contrary, under PHP5, PHP4 scripts based on the XML function will 
work, even though the underlying library has changed!

There should also be a transitional solution for DOMXML users rather than 
the present lack of either forwards compatibility in PHP4 or backwards 
compatibility in PHP5.

To workaround this problem there are at least two alternatives:

1. A PHP script could be created to check the running PHP version and if 
it's >=PHP5 then translate the PHP4 DOMXML function calls to their 
equivalent PHP5 DOM function calls. This would allow existing PHP4 scripts 
to work under PHP5 and ease the transition to replacement scripts based on 
PHP5's DOM's XML & XSLT  functions.

2. Have a development system that supports both PHP4 & PHP5 and develop 
PHP5 DOM based replacement scripts. Then work very closely with the hosting 
company so that at the same time they replace PHP4 with PHP5, the new PHP5 
scripts replace the PHP4 ones (or use a PHP script to check the version and 
then point to either the PHP4 or PHP5 scripts).

Neither is a good solution nor are they built-in solutions, therefore they 
will be repeated, perhaps with slight variations, by all(?) DOMXML users 
around the world.

A much better approach would be for PHP5 to include backwards compatibility 
for the DOMXML function (at least for the most common function calls eg. 
domxml_open_file, domxml_xslt_stylesheet_file, result_dump_mem, etc.), as 
PHP5 does with practically every other PHP4 function.

When PHP5 reaches version 5.3 or 5.4, the DOMXML support could be removed 
to avoid bloat (this has been done before with other functions). By then 
people would've had sufficient time to replace their old DOMXML code.

Under PHP4 it was easy for me to create some initial scripts to test it's 
two XSLT related functions, on the same local web server software running a 
single PHP interpreter.

It would be as easy to develop DOM based replacement scripts for DOMXML 
ones if both functions worked under PHP5, rather than the current situation 
of DOMXML only working with PHP4 & DOM only working in PHP5.

Sorry if this post is a bit long but I hope you find my suggestion is 
reasonable.

Cheers,
Scrumpy :)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: DOMXML support should be added to PHP5

2004-07-25 Thread Scrumpy
[EMAIL PROTECTED] (Jason Barnett) wrote in
news:[EMAIL PROTECTED]: 

> Well you are right that if
> you used the old DOMXML functions in PHP4 that there is no clean way
> to move that code forward without rewriting / supporting two
> infrastructures.  I'm not a core developer but my guess is that they
> didn't mind dropping the support completely because in PHP4 it was all
> tagged as "experimental". 

Looking at the two approaches, I preferred using DOMXML and as it was based 
on libxml2 & libxslt it seemed to be the better option.

Clearly I've learn't my lesson never to use anything tagged as experimental  
again unless I'm highly competent with that language and if necessary, be 
willing and able to code everything myself.

> It's unfortunate for you, but I think making the change now makes
> sense because of the new DOM / SimpleXML support.

To a 'certain' extent the timing of the change is out of my hands as, like 
the majority of users, my website is hosted on a shared web server whose 
settings are out of my control.

> Perhaps another solution: create a class and call it DomDocument4_3_8
> or something that mimics the method calls / properties of the new
> DomDocument class.  Contact me off list if you need help with this.

Thanks for your offer of help.

Due to my current level of familiarity with PHP, the option best suited to 
me is the second workaround I mentioned in my earlier post i.e. to create 
PHP5 DOM versions of my scripts and a PHP version checking script that also  
then runs either my PHP4 DOMXML or PHP5 DOM scripts.

In order to learn PHP5's DOM function and develop replacement scripts, I'll 
have to find out how I can run both PHP4 & 5 interpreters with Apache on my 
PC. I have some ideas about how I can manage that ;-)

I don't have a broad knowledge of PHP yet. Up until now I narrowly focused 
on only what I needed to learn to be able to build something specific. That 
helped me to build a basic website templating system using XSLT but the 
vulnerabilities of that narrow approach are now all too obvious.

I hope in the future that other relatively inexperienced PHP users don't 
have to face this same situation.

In the future a transitional approach in PHP to replacing any function 
should be implemented. IMO, that is part of good project/life-cycle 
management.

My hope for the future is that PHP remains accessible and attractive to new 
users. It could be all too easy for the core PHP 'guru' developers to 
become blase about this aspect of the language.

Cheers,
Scrumpy :)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: DOMXML support should be added to PHP5

2004-07-25 Thread Scrumpy
[EMAIL PROTECTED] (Christian Stocker) wrote in
news:[EMAIL PROTECTED]: 

>> Looking at the two approaches, I preferred using DOMXML and as it was
>> based on libxml2 & libxslt it seemed to be the better option.
> 
> I don't get that. The new DOM  and XSL extension is still based on
> libxml2 and libxslt. Actually, the whole XML support in PHP 5 is now
> based on libxml2 (meaning SimpleXML, ext/xml et al. as well)

The two *PHP4* approaches, the other being Expat + Sablotron.

> Transitioning from DOMXML/PHP4 to DOM/PHP5 isn't really that
> complicated.
[snip]
> I agree that writing code, which should work on PHP4 and PHP 5 is a
> little bit more complicated

A "little bit more complicated" than "isn't really that complicated"!

Translating function calls isn't something my current level of PHP can 
readily handle (although I'll work on improving that for the future). 
That's why I mentioned that the approach BEST suited to MY current 
abilities is to have my existing PHP4 DOMXML scripts and new PHP5 DOM 
scripts selected by a PHP version 'sensing' script.

> (see http://alexandre.alapetite.net/doc-alex/domxml-php4-php5/

Thank you. I had seen that but it covers only some of DOMXML's XML 
functions and none of it's XSLT functions.

Of course it's good that Alexandre has published his code and it should be 
of help in the future when I'm learning how to translate function calls.

>> To a 'certain' extent the timing of the change is out of my hands as,
>> like the majority of users, my website is hosted on a shared web
>> server whose settings are out of my control.
> 
> But he will inform you some time in advance, right? ;)

Of course! Again, the point is that PHP4 DOMXML scripts will fail on 
webhosts' servers when they replace PHP4 with PHP5, unless a workaround has 
been put in place by each website's maintainer.

> Furthermore it was marked (as you realized) experimental, so "we"
> warned you ;) 

I accept that based on my level of knowledge of PHP, I made a mistake in 
using an experimental function and didn't sufficiently heed the warning. At 
the time I had naively thought that as DOMXML used the same libraries that 
were going to be used in PHP5's XML/XSLT support, that my code would also 
work in the future PHP5.

My background is not in programming as you might have realised :)

>> My hope for the future is that PHP remains accessible and attractive
>> to new users. It could be all too easy for the core PHP 'guru'
>> developers to become blase about this aspect of the language.
> 
> Drop your "guru" conspiracy, please ;)

"Guru" is used to highlight that the core developers must be experts.

It's possible that as their level of expertise grows, PHP's complexity 
increases, resulting in a more difficult learning curve for beginners and 
that this is something to guard against.

Cheers,
Scrumpy :)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Parsing error when XML version is mentioned

2004-07-25 Thread Scrumpy
[EMAIL PROTECTED] (Suresh Manoharan) wrote in
news:[EMAIL PROTECTED]: 

> I am getting parse error [Parse error: parse error, unexpected
> T_STRING  on line 1] when I use XML version info.
> 
>
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
>http://www.w3.org/1999/xhtml"; xml:lang="en-US"
>lang="en-US"> 
[snip]
> Can you pls. help me understand why parsing error occurs and how to
> avoid it.

I just start with "http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php