开发者

XML not validating?

开发者 https://www.devze.com 2023-02-10 23:06 出处:网络
Never really worked with XML before, b开发者_StackOverflow社区ut how come this isn\'t validating:

Never really worked with XML before, b开发者_StackOverflow社区ut how come this isn't validating:

http://test.ipalaces.org/palnfo/template.xml


With w3schools i get Error: Object # has no method 'load'


You're using Chrome, aren't you? Your XML is fine; the w3schools validator is not.

Consider using a different online validator, or installing one locally. You may even find you've got a basic one installed somewhere already, depending on your OS (xmllint came pre-installed on my Mac, for example.)

Incidentally, you're also probably not actually "validating", technically, rather checking for "well-formedness". To validate you'd need a DTD or XSD.


What you got here is a Javascript error.

From the w3schools validator :

<script language="JavaScript" type="text/javascript">
document.write("<h2>Result of Validating: http://test.ipalaces.org/palnfo/template.xml</h2>");
// code for IE
if (window.ActiveXObject)
{
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async="false";
xmlDoc.validateOnParse="true";
xmlDoc.load("http://test.ipalaces.org/palnfo/template.xml"); // <--- ERROR HERE 

2 solutions :

  • Stop using IE (whatever version you're using) or any other uncompatible (with this validator) web browser you're using.
  • Stop using w3schools validator which sucks. (use the w3c one which is the more official or this one)

EDIT :

I'll add that, in general, please, avoid w3schools and go to official manual or website.

First because http://w3fools.com and then because there's better! For everything about HTML, XHTML, XML, search for it and "w3c" in google. For Javascript, use "MDC"+whatever-you're-looking-for, for php, go to their manual


Seems ok to me. When I ran it against the w3schools validator I got this message:

Result of Validating: http://test.ipalaces.org/palnfo/template.xml

Doesn't really tell you anything but no obvious error message. How are you validating it?

Also, this might be a shot in the dark but are you sure this isn't a jQuery error? I did a quick search of your error message and found two SO posts that had very similar error messages:

  • jQuery issue - #<an Object> has no method
  • Weird Chrome prototype/jQuery conflict


I think it's an error on their javascript.

It seems to be fixed. It validated with me. Can you try again ?

You used this URL http://www.w3schools.com/site/site_validate.asp right ? Fourth section Right ?

It also depends on the browser you use to access the validation page because as you might know different browser load XML files in different ways. What browser did you use ?

0

精彩评论

暂无评论...
验证码 换一张
取 消