Re: [PHP] Re: Sorting parsed XML

2002-11-26 Thread @ Edwin

Geoff Hankerson [EMAIL PROTECTED] wrote:

 This seems to me to be more easily handled by XSLT. (Not the only option 
 but a good one).
 XSLT lets you select only the nodes you want and also sort them as well.

Perhaps... but not all browsers support it.

Anyway, you can also select the nodes in PHP and you can sort them as well.

And you can do more than that... ;)

- E


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




Re: [PHP] Re: Sorting parsed XML

2002-11-26 Thread Geoff Hankerson
You don't need to do client-side transformation (although you could 
check user agent and do it client-side if the browser supports it).
You can use Php's XSLT functions see the manual for more info.

I was just suggesting this as a potential option. It may not be 
appropriate in this situation. I don't really know enough about the 
programming challenge we are looking at  to say for sure


@ Edwin wrote:

Geoff Hankerson [EMAIL PROTECTED] wrote:

 

This seems to me to be more easily handled by XSLT. (Not the only option 
but a good one).
XSLT lets you select only the nodes you want and also sort them as well.
   


Perhaps... but not all browsers support it.

Anyway, you can also select the nodes in PHP and you can sort them as well.

And you can do more than that... ;)

- E



 




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




Re: [PHP] Re: Sorting parsed XML

2002-11-26 Thread @ Edwin

Geoff Hankerson [EMAIL PROTECTED] wrote:

 You don't need to do client-side transformation (although you could
 check user agent and do it client-side if the browser supports it).
 You can use Php's XSLT functions see the manual for more info.

 I was just suggesting this as a potential option. It may not be
 appropriate in this situation. I don't really know enough about the
 programming challenge we are looking at  to say for sure

I see. I thought you were saying that use XSLT and access the xml file
directly--my apologies.

Anyway, _that_ is certainly a potential option... :)

- E

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




RE: [PHP] Re: Sorting parsed XML

2002-11-26 Thread Chris
Okay, that's neat and I get what you're saying with xml_process() to
handle this.

From what I'm reading, it would not allow this sort of procedure, but
please let me know otherwise:

==
echo td . $ServerName;
if ($ServerType)
{
echo  i( . $ServerType . )/i/td\n;
} else {
echo /td\n;
}

if ($ServerStatus == Down)
{
echo tdi . $ServerStatus . /i/td\n;
} else {
echo td . $ServerPopulation . /td\n;
}
==

So, what would print in the first and 2nd column would depend upon the
results of one of two variables (1st column relies upon if there's a
$ServerType or not, 2nd column relies upon the $ServerStatus not being
Down).

My problem is still my own, I can't get it so that when I parse, the
information is placed into an array that can then be used for sorting.
This would be ideal for me as I plan on reading from more than one .xml
(different structures as well) on the same page if I can get this to
work.

I guess what I'm asking for is a method to parse information into an
array and then sort it by any part of the array.  I attempted the
$ServerArray[$this-ServerName][$this-ServerStatus] = $data in the
parse section (where $data = current node value), but it didn't work.

Again, thanks for all your help so far and in advance for any help you
can provide.

~Confused PHP user

 From: @ Edwin [mailto:[EMAIL PROTECTED]] 
 
 Geoff Hankerson [EMAIL PROTECTED] wrote:
 
  You don't need to do client-side transformation (although you could 
  check user agent and do it client-side if the browser supports it). 
  You can use Php's XSLT functions see the manual for more info.
 
  I was just suggesting this as a potential option. It may not be 
  appropriate in this situation. I don't really know enough about the 
  programming challenge we are looking at  to say for sure
 
 I see. I thought you were saying that use XSLT and access the 
 xml file directly--my apologies.
 
 Anyway, _that_ is certainly a potential option... :)


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




Re: [PHP] Re: Sorting parsed XML

2002-11-25 Thread @ Edwin
Hello,

Chris [EMAIL PROTECTED] wrote:

 I'm trying to write PHP code that will not only parse the XML but also
 allow me to sort the parsed information by the values parsed.

I'm not sure if I really understand but let me try...

...[snip code]...

Adding echo 'table border=1'; before this and

 $xml_parser = xml_parser_create();

...[snip code]...

after this

 xml_parser_free($xml_parser);

  echo '/table';

shows a good view that you have a table with two columns.

If you'd like to sort these, then I think you might be able to do something
like this:
1. Instead of printf()'ing your td's or tr's inside the class/function,
why don't you try putting it inside an array? (Maybe with array_push() or
something.) Then,
2. If you already have an array, perhaps you can use one of the functions
here for sorting:

  http://www.php.net/manual/en/ref.array.php

HTH,

- E

...[snip]...

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




Re: [PHP] Re: Sorting parsed XML

2002-11-25 Thread Geoff Hankerson
This seems to me to be more easily handled by XSLT. (Not the only option 
but a good one).
XSLT lets you select only the nodes you want and also sort them as well.

@ Edwin wrote:

Hello,

Chris [EMAIL PROTECTED] wrote:

 

I'm trying to write PHP code that will not only parse the XML but also
allow me to sort the parsed information by the values parsed.
   


I'm not sure if I really understand but let me try...

...[snip code]...

Adding echo 'table border=1'; before this and

 

$xml_parser = xml_parser_create();
   


...[snip code]...

after this

 

xml_parser_free($xml_parser);
   


 echo '/table';

shows a good view that you have a table with two columns.

If you'd like to sort these, then I think you might be able to do something
like this:
1. Instead of printf()'ing your td's or tr's inside the class/function,
why don't you try putting it inside an array? (Maybe with array_push() or
something.) Then,
2. If you already have an array, perhaps you can use one of the functions
here for sorting:

 http://www.php.net/manual/en/ref.array.php

HTH,

- E

...[snip]...

 




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




RE: [PHP] Re: Sorting parsed XML

2002-11-25 Thread Chris
Unavailable as I am reading an XML file produced by another web site and
it dynamically updates the information on the sheet every 5 minutes or
so.  At least to my knowledge of what XSLT can do.

 From: Geoff Hankerson [mailto:[EMAIL PROTECTED]] 
 
 This seems to me to be more easily handled by XSLT. (Not the 
 only option 
 but a good one).
 XSLT lets you select only the nodes you want and also sort 
 them as well.


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