[GeoNetwork-users] metadata validation / gmd:MD_Metadata namespace

Hi,

I am trying to validate some metadata records on batch import, but I am
getting validation errors. The metadata file in question validates fine in
XML tools and custom schema validation, so I am wondering what the problem
is.

The error message I am getting is:

IllegalArgumentException : Cannot find a namespace to set for element
gmd:MD_Metadata with namespace URI http://www.isotc211.org/2005/gmd

The beginning of my MD file is:

<?xml version="1.0" encoding="UTF-8"?>
<gmd:MD_Metadata xmlns:gmd="http://www.isotc211.org/2005/gmd&quot;
xmlns:gmx="http://www.isotc211.org/2005/gmx&quot;
xmlns:gco="http://www.isotc211.org/2005/gco&quot;
xmlns:xlink="http://www.w3.org/1999/xlink&quot;
xmlns:gts="http://www.isotc211.org/2005/gts&quot;
xmlns:gml="http://www.opengis.net/gml/3.2&quot;
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
xsi:schemaLocation="http://www.isotc211.org/2005/gmd
http://wis.wmo.int/2011/schemata/iso19139_2007/schema/gmd/gmd.xsd
http://www.isotc211.org/2005/gmx
http://wis.wmo.int/2011/schemata/iso19139_2007/schema/gmx/gmx.xsd&quot;&gt;

I should say that I replaced the iso19139 schema in xml/schemas with a
different one copying the new one over the old one, so that GN custom
files are still there. As far as I can see with the eclipse debugger the
GMD namespace is loaded fine. (SchemaLoader.load returns:

{gco=[Namespace: prefix "gco" is mapped to URI
"http://www.isotc211.org/2005/gco&quot;\], gmd=[Namespace: prefix "gmd" is
mapped to URI "http://www.isotc211.org/2005/gmd&quot;\], xlink=[Namespace:
prefix "xlink" is mapped to URI "http://www.w3.org/1999/xlink&quot;\],
srv=[Namespace: prefix "srv" is mapped to URI
"http://www.isotc211.org/2005/srv&quot;\], gml=[Namespace: prefix "gml" is
mapped to URI "http://www.opengis.net/gml/3.2&quot;\], gsr=[Namespace: prefix
"gsr" is mapped to URI "http://www.isotc211.org/2005/gsr&quot;\],
gss=[Namespace: prefix "gss" is mapped to URI
"http://www.isotc211.org/2005/gss&quot;\], gts=[Namespace: prefix "gts" is
mapped to URI "http://www.isotc211.org/2005/gts&quot;\], gmi=[Namespace: prefix
"gmi" is mapped to URI "http://www.isotc211.org/2005/gmi&quot;\],
gmx=[Namespace: prefix "gmx" is mapped to URI
"http://www.isotc211.org/2005/gmx&quot;\]}

The reason for my replacing the schema is that we are using
xmlns:gml="http://www.opengis.net/gml/3.2&quot; rather than
xmlns:gml="http://www.opengis.net/gml&quot; in our medata files.

any hints?
Timo

Hi,

I have found the reason for the error and it might be a bug.

Technically it is because my MD record uses the gmd namespace. The
iso19139 schema specifies the gmi as "target schema" and this is my the
method findSchema fails.

However, findSchema should IMHO not be called at all, since it is only
used to find a prefix for MD not having one. (mine has one).

DataManager:2861 (setNamespacePrefixUsingSchemas ).

//--- if the metadata has no namespace or already has a namespace prefix
//--- then we must skip this phase

Namespace ns = md.getNamespace();
if (ns == Namespace.NO_NAMESPACE )
   return;

I have changed this to:

Namespace ns = md.getNamespace();
if (ns == Namespace.NO_NAMESPACE || !ns.getPrefix().equals("") )
     return;

I do not know the repercussions of this, but maybe I found a bug.

best
Timo

Hi,

I am trying to validate some metadata records on batch import, but I am
getting validation errors. The metadata file in question validates fine in
XML tools and custom schema validation, so I am wondering what the problem
is.

The error message I am getting is:

IllegalArgumentException : Cannot find a namespace to set for element
gmd:MD_Metadata with namespace URI http://www.isotc211.org/2005/gmd

The beginning of my MD file is:

<?xml version="1.0" encoding="UTF-8"?>
<gmd:MD_Metadata xmlns:gmd="http://www.isotc211.org/2005/gmd&quot;
xmlns:gmx="http://www.isotc211.org/2005/gmx&quot;
xmlns:gco="http://www.isotc211.org/2005/gco&quot;
xmlns:xlink="http://www.w3.org/1999/xlink&quot;
xmlns:gts="http://www.isotc211.org/2005/gts&quot;
xmlns:gml="http://www.opengis.net/gml/3.2&quot;
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
xsi:schemaLocation="http://www.isotc211.org/2005/gmd
http://wis.wmo.int/2011/schemata/iso19139_2007/schema/gmd/gmd.xsd
http://www.isotc211.org/2005/gmx
http://wis.wmo.int/2011/schemata/iso19139_2007/schema/gmx/gmx.xsd&quot;&gt;

I should say that I replaced the iso19139 schema in xml/schemas with a
different one copying the new one over the old one, so that GN custom
files are still there. As far as I can see with the eclipse debugger the
GMD namespace is loaded fine. (SchemaLoader.load returns:

{gco=[Namespace: prefix "gco" is mapped to URI
"http://www.isotc211.org/2005/gco&quot;\], gmd=[Namespace: prefix "gmd" is
mapped to URI "http://www.isotc211.org/2005/gmd&quot;\], xlink=[Namespace:
prefix "xlink" is mapped to URI "http://www.w3.org/1999/xlink&quot;\],
srv=[Namespace: prefix "srv" is mapped to URI
"http://www.isotc211.org/2005/srv&quot;\], gml=[Namespace: prefix "gml" is
mapped to URI "http://www.opengis.net/gml/3.2&quot;\], gsr=[Namespace: prefix
"gsr" is mapped to URI "http://www.isotc211.org/2005/gsr&quot;\],
gss=[Namespace: prefix "gss" is mapped to URI
"http://www.isotc211.org/2005/gss&quot;\], gts=[Namespace: prefix "gts" is
mapped to URI "http://www.isotc211.org/2005/gts&quot;\], gmi=[Namespace: prefix
"gmi" is mapped to URI "http://www.isotc211.org/2005/gmi&quot;\],
gmx=[Namespace: prefix "gmx" is mapped to URI
"http://www.isotc211.org/2005/gmx&quot;\]}

The reason for my replacing the schema is that we are using
xmlns:gml="http://www.opengis.net/gml/3.2&quot; rather than
xmlns:gml="http://www.opengis.net/gml&quot; in our medata files.

any hints?
Timo

------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network
management toolset available today. Delivers lowest initial
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
GeoNetwork-users mailing list
GeoNetwork-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geonetwork-users
GeoNetwork OpenSource is maintained at
http://sourceforge.net/projects/geonetwork