htmlxml-parsing

Why does Firefox throw an XML format error when Chrome does not?


Firefox throws a format error on my XML string whereas Chrome parses it without a problem.

I pass a string of XML (in variable 'doc') thus:

var xmlDoc = parseXML(doc);

This works in Chrome, but causes a format error in Firefox.

My header statements are:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html>
<html lang=en></html>

<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8;"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"/>
    <meta http-equiv="X-UA-Compatible"  /> 
    <style>
        v\: * {
        behavior: url(#default#VML);
        display: inline-block
        }
    </style>
</head>

The later code (in pure JS and HTML) uses the XML data to create markers on a via Google Maps API


Solution

  • If you are working with pure XML, remove the HTML-specific tags (, , ).