Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 2 of 2 FirstFirst 12
Results 16 to 19 of 19
  1. #16
    Senior Coder
    Join Date
    Apr 2011
    Location
    London, England
    Posts
    2,120
    Thanks
    15
    Thanked 354 Times in 353 Posts
    Wikipedia cf the xsl: prefix in your previous document.
    In computing, the term Extensible Stylesheet Language (XSL) is used to refer to a family of languages used to transform and render XML documents.
    Historically, the XSL Working Group in W3C produced a draft specification under the name XSL, which eventually split into three parts:
    XSL Transformation (XSLT): is an XML language for transforming XML documents
    XSL Formatting Objects (XSL-FO): an XML language for specifying the visual formatting of an XML document
    the XML Path Language (XPath): a non-XML language used by XSLT, and also available for use in non-XSLT contexts, for addressing the parts of an XML document.
    As a result, the term XSL is now used with a number of different meanings:
    Sometimes it refers to XSLT: this usage is best avoided. However, "xsl" is used both as the conventional namespace prefix for the XSLT namespace, and as the conventional filename suffix for files containing XSLT stylesheet modules
    Sometimes it refers to XSL-FO: this usage can be justified by the fact that the XSL-FO specification carries the title Extensible Stylesheet Language (XSL); however, the term XSL-FO is less likely to be misunderstood
    Sometimes it refers to both languages considered together, or to the working group that develops both languages
    Sometimes, especially in the Microsoft world, it refers to a now-obsolete variant of XSLT developed and shipped by Microsoft as part of MSXML before the W3C specification was finalized
    This article is concerned with the various usages of the term XSL: for details of the various languages embraced by the term, see the relevant article.
    It's confusing that XSL is an acronym for Extensible Stylesheet Language, but it is actually referred to as (and is..) a transformation-language.
    "I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
    Validate your HTML and CSS

  2. Users who have thanked AndrewGSW for this post:

    guytrance (12-21-2012)

  3. #17
    Regular Coder hdewantara's Avatar
    Join Date
    Aug 2009
    Location
    Jakarta, Indonesia.
    Posts
    371
    Thanks
    9
    Thanked 54 Times in 53 Posts
    @AndrewGSW: Wow, it does confuse me too

    But let's go back to the original post:
    PHP Code:
    <?php
    header
    ('Content-Type:text/xml');

    $xml simplexml_load_file("http://**.**.**.**:8000/live.xspf"); 

    echo 
    '<?xml version="1.0" encoding="UTF-8"?><tracks>';
    foreach (
    $xml->trackList->track as $data) {
        
    $radio $data->location;
        
    $song  $data->title;  
        
    $info $data->listeners;
        echo 
    '<track>
                <title>'
    .$song.'</title>
                <listeners>'
    .$info.'</listeners>
                <location>'
    .$radio.'</location>
              </track>'
    ;
    }
    echo 
    '</tracks>';
    ?>
    Perhaps there you could use PHP's htmlspecialchars(), so for example... that $radio line above would become:
    PHP Code:
    $radio htmlspecialchars($data->locationENT_COMPAT ENT_XML1'UTF-8'false); 
    Last edited by hdewantara; 12-21-2012 at 08:28 PM.

  4. Users who have thanked hdewantara for this post:

    guytrance (12-21-2012)

  5. #18
    Senior Coder
    Join Date
    Apr 2011
    Location
    London, England
    Posts
    2,120
    Thanks
    15
    Thanked 354 Times in 353 Posts
    Why not try it? Although, the ampersands I saw were in the title rather than the location.
    Code:
    $xml = simplexml_load_file("http://**.**.**.**:8000/live.xspf");
    My suspicion is, though, that the error is created by the above line. That is, in initially trying to parse the XML. The docs.
    Convert the well-formed XML document in the given file to an object.
    I can only speculate on how to resolve this: reducing the error-reporting level temporarily, loading as a string, operating on the string.. Maybe someone else has experience of this(?).
    "I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
    Validate your HTML and CSS

  6. Users who have thanked AndrewGSW for this post:

    guytrance (12-21-2012)

  7. #19
    New to the CF scene
    Join Date
    Aug 2012
    Posts
    9
    Thanks
    12
    Thanked 0 Times in 0 Posts
    Hey Guys.

    Thank you so much for your help on this! its truly appreciated.

    hdewantara got it right.

    i changed:

    PHP Code:
    $song  $data->title
    to:

    PHP Code:
    $song htmlspecialchars($data->titleENT_COMPAT ENT_XML1'UTF-8'false); 
    It now reads and displays the code with no errors!

    @AndrewGSW - you were also right that the auto generated xml file was from a database, and the only thing to change is the xspf.xml. i did tried your approach but it led to an error..if you want me to reproduce it just drop a line.

    Thank you so much again!
    Last edited by guytrance; 12-21-2012 at 10:21 PM.


 
Page 2 of 2 FirstFirst 12

Tags for this Thread

Posting Permissions

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