Closed Bug 26311 Opened 26 years ago Closed 26 years ago

XML parser parses inside script and breaks on '<'

Categories

(Core :: DOM: Core & HTML, defect, P3)

x86
Windows 2000
defect

Tracking

()

VERIFIED WONTFIX

People

(Reporter: everett, Assigned: vidur)

Details

<bookstore xmlns:html="http://www.w3.org/TR/REC-html40"> booklist <book genre="autobiography" name='firstbook'> book1 <title>The Autobiography of Benjamin Franklin</title> <author> <first-name>Benjamin</first-name> <last-name>Franklin</last-name> </author> <price>8.99</price> </book> <book genre="novel"> book2 <title>The Confidence Man</title> <author> <first-name>Herman</first-name> <last-name>Melville</last-name> </author> <price>11.99</price> </book> <book genre="philosophy"> book3 <title>The Gorgias</title> <author> <name>Plato</name> </author> <price>9.99</price> </book> <book genre="fiction"> book4 <title>The Black Rose</title> <author> <name>Costain</name> </author> <price>19.99</price> </book> <html:script language="Javascript1.2"> var x = 5 var y = 2 if ( x > y ) { alert(' x > y \n' + x + ' > ' + y ) } if ( x < y ) { alert(' y > x \n' + y + ' > ' + x ) } var ii, astr for ( ii == 0 ; ii < 5 ; ii++ ) { astr += 'x' } alert(astr) </html:script> </bookstore> ---------------------------- Error Returned --------------------------- XML Parsing Error: not well-formed Line Number 48, Column 9 if ( x < y ) (Arrow points to f in 'if' ) It always errors on the line with the '<'; you can switch the two if statements to test this.
That's correct behavior. The contents of the SCRIPT element have to either by enclosed in a CDATA section (http://www.w3.org/TR/REC-xml#sec-cdata-sect) or (ugh...) contain character entities instead of <, > and &.
Status: NEW → RESOLVED
Closed: 26 years ago
Resolution: --- → WONTFIX
verified
Status: RESOLVED → VERIFIED
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.