471,610 Members | 1,383 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,610 software developers and data experts.

Urgent! What is wrong with this XML file

K R
Hi,

I have generated this XML from my application. But, when I open this
XML, it is throwing error. Please help me to resolve this.

<?xml version="1.0" encoding="utf-8" ?>
<searchResults>
<totalhits>16916</totalhits>
<searchquery>*</searchquery>
<timetaken>TIME TAKEN</timetaken>
<resultsperpage>10</resultsperpage>
<currentpage>CURRENT PAGE</currentpage>
<totalpages>1692</totalpages>
<content>
<title>Web Title...</title>
<reference>http://www7.hdb.gov.sg/isoa032p.nsf/...c95d08d748256d
be001f6848?OpenView&CollapseView</reference>
<rank>1</rank>
<weight>96.00</weight>
<date>04 Nov 2004</date>
<summary>Web Title.... Web Title . </summary>
</content>
<content>
<title>Web Title...</title>
<reference>http://www7.hdb.gov.sg/isoa032p.nsf/...c95d08d748256d
be001f6848?OpenView&ExpandView</reference>
<rank>2</rank>
<weight>96.00</weight>
<date>04 Nov 2004</date>
<summary>Web Title.... Web Title . </summary>
</content>
<content>
<title>Web Title...</title>
<reference>http://www7.hdb.gov.sg/isoa032p.nsf/...C95D08D748256D
BE001F6848/</reference>
<rank>3</rank>
<weight>96.00</weight>
<date>04 Nov 2004</date>
<summary>Web Title.... Web Title . </summary>
</content>
<content>
<title>Free Parking on Sundays and Public Holidays</title>
<reference>http://www7.hdb.gov.sg/isoa029p.nsf/...ew/2586B730068
056DC48256F4200126775</reference>
<rank>4</rank>
<weight>96.00</weight>
<date>04 Nov 2004</date>
<summary>Free Parking on Sundays and Public Holidays. Free Parking on
Sundays and Public Holidays Free Parking on Sundays and Public Holidays
The Free Parking Scheme on Sundays and Public Holidays will be
implemented at the following coupon parking multi-storey car park with
effect from 7 November 2004 </summary>
</content>
<content>
<title>Web Title...</title>
<reference>http://www7.hdb.gov.sg/isoa032p.nsf/...c95d08d748256d
be001f6848?OpenView&Start=1&Count=30&CollapseView</reference>
<rank>5</rank>
<weight>96.00</weight>
<date>04 Nov 2004</date>
<summary>Web Title.... Web Title . </summary>
</content>
<content>
<title>Web Title...</title>
<reference>http://www7.hdb.gov.sg/isoa032p.nsf/...c95d08d748256d
be001f6848?OpenView&Start=1&Count=30&ExpandView</reference>
<rank>6</rank>
<weight>96.00</weight>
<date>04 Nov 2004</date>
<summary>Web Title.... Web Title . </summary>
</content>
<content>
<title>Press Releases Notice: Click for an overview of the
M...</title>
<reference>http://www7.hdb.gov.sg/isoa032p.nsf/...c95d08d748256d
be001f6848/8191c55686c0407a48256f3700049180?OpenDocument</reference>
<rank>7</rank>
<weight>96.00</weight>
<date>04 Nov 2004</date>
<summary>Press Releases Notice: Click for an overview of the M....
Press Releases Notice: Click for an overview of the Marriage and
Parenthood Schemes . More under , and . | | | | | Housing &amp;
Development Board Best Viewed with IE 5.0 and above, 800 x 600
resolution HDB HUB, 480 Lorong 6 Toa Payoh, </summary>
</content>
<content>
<title>Web Title...</title>
<reference>http://www7.hdb.gov.sg/isoa032p.nsf/...c95d08d748256d
be001f6848?OpenView&Start=1&Count=30&Collapse=1</reference>
<rank>8</rank>
<weight>96.00</weight>
<date>04 Nov 2004</date>
<summary>Web Title.... Web Title . </summary>
</content>
<content>
<title>Press Releases Notice: Click for an overview of the
M...</title>
<reference>http://www7.hdb.gov.sg/isoa032p.nsf/...c95d08d748256d
be001f6848/70b762f7dfbedbec48256f4000095dc7?OpenDocument</reference>
<rank>9</rank>
<weight>96.00</weight>
<date>04 Nov 2004</date>
<summary>Press Releases Notice: Click for an overview of the M....
Press Releases Notice: Click for an overview of the Marriage and
Parenthood Schemes . More under , and . | | | | | Housing &amp;
Development Board Best Viewed with IE 5.0 and above, 800 x 600
resolution HDB HUB, 480 Lorong 6 Toa Payoh, </summary>
</content>
<content>
<title>Web Title...</title>
<reference>http://www7.hdb.gov.sg/isoa032p.nsf/...c95d08d748256d
be001f6848?OpenView&Start=1&Count=30&Expand=1</reference>
<rank>10</rank>
<weight>96.00</weight>
<date>04 Nov 2004</date>
<summary>Web Title.... Web Title . </summary>
</content>
</searchResults>

Regards.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #1
3 1446
It's not valid XML, that's what's wrong with it. & denotes an entity and XML
knows only three entities on its own: &quot; &lt; and &gt;. But your "XML"
contains entities such as &CollapseView or &ExpandView (and it's missing the
; to end those). If those were supposed to be ampersands you need to encode
them.

Jerry

"K R" <kr*********@gmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi,

I have generated this XML from my application. But, when I open this
XML, it is throwing error. Please help me to resolve this.

<?xml version="1.0" encoding="utf-8" ?>
<searchResults>
<totalhits>16916</totalhits>
<searchquery>*</searchquery>
<timetaken>TIME TAKEN</timetaken>
<resultsperpage>10</resultsperpage>
<currentpage>CURRENT PAGE</currentpage>
<totalpages>1692</totalpages>
<content>
<title>Web Title...</title>
<reference>http://www7.hdb.gov.sg/isoa032p.nsf/...c95d08d748256d
be001f6848?OpenView&CollapseView</reference>
<rank>1</rank>
<weight>96.00</weight>
<date>04 Nov 2004</date>
<summary>Web Title.... Web Title . </summary>
</content>
<content>
<title>Web Title...</title>
<reference>http://www7.hdb.gov.sg/isoa032p.nsf/...c95d08d748256d
be001f6848?OpenView&ExpandView</reference>
<rank>2</rank>
<weight>96.00</weight>
<date>04 Nov 2004</date>
<summary>Web Title.... Web Title . </summary>
</content>
<content>
<title>Web Title...</title>
<reference>http://www7.hdb.gov.sg/isoa032p.nsf/...C95D08D748256D
BE001F6848/</reference>
<rank>3</rank>
<weight>96.00</weight>
<date>04 Nov 2004</date>
<summary>Web Title.... Web Title . </summary>
</content>
<content>
<title>Free Parking on Sundays and Public Holidays</title>
<reference>http://www7.hdb.gov.sg/isoa029p.nsf/...ew/2586B730068
056DC48256F4200126775</reference>
<rank>4</rank>
<weight>96.00</weight>
<date>04 Nov 2004</date>
<summary>Free Parking on Sundays and Public Holidays. Free Parking on
Sundays and Public Holidays Free Parking on Sundays and Public Holidays
The Free Parking Scheme on Sundays and Public Holidays will be
implemented at the following coupon parking multi-storey car park with
effect from 7 November 2004 </summary>
</content>
<content>
<title>Web Title...</title>
<reference>http://www7.hdb.gov.sg/isoa032p.nsf/...c95d08d748256d
be001f6848?OpenView&Start=1&Count=30&CollapseView</reference>
<rank>5</rank>
<weight>96.00</weight>
<date>04 Nov 2004</date>
<summary>Web Title.... Web Title . </summary>
</content>
<content>
<title>Web Title...</title>
<reference>http://www7.hdb.gov.sg/isoa032p.nsf/...c95d08d748256d
be001f6848?OpenView&Start=1&Count=30&ExpandView</reference>
<rank>6</rank>
<weight>96.00</weight>
<date>04 Nov 2004</date>
<summary>Web Title.... Web Title . </summary>
</content>
<content>
<title>Press Releases Notice: Click for an overview of the
M...</title>
<reference>http://www7.hdb.gov.sg/isoa032p.nsf/...c95d08d748256d
be001f6848/8191c55686c0407a48256f3700049180?OpenDocument</reference>
<rank>7</rank>
<weight>96.00</weight>
<date>04 Nov 2004</date>
<summary>Press Releases Notice: Click for an overview of the M....
Press Releases Notice: Click for an overview of the Marriage and
Parenthood Schemes . More under , and . | | | | | Housing &amp;
Development Board Best Viewed with IE 5.0 and above, 800 x 600
resolution HDB HUB, 480 Lorong 6 Toa Payoh, </summary>
</content>
<content>
<title>Web Title...</title>
<reference>http://www7.hdb.gov.sg/isoa032p.nsf/...c95d08d748256d
be001f6848?OpenView&Start=1&Count=30&Collapse=1</reference>
<rank>8</rank>
<weight>96.00</weight>
<date>04 Nov 2004</date>
<summary>Web Title.... Web Title . </summary>
</content>
<content>
<title>Press Releases Notice: Click for an overview of the
M...</title>
<reference>http://www7.hdb.gov.sg/isoa032p.nsf/...c95d08d748256d
be001f6848/70b762f7dfbedbec48256f4000095dc7?OpenDocument</reference>
<rank>9</rank>
<weight>96.00</weight>
<date>04 Nov 2004</date>
<summary>Press Releases Notice: Click for an overview of the M....
Press Releases Notice: Click for an overview of the Marriage and
Parenthood Schemes . More under , and . | | | | | Housing &amp;
Development Board Best Viewed with IE 5.0 and above, 800 x 600
resolution HDB HUB, 480 Lorong 6 Toa Payoh, </summary>
</content>
<content>
<title>Web Title...</title>
<reference>http://www7.hdb.gov.sg/isoa032p.nsf/...c95d08d748256d
be001f6848?OpenView&Start=1&Count=30&Expand=1</reference>
<rank>10</rank>
<weight>96.00</weight>
<date>04 Nov 2004</date>
<summary>Web Title.... Web Title . </summary>
</content>
</searchResults>

Regards.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 12 '05 #2
Hi KR

You have URLs in your document containing Query Strings, where name value
pairs are encoded as name=value&name=value...

As Jerry says, you need to escape ampersand characters as &amp;

Nigel

"K R" wrote:
Hi,

I have generated this XML from my application. But, when I open this
XML, it is throwing error. Please help me to resolve this.

<?xml version="1.0" encoding="utf-8" ?>
<searchResults>
<totalhits>16916</totalhits>
<searchquery>*</searchquery>
<timetaken>TIME TAKEN</timetaken>
<resultsperpage>10</resultsperpage>
<currentpage>CURRENT PAGE</currentpage>
<totalpages>1692</totalpages>
<content>
<title>Web Title...</title>
<reference>http://www7.hdb.gov.sg/isoa032p.nsf/...c95d08d748256d
be001f6848?OpenView&CollapseView</reference>
<rank>1</rank>
<weight>96.00</weight>
<date>04 Nov 2004</date>
<summary>Web Title.... Web Title . </summary>
</content>
<content>
<title>Web Title...</title>
<reference>http://www7.hdb.gov.sg/isoa032p.nsf/...c95d08d748256d
be001f6848?OpenView&ExpandView</reference>
<rank>2</rank>
<weight>96.00</weight>
<date>04 Nov 2004</date>
<summary>Web Title.... Web Title . </summary>
</content>
<content>
<title>Web Title...</title>
<reference>http://www7.hdb.gov.sg/isoa032p.nsf/...C95D08D748256D
BE001F6848/</reference>
<rank>3</rank>
<weight>96.00</weight>
<date>04 Nov 2004</date>
<summary>Web Title.... Web Title . </summary>
</content>
<content>
<title>Free Parking on Sundays and Public Holidays</title>
<reference>http://www7.hdb.gov.sg/isoa029p.nsf/...ew/2586B730068
056DC48256F4200126775</reference>
<rank>4</rank>
<weight>96.00</weight>
<date>04 Nov 2004</date>
<summary>Free Parking on Sundays and Public Holidays. Free Parking on
Sundays and Public Holidays Free Parking on Sundays and Public Holidays
The Free Parking Scheme on Sundays and Public Holidays will be
implemented at the following coupon parking multi-storey car park with
effect from 7 November 2004 </summary>
</content>
<content>
<title>Web Title...</title>
<reference>http://www7.hdb.gov.sg/isoa032p.nsf/...c95d08d748256d
be001f6848?OpenView&Start=1&Count=30&CollapseView</reference>
<rank>5</rank>
<weight>96.00</weight>
<date>04 Nov 2004</date>
<summary>Web Title.... Web Title . </summary>
</content>
<content>
<title>Web Title...</title>
<reference>http://www7.hdb.gov.sg/isoa032p.nsf/...c95d08d748256d
be001f6848?OpenView&Start=1&Count=30&ExpandView</reference>
<rank>6</rank>
<weight>96.00</weight>
<date>04 Nov 2004</date>
<summary>Web Title.... Web Title . </summary>
</content>
<content>
<title>Press Releases Notice: Click for an overview of the
M...</title>
<reference>http://www7.hdb.gov.sg/isoa032p.nsf/...c95d08d748256d
be001f6848/8191c55686c0407a48256f3700049180?OpenDocument</reference>
<rank>7</rank>
<weight>96.00</weight>
<date>04 Nov 2004</date>
<summary>Press Releases Notice: Click for an overview of the M....
Press Releases Notice: Click for an overview of the Marriage and
Parenthood Schemes . More under , and . | | | | | Housing &
Development Board Best Viewed with IE 5.0 and above, 800 x 600
resolution HDB HUB, 480 Lorong 6 Toa Payoh, </summary>
</content>
<content>
<title>Web Title...</title>
<reference>http://www7.hdb.gov.sg/isoa032p.nsf/...c95d08d748256d
be001f6848?OpenView&Start=1&Count=30&Collapse=1</reference>
<rank>8</rank>
<weight>96.00</weight>
<date>04 Nov 2004</date>
<summary>Web Title.... Web Title . </summary>
</content>
<content>
<title>Press Releases Notice: Click for an overview of the
M...</title>
<reference>http://www7.hdb.gov.sg/isoa032p.nsf/...c95d08d748256d
be001f6848/70b762f7dfbedbec48256f4000095dc7?OpenDocument</reference>
<rank>9</rank>
<weight>96.00</weight>
<date>04 Nov 2004</date>
<summary>Press Releases Notice: Click for an overview of the M....
Press Releases Notice: Click for an overview of the Marriage and
Parenthood Schemes . More under , and . | | | | | Housing &
Development Board Best Viewed with IE 5.0 and above, 800 x 600
resolution HDB HUB, 480 Lorong 6 Toa Payoh, </summary>
</content>
<content>
<title>Web Title...</title>
<reference>http://www7.hdb.gov.sg/isoa032p.nsf/...c95d08d748256d
be001f6848?OpenView&Start=1&Count=30&Expand=1</reference>
<rank>10</rank>
<weight>96.00</weight>
<date>04 Nov 2004</date>
<summary>Web Title.... Web Title . </summary>
</content>
</searchResults>

Regards.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 12 '05 #3
K R wrote:
I have generated this XML from my application.
Never generate XML by hands. Always use XML API such as XmlTextWriter.
But, when I open this
XML, it is throwing error. Please help me to resolve this.


& must be esacaped as &amp; in XML.

--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com
Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by VbUser25 | last post: by
9 posts views Thread by Stefan Bauer | last post: by
28 posts views Thread by Tamir Khason | last post: by
4 posts views Thread by EricJ | last post: by
7 posts views Thread by deepagulati | last post: by
3 posts views Thread by N. Spiker | last post: by
1 post views Thread by rajesh.us.it.recruiter | last post: by
1 post views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by MichaelMortimer | last post: by
reply views Thread by CCCYYYY | last post: by
1 post views Thread by ZEDKYRIE | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.