SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Jul 2004
    Location
    minneapolis
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Problems with parsing XML

    I am completely new to parsing XML. I am trying to take cNet feeds and parse them, just showing the merchantName and price, with the merchantName acting as a link to the merchant.

    The XML I'm testing from can be found here: http://cooltechzone-cnet.com.com/401...ltechzone-cnet

    This is my XSL document:

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    
     <xsl:output method="html [16]"/>
    
     <xsl:template match="/">
     <table>
    	<tr>
    		<td><b>CoolTechZone.com Deals</b></td>
    	</tr>
      	<tr>
       		<td>
    			<xsl:apply-templates mode="links"/>
    		</td>
       	</tr>
     </table>
     </xsl:template>
    
     <xsl:template match="item" mode="links">
        <a href="{@link}"><xsl:value-of select="merchantName"/></a> <xsl:value-of select="price"/><br/>
      </xsl:template>
    </xsl:stylesheet>
    And I get this error on my page

    Warning: Sablotron error on line 1: XML parser error 4: not well-formed (invalid token) in /home/sunspot/public_html/cooltechzonedev/OLD/components/com_content/content.html.php on line 504
    XSLT processing error: XML parser error 4: not well-formed (invalid token)
    Any help is greatly appreciated.

    Thanks

  2. #2
    SitePoint Member
    Join Date
    Jul 2004
    Location
    minneapolis
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, I found out what the problem was. The ampersands are not encoded in the URLs, that was giving off the error. Now I just need to replace all of the "&" with "&amp;" before parsing the doc.


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
  •