Question

Eclipse marker tab shows some xml problem. This occurred when I checked dynamic web module in the Project Facets.

This is my project hierarchy :

enter image description here

jdconfig.xml (automatically generated) :

<?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">

   <persistence-manager-factory name="transactions-optional">
       <property name="javax.jdo.PersistenceManagerFactoryClass"
       value="org.datanucleus.api.jdo.JDOPersistenceManagerFactory"/>
       <property name="javax.jdo.option.ConnectionURL" value="appengine"/>
       <property name="javax.jdo.option.NontransactionalRead" value="true"/>
       <property name="javax.jdo.option.NontransactionalWrite" value="true"/>
       <property name="javax.jdo.option.RetainValues" value="true"/>
       <property name="datanucleus.appengine.autoCreateDatastoreTxns" value="true"/>
       <property name="datanucleus.appengine.singletonPMFForName" value="true"/>
   </persistence-manager-factory>
</jdoconfig>

Errors shown in the marker window :

cvc-elt.1: Cannot find the declaration of element 'jdoconfig'.

What is the reason I am getting this error ?

Also,what is jdoconfig.xml ?

Was it helpful?

Solution 5

Because its wrong? This page has a simple example http://db.apache.org/jdo/jdoconfig_dtd.html

The documentation of any JDO implementation would explain what that file is for, as would a simple internet search.

A better XML header would be something like

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

OTHER TIPS

Try this instead

  <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">

If there exists no schema as per 'xsi:noNamespaceSchemaLocation', then removing this attribute kills this validation error.

<?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" >
cvc-elt.1: Cannot find the declaration of element 'jdoconfig'.

This is a validation error. It says, that when validating your XML file, parser couldn't find declaration for element <jdconfig> on the referred schema document.

In your case it is probably caused by two different things:

  1. The schemalocation http://java.sun.com/xml/ns/jdo/jdoconfig is incorrect, there is no schema in that address.
  2. The element <jdconfig> has a (default) namespace, yet the schema location refers to non-namespaced schema.
<?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:schemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig 
    http://java.sun.com/xml/ns/jdo/jdoconfig_3_0.xsd">
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top