How to solve validation error on xsi:noNamespaceSchemaLocation in jdoconfig.xml
Asked Answered
S

8

13

Since I updated today to GAE 1.7.2.1, I'm having validation errors in eclipse in all my jdoconfig.xml files.

I have the default jdoconfig.xml content :

[...]
<jdoconfig xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:noNamespaceSchemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig">
[...]

And eclipse validation throws:

Referenced file contains errors (http://java.sun.com/xml/ns/jdo/jdoconfig).  
For more information, right click on the message in the Problems View and 
select "Show Details..."

When clicking on details I can see a bunch of lines like:

s4s-elt-character: Non-whitespace characters are not allowed in schema elements
other than 'xs:appinfo' and 'xs:documentation'. Saw 'var_U = "undefined";'.

In different lines and different content in "Saw ... "

It occurs in every single project I start using the "New Web Application Project..." from the google plugin.

So does anyone have this problem? Any fix?

Stammer answered 29/9, 2012 at 16:46 Comment(0)
E
28

Try this:

<jdoconfig xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig http://java.sun.com/xml/ns/jdo/jdoconfig_3_0.xsd">

Per the answer here Validating jdoconfig with incorrect url

The xmlns is not a real file/directory, more a namespace, so ought not exist! The version is appended to get the real XSD file, namely http://java.sun.com/xml/ns/jdo/jdoconfig_3_0.xsd

Euphonium answered 2/10, 2012 at 21:19 Comment(4)
I had a similar issue and that fixed it. Sorry it didn't work for you. Can you give more background as to what you are doing and why you have a jdoconfig.xml file? Are you using a SOAP client, or what? Was this working prior to 1.7.2.1 (if so what version)?Euphonium
My fault, I didn't actually do that.Stammer
The "trick" to this solution that is easy to miss is that the default value for the schema location line when creating a new GAE Web Application Project is: xsi:noNamespaceSchemaLocation and the change to: xsi:SchemaLocation slipped past me on my first viewing. I think the answer should be edited to call out this change and it will be less prone to causing false negatives.Depraved
Rex Remus, your comment helped. I was copying the xsd location, but not changing the xsi:noNamespaceSchemaLocation to xsi:SchemaLocation continued to give the error. Changing to xsi:SchemaLocation with xsd path resolved the error.Photomontage
C
6

There are a couple problems here.

The syntactic problem is that the URI you are giving as the value of xsi:noNamespaceSchemaLocation is redirected to http://www.oracle.com/technetwork/java/index.html and returns an HTML document. The XSD validator you are using is trying without success to parse

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" 
          content="text/html; charset=utf-8" />
    <script type="text/javascript">
      var _U = "undefined";
      var g_HttpRelativeWebRoot = "/ocom/";
      var SSContributor = false;
...

as an XSD schema document, and for one reason or another its attempts to explain what went wrong focus on finding the string var_U = "undefined" in a place where it was not expecting to see character data.

Then there are some conceptual problems.

  • Your document is in a namespace named http://java.sun.com/xml/ns/jdo/jdoconfig. Why on earth are you pointing the schema validator to a schema without a target namespace (which is that noNamespaceSchemaLocation does), if you want to validate your document? Given that (at least some of) your document's elements are namespace-qualified, you will want (as joncalhoun has already suggested) to use xsi:schemaLocation and provide a pair telling the validator where it can find a schema document for each namespace you want it to know about.

  • It's possible that a schema document used to be served from the location http://java.sun.com/xml/ns/jdo/jdoconfig, but since it's apparently the standard namespace named for your vocabulary, that's not actually very likely. Most systems distinguish fairly reliably between namespaces, which are abstract and poorly defined things, and schema documents, which are typically XML documents that define specific XSD schema components for a given namespace. It's not illegal to use the URI for a schema document as the name of a namespace, but it is unusual.

Note that the URL given by joncalhoun for the schema document (http://java.sun.com/xml/ns/jdo/jdoconfig_3_0.xsd) actually does resolve (after redirection to http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/jdo/jdoconfig_3_0.xsd) to a schema document, which specifies http://java.sun.com/xml/ns/jdo/jdoconfig as its target namespace. (This means that even if you did succeed in retrieving this schema document by giving its URI as the value of xsi:noNamespaceSchemaLocation, you'd then get an error because it's not a schema document for elements and attributes with no namespace.)

This makes me think that you should read joncalhoun's answer again and try it again, carefully. If it didn't work when you tried it, my money says that either you tried something similar but not exactly what he suggested, or it solved this problem but that simply exposed some other problem, which is easy to mistake for failure.

Cypriot answered 16/10, 2012 at 16:18 Comment(2)
Very comprehensive and educational. Thanks, and of course, my fault for not to carefully read and try @joncalhoun's answer.Stammer
Excellent analysis of the issue. See my comment on joncalhoun's answer as to suggested edits that might help clarify why someone might not "see" the changes he suggests.Depraved
E
4

One solution is setting XML Catalog in Eclipse preferences.

Details:
Entry element: URI
Location: http://java.sun.com/xml/ns/jdo/jdoconfig_3_0.xsd
URI: http://java.sun.com/xml/ns/jdo/jdoconfig_3_0.xsd
Key type: Namespace name
Key: http://java.sun.com/xml/ns/jdo/jdoconfig

Earthaearthborn answered 4/12, 2012 at 17:1 Comment(0)
Q
0

The syntactic and conceptual issues C.M. mentions are a problem with the plugin and Google's settings where both recommend,

xsi:noNamespaceSchemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig

I don't specifically use jdo but I still get the validation error with this namespace. It was fine with this namespace until just recently.

I used LuboM's method and it worked for me. Neither LuboM's nor joncalhoun's is the answer though since it ties me in to jdo 3.0

Oracle is going to have to provide the fix. Apparently their intent was to resolve the namespace issues themselves across versions of jdo.

Quinate answered 1/9, 2013 at 19:15 Comment(0)
S
0

You might have try this path to solve your problem:

<?xml version="1.0" encoding="utf-8"?>
<jdoconfig xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:noNamespaceSchemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig">
Sheathe answered 9/6, 2014 at 6:57 Comment(0)
Z
0

This is what I did to fix it:

<?xml version="1.0" encoding="utf-8"?>
<jdoconfig xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:noNamespaceSchemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig_3_0.xsd">
Zachery answered 10/1, 2015 at 16:42 Comment(0)
C
0

I had the same issue, and excluded just this jdoconfig.xml file from Eclipse's validation. Even though your Eclipse throws an error for it, it in no way affects being able to deploy the project to GAE correctly.

Here is how to exclude just the jdoconfig.xml file to get rid of that pesky error:

Right click on your Eclipse Project, ->Properties->Validation->XML Validator, click on the "..." button for further options.

You should see Include Group and Exclude Group options. Click Exclude Group->Add Rule...->Folder or file name, and browse to your file.

Clean or rebuild your project. The validation error should be gone.

This worked for me in Eclipse Luna.

Coronary answered 2/4, 2015 at 22:30 Comment(0)
H
0

I am success on this:

Right Click Project -> Properties -> Validation -> XML Syntax
  1. Enable Project Specific Settings (If you need)
  2. Under Validating Files, For No grammar Specified Select "Warning"
  3. Click "Ok"
  4. If you ask for Validating the file, Click "Yes"

You can do the same for all the projects by going to Windows -> Preferences.

Make sure you are validating the file (Step 4).

Heracliteanism answered 7/4, 2015 at 10:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.