Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-21-2012, 06:07 PM   PM User | #16
AndrewGSW
Senior Coder

 
Join Date: Apr 2011
Location: London, England
Posts: 2,120
Thanks: 15
Thanked 354 Times in 353 Posts
AndrewGSW will become famous soon enough
Wikipedia cf the xsl: prefix in your previous document.
Quote:
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
AndrewGSW is offline   Reply With Quote
Users who have thanked AndrewGSW for this post:
guytrance (12-21-2012)
Old 12-21-2012, 07:23 PM   PM User | #17
hdewantara
Regular Coder

 
hdewantara's Avatar
 
Join Date: Aug 2009
Location: Jakarta, Indonesia.
Posts: 287
Thanks: 4
Thanked 39 Times in 39 Posts
hdewantara is an unknown quantity at this point
@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 07:28 PM..
hdewantara is offline   Reply With Quote
Users who have thanked hdewantara for this post:
guytrance (12-21-2012)
Old 12-21-2012, 07:39 PM   PM User | #18
AndrewGSW
Senior Coder

 
Join Date: Apr 2011
Location: London, England
Posts: 2,120
Thanks: 15
Thanked 354 Times in 353 Posts
AndrewGSW will become famous soon enough
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.
Quote:
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
AndrewGSW is offline   Reply With Quote
Users who have thanked AndrewGSW for this post:
guytrance (12-21-2012)
Old 12-21-2012, 09:18 PM   PM User | #19
guytrance
New to the CF scene

 
Join Date: Aug 2012
Posts: 9
Thanks: 12
Thanked 0 Times in 0 Posts
guytrance is an unknown quantity at this point
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 09:21 PM..
guytrance is offline   Reply With Quote
Reply

Bookmarks

Tags
jquery, php, xml

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:03 PM.


Advertisement
Log in to turn off these ads.