XML syntax issues

Get help on programming - C++, Java, Delphi, etc.
Post Reply
SilverBack
Registered User
Posts: 1387
Joined: 26 Jan 2006, 02:00
Location: JHB
Contact:

XML syntax issues

Post by SilverBack »

Hi,

Putting together an RSS Feed. Having a problem with certain characters like ", -, ' (not the commas). I have no idea why? This is the error I get:
The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.

--------------------------------------------------------------------------------

An invalid character was found in text content. Error processing resource 'file:///C:/Documents and Settings/user/Deskto...

<title>AN END TO DUAL CAUSES OF ACTION IN PUBLIC SECTOR DISMISSALS
Here is the XML:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
   <channel>
       <title>Firm News - Bowman Gilfillan</title>
       <link>http://www.domain.com</link>
       <description>Description of your website</description>
       <language>en-US</language>
       <lastBuildDate>Sat, 07 Sep 2002 09:42:31 GMT</lastBuildDate>
       <category>Law</category>
       <item>
         <title>AN END TO DUAL CAUSES OF ACTION IN PUBLIC SECTOR DISMISSALS – NADIRA DEONARAIN & REGHANA TULK</title>
         <description>The protective ambit of the now repealed 1956 Labour Relations Act (“the 1956 LRA”) did not extend to State employees. Separate legislation governed the employment relationship between the State and its workforce, the terms of which were not as favourable as the protection extended to employees covered by the 1956 LRA. In an effort to supplement the rights of State employees, our Courts have held that the public character of State employers rendered the decision to dismiss an exercise of public power, thus bringing it within the ambit of administrative law. Dismissed State employees also had a cause of action under labour law. In effect then, State employees enjoyed a dual cause of action upon dismissal.  </description>
         <pubDate>4/17/2008</pubDate>
       </item>
       <item>
         <title>A JOINT EMPLOYMENT RELATIONSHIP? – NADIRA DEONARAIN</title>
         <description>The tripartite relationship
		Our law recognises the concept of a temporary employment service (“TES”). Section 198 of the Labour Relations Act 66 of 1995 (“the LRA”) provides, in relevant part, as follows:
	</description>
         <pubDate>4/17/2008</pubDate>
       </item>
       <item>
         <title>THE RIGHT TO ADEQUATE HOUSING VS EXECUTION AGAINST IMMOVABLE PROPERTY: THE CONSTITUTIONAL PERSPECTIVE – SALLY D’ARCYDONNELLY</title>
         <description>Every person has the right of access to adequate housing. It is the duty of the State to take reasonable legislative and other measures to achieve the progressive realisation of this right.  This is according to Section 26 of the Constitution.</description>
         <pubDate>4/17/2008</pubDate>
       </item>
       <item>
         <title>DEALING WITH MEDICAL SCHEMES’ RESERVES IN CORPORATE DISPOSALS  DAVID GERAL</title>
         <description>Corporate disposals and unbundlings do not pose significant legal difficulties where the medical schemes providing the services to the companies involved are open, public schemes. When one of the schemes is a private scheme whose membership is defined as the employees within that particular group, legal difficulties can arise. </description>
         <pubDate>4/17/2008</pubDate>
       </item>
       <item>
         <title>WHEN  A PARENT IS PERSONALLY LIABLE FOR FAILING TO SUPERVISE A CHILD – PUMZO MBANA</title>
         <description>One Saturday morning, Albert Wessels drove his father’s bakkie with four teenage passengers in the load bay. At the time, Albert was 16 years and 10 months old, and was an unlicensed driver.  </description>
         <pubDate>4/17/2008</pubDate>
       </item>
       <item>
         <title>THE RELEVANCE OF PRIOR TRADE MARK USE IN SOUTH AFRICAN COMMON LAW  WIM ALBERTS</title>
         <description>The nature of the right protected by the law relating to unlawful competition is the right to goodwill, although the right to a trade secret can also feature.</description>
         <pubDate>4/9/2008</pubDate>
       </item>
       <item>
         <title>OFF DUTY MISCONDUCT – TO DISCIPLINE OR NOT TO DISCIPLINE – KAREN FULTON & EVA MUDELY</title>
         <description>Generally, what an employee does after work hours is of no concern to his employer, who has no right to institute disciplinary proceedings against an employee unless it can be shown by the employer that it has some interest in the conduct of the employee outside the workplace.</description>
         <pubDate>4/7/2008</pubDate>
       </item>
       <item>
         <title>LAND EXPROPRIATION DRAFT BILL BOUND TO SPARK LIVELY DEBATE  YETUNDE ONAGORUWA AND RONEL STRAUGHAN</title>
         <description>Public comment on the national government’s recentlydrafted Land Expropriation Bill is likely to spark lively debate, much of it heated and emotive.</description>
         <pubDate>4/7/2008</pubDate>
       </item>
       <item>
         <title>ARTICLE 6: COMPANIES BILL: DEBENTURES  KELEBOGILE MODISE</title>
         <description>South Africa’s upcoming corporate law amendments effect sweeping changes to the legislation governing corporate finance in general, including the nature of debentures in particular.</description>
         <pubDate>4/2/2008</pubDate>
       </item>
       <item>
         <title>LIMITATION CLAUSES IN AUDITORS’ SERVICE AGREEMENTS WITH PENSION FUNDS – DAVID GERAL</title>
         <description>Consumers of services provided by auditors are accustomed to clauses in the standard service agreement limiting the auditors’ liability for certain services.  Typically auditors’ standard service agreements provide that the maximum liability of the auditors in respect of services other than “statutory” audit services (described below) shall be limited to a multiple of the fees charged for those nonaudit services.  </description>
         <pubDate>3/27/2008</pubDate>
       </item>
   </channel>
</rss>
Any ideas why its giving me hell about the hyphen here. I removed hyphens to try see if that sorts the issue. It did, but then quotes and double quotes gave errors. So Im not sure why its moaning as this should run fine?

I tried changing the encoding from UTF-8 to something else. It did run, but then the hyphens, quotes etc didnt display. All that displayed was an empty square.

Please let me know what is wrong with my XML and how I can fix it. Greatly appreciated! ;)

EDIT: I forgot to add that I create this file dynamically with classic ASP and the file system object. Nothing fancy at all.
Deja Moo: The feeling that you've heard this bull before.
Hire A Programmer -|- Just Source Code Blog
SilverBack
Registered User
Posts: 1387
Joined: 26 Jan 2006, 02:00
Location: JHB
Contact:

Post by SilverBack »

Oooooh....no replies. No worries, I have the answer after trial and error. I removed the FSO and used the MS XMLDOM object instead. All I had to do was make sure that any "&" characters were replaced by "&". If you dont replace the ampersands as stated, you get errors.

Unfort cant add the code as it keeps giving me "The html tags you attempted to use are not allowed" errors, even when adding the "

Code: Select all

" tags around it...oh well
Deja Moo: The feeling that you've heard this bull before.
Hire A Programmer -|- Just Source Code Blog
maxxis
Moderator Emeritus
Posts: 8307
Joined: 30 Jun 2004, 02:00
Location: ( . Y . )
Contact:

Post by maxxis »

Was about to comment on that.

Indeed it is required to swop & with &

Glad you came right.
SilverBack
Registered User
Posts: 1387
Joined: 26 Jan 2006, 02:00
Location: JHB
Contact:

Post by SilverBack »

Thanks...but now stuck again :( Gonna post up new thread...
Deja Moo: The feeling that you've heard this bull before.
Hire A Programmer -|- Just Source Code Blog
Post Reply