Reputation: 4151
Created XML not opening in browser and it throws error.
My xml:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<newsitem>
<contentmeta>
<contentCreated>05/11/2014</contentCreated>
<contentModified>05/11/2014</contentModified>
<classification1>*NULL*</classification1>
<classification2>*NULL*</classification2>
<geolocation1>*NULL*</geolocation1>
<geolocation2>*NULL*</geolocation2>
<title>1</title>
<headline>2</headline>
<subtitle>3</subtitle>
<dateline>4</dateline>
<bodytext>5 4 3 2 1<b><br>5 4 3 2</b><b><br>5 4 3</b><b><br>5 4</b><b><br>5</b> </bodytext> ---> Error in this line
<Keywords>*NULL*</Keywords>
<pdfurl>BGL_2014_11_05_AM_01_MN.PDF</pdfurl>
</contentmeta>
</newsitem>
Error: 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.
End tag 'b' does not match the start tag 'br'. Error processing resource 'file:///C:/Documents and Settings/admin/My Docume...
5 4 3 2 1
5 4 3 2
5 4 3
5 4
Upvotes: 0
Views: 57
Reputation: 141588
Your bodytext
element looks like it is suppose to contain HTML, however you are entering it literally so it is being treated as XML.
XML is strict - every element must have a matching closing element, and be "balanced". In the case of your <br>
elements, they have no matching closing element.
You have two options. You can either close the <br>
element like <br />
, or you can treat the bodytext
as CDATA, like so:
<bodytext><![CDATA[ 5 4 3 2 1<b><br>5 4 3 2</b><b><br>5 4 3</b><b><br>5 4</b><b><br>5</b> ]]></bodytext>
The latter might be more preferable, as the semantics behind XML and HTML aren't exactly the same (otherwise you are basically forcing yourself to write XHTML). This allows you to enter whatever you want and not have it treated as XML.
Upvotes: 2
Reputation: 9619
The br
tag is not closed!
Close it either as <br/>
or as <br> ... </br>
.
Upvotes: 1
Reputation: 49803
Just like the message says: you close a b
tag before closing the current br
tag. Remember, this is XML, not HTML; if you have a tag that does not have a closing tag (like br
), you have to indicate it by using <br/>
. (Like @gp. said, but more succinctly.)
Upvotes: 1