Revision: 5444
http://geonetwork.svn.sourceforge.net/geonetwork/?rev=5444&view=revAuthor: sppigot
Date: 2009-11-05 01:11:08 +0000 (Thu, 05 Nov 2009)
Log Message:
-----------
Fixes for:
ticket #150 - inserting metadata shown in XML by GeoNetwork returns 'Root element not set'
ticket #167 - metadata records reference wrong validation schema
Modified Paths:
--------------
trunk/src/org/fao/geonet/services/metadata/Show.java
Modified: trunk/src/org/fao/geonet/services/metadata/Show.java
===================================================================
--- trunk/src/org/fao/geonet/services/metadata/Show.java 2009-11-04 15:46:47 UTC (rev 5443)
+++ trunk/src/org/fao/geonet/services/metadata/Show.java 2009-11-05 01:11:08 UTC (rev 5444)
@@ -40,6 +40,7 @@
import org.fao.geonet.lib.Lib;
import org.jdom.Attribute;
import org.jdom.Element;
+import org.jdom.Namespace;
import java.util.TimerTask;
import java.util.Timer;
@@ -115,33 +116,24 @@
//--- get metadata
Element elMd = dm.getMetadata(context, id, false);
- elMd.addNamespaceDeclaration(Csw.NAMESPACE_CSW);
+ // elMd.addNamespaceDeclaration(Csw.NAMESPACE_CSW);
//
// setting schemaLocation
- // TODO currently it's only set for ISO metadata
-
+ // TODO currently it's only set for ISO metadata - this should all move to
+ // the updatefixedinfo.xsl for each schema
+
// document has ISO root element and ISO namespace
- if(elMd.getName().equals("MD_Metadata") && elMd.getNamespaceURI().equals("
http://www.isotc211.org/2005/gmd")) {
- // whether the metadata describes a service
- boolean isServiceMetadata = false;
- Element identificationInfo = elMd.getChild("identificationInfo", Csw.NAMESPACE_GMD);
- if(identificationInfo != null) {
- Element srvIdentification = identificationInfo.getChild("SV_ServiceIdentification", Csw.NAMESPACE_SRV);
- if(srvIdentification != null) {
- isServiceMetadata = true;
- }
+ Namespace gmdNs = elMd.getNamespace("gmd");
+ if (gmdNs != null && gmdNs.getURI().equals("
http://www.isotc211.org/2005/gmd")) {
+ // document gets default gmd namespace schemalocation
+ String locations = "
http://www.isotc211.org/2005/gmd http://www.isotc211.org/2005/gmd/gmd.xsd";
+ // if document has srv namespace then add srv namespace location
+ if (elMd.getNamespace("srv") != null) {
+ locations += "
http://www.isotc211.org/2005/srv http://schemas.opengis.net/iso/19139/20060504/srv/srv.xsd";
}
- // document describes a dataset (not a service)
- if(!isServiceMetadata){
- Attribute schemaLocation = new Attribute("schemaLocation","
http://www.isotc211.org/2005/gmd http://www.isotc211.org/2005/gmd/gmd.xsd", Csw.NAMESPACE_XSI);
- elMd.setAttribute(schemaLocation);
- }
- // document describes a service
- else if(isServiceMetadata) {
- Attribute schemaLocation = new Attribute("schemaLocation","
http://www.isotc211.org/2005/gmd http://schemas.opengis.net/iso/19139/20060504/srv/srv.xsd", Csw.NAMESPACE_XSI);
- elMd.setAttribute(schemaLocation);
- }
+ Attribute schemaLocation = new Attribute("schemaLocation", locations, Csw.NAMESPACE_XSI);
+ elMd.setAttribute(schemaLocation);
}
if (elMd == null)
@@ -149,11 +141,9 @@
//--- increase metadata popularity
- Dbms dbms = (Dbms) context.getResourceManager().open(Geonet.Res.MAIN_DB);
-
if (!skipPopularity) {
Timer t = new Timer();
- t.schedule(new IncreasePopularityTask(context, id), 10);
+ t.schedule(new IncreasePopularityTask(context, id), 10);
}
return elMd;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.
http://p.sf.net/sfu/bobj-july_______________________________________________
GeoNetwork-commit mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geonetwork-commit