SitePoint Sponsor

User Tag List

Results 1 to 21 of 21

Thread: xml into html

  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2004
    Location
    UAE
    Posts
    36
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    xml into html

    hi all...


    i would like to parse xml file into html file


    this is the xml file

    http://nwapp.emirates.net.ae/channel...hstocksnow.jsp


    is there any way to do it.


    Regards
    Al3in

  2. #2
    SitePoint Addict DA Master's Avatar
    Join Date
    Apr 2004
    Location
    /etc/php.ini
    Posts
    398
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Could you not use XSLT.

  3. #3
    SitePoint Enthusiast
    Join Date
    Aug 2004
    Location
    UAE
    Posts
    36
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    can you explain more dear

  4. #4
    SitePoint Addict DA Master's Avatar
    Join Date
    Apr 2004
    Location
    /etc/php.ini
    Posts
    398
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah sure sorry, it was a bad reply, try looking at this document on W3Schools...

    http://www.w3schools.com/xsl/default.asp

  5. #5
    SitePoint Enthusiast
    Join Date
    Aug 2004
    Location
    UAE
    Posts
    36
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if there any way to parse the xml file into php variables to store them in Mysql Table.

  6. #6
    SitePoint Addict DA Master's Avatar
    Join Date
    Apr 2004
    Location
    /etc/php.ini
    Posts
    398
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not using XSL but you use combine PHP and XSL by using echo or print to send PHP variables to the file then when it is accessed it will be parsed.

  7. #7
    SitePoint Enthusiast
    Join Date
    Aug 2004
    Location
    UAE
    Posts
    36
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    how to make that dear

  8. #8
    SitePoint Addict DA Master's Avatar
    Join Date
    Apr 2004
    Location
    /etc/php.ini
    Posts
    398
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not sure... not really used XSL before but looking in the PHP manual they have XSL functions...

    http://uk2.php.net/xsl

  9. #9
    SitePoint Enthusiast
    Join Date
    Aug 2004
    Location
    UAE
    Posts
    36
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i've been looking for more than 2 weeks but i didn't get or undertand any thing.

  10. #10
    SitePoint Addict DA Master's Avatar
    Join Date
    Apr 2004
    Location
    /etc/php.ini
    Posts
    398
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try having a search on HotScripts or Google for something with XSL processing in PHP.

  11. #11
    SitePoint Evangelist Will Kelly's Avatar
    Join Date
    May 2005
    Location
    London
    Posts
    475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is just XML data and does not need to be styled via XSLT. It needs to be converted into php data ie an array.

    You need an xml parser to do the job. see this example at php.net
    http://uk2.php.net/manual/en/ref.xml.php#61231

    and this version for accessing remote xml files easier.
    http://uk2.php.net/manual/en/ref.xml.php#59742

  12. #12
    SitePoint Enthusiast
    Join Date
    Aug 2004
    Location
    UAE
    Posts
    36
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i want to store the into variables

    like

    $symbol = $symbol[];
    $price = $price[];



    like that

  13. #13
    SitePoint Evangelist Will Kelly's Avatar
    Join Date
    May 2005
    Location
    London
    Posts
    475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try using one of those classes, i.e. with the version that supports remote files

    PHP Code:
    require("xmlparser.class.php");

    $xml= new XMLParser('http://nwapp.emirates.net.ae/channel/uaefinance/eng/refreshstocksnow.jsp')

    print_r(&$xml->data); 
    You will need to access the elements by their specific keys. Then maybe construct another array that is easier to read?

  14. #14
    SitePoint Evangelist ClickHeRe's Avatar
    Join Date
    Mar 2005
    Location
    Ottawa, Canada
    Posts
    580
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if you are using PHP 5, you can use SimpleXML to have ot parsed as an array.
    David

  15. #15
    SitePoint Enthusiast
    Join Date
    Aug 2004
    Location
    UAE
    Posts
    36
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i am using php4 .... and until now i didn't finde the code that parse the xml to php variables >>>>>>>>>>>>>>>>>>>>>>>..............!!!!!

  16. #16
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try PEAR::XML_Serializer
    There's an excellent tutorial on how to use it here :
    http://www.sitepoint.com/article/xml...xml_serializer

  17. #17
    SitePoint Addict dreado's Avatar
    Join Date
    Jan 2005
    Location
    UK
    Posts
    221
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Will Kelly
    ...this version for accessing remote xml files easier.
    http://uk2.php.net/manual/en/ref.xml.php#59742
    I just tried using this but I got an error saying
    XML error: xml declaration not at start of external entity
    Is there anything I can do about this?
    link

  18. #18
    SitePoint Evangelist
    Join Date
    Apr 2005
    Posts
    485
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Al3in
    i've been looking for more than 2 weeks but i didn't get or undertand any thing.
    this link over at sitepoint's xml forum will give you a good start...

    http://www.sitepoint.com/forums/showthread.php?t=354632

    it doesn't cover xslt or xquery, but it does cover a fair amount of the dom, xml, simplexml, xpath and how it interacts with php5 (make sure you have the latest version of php running since prior versions aren't nearly as up to date and things will break).

    tutorials on the net typically stink due to dom/xml being a bleeding edge capability of php.

    if you follow the linked forum thread, you will gain a decent foundation to build upon - and it is laid out in a simple manner so the concepts are relatively easy to grasp.

  19. #19
    SitePoint Evangelist
    Join Date
    Apr 2005
    Posts
    485
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Al3in
    i am using php4 .... and until now i didn't finde the code that parse the xml to php variables >>>>>>>>>>>>>>>>>>>>>>>..............!!!!!
    php4 has notoriously crappy dom / xml support. you will likely be best served by getting ahold of a php xml class to achieve your goals. you can search phpclasses.org.

    http://www.google.com/custom?domains...D%3A1%3B&hl=en

    good luck.

  20. #20
    SitePoint Wizard
    Join Date
    Mar 2001
    Posts
    3,537
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    php4 has notoriously crappy dom / xml support.
    As far as I can tell, its xml support is perfectly adequate. It uses a simple, event driven parser, which actually can have certain advantages over a DOM based parser.

    I just tried using this but I got an error saying
    XML error: xml declaration not at start of external entity
    Is there anything I can do about this?
    What is that link supposed to demonstrate? Why don't you start by posting your xml file.

  21. #21
    SitePoint Addict dreado's Avatar
    Join Date
    Jan 2005
    Location
    UK
    Posts
    221
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by 7stud
    What is that link supposed to demonstrate? Why don't you start by posting your xml file.
    Sorry, I thought all the info would be in he source. xml file is here


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •