Skip to content

Commit

Permalink
SF Patch #1455904 - fix crosswalk validation in 1.4alpha1
Browse files Browse the repository at this point in the history
git-svn-id: http://scm.dspace.org/svn/repo/trunk@1463 9c30dcfa-912a-0410-8fc2-9e0234be79fd
  • Loading branch information
ScottYeadon committed Mar 27, 2006
1 parent b7062d2 commit f07180c
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 21 deletions.
1 change: 1 addition & 0 deletions dspace/CHANGES
@@ -1,6 +1,7 @@
1.4 beta 1
==========
(Larry Stone)
- SF Patch #1455904 - fix crosswalk validation in 1.4alpha1
- SF Patch #1453425 1.4alpha1, fix crosswalk + packager configurations

(Larry Stone)
Expand Down
8 changes: 5 additions & 3 deletions dspace/config/dspace.cfg
Expand Up @@ -598,13 +598,15 @@ crosswalk.submission.MODS.stylesheet= crosswalks/mods-submission.xsl
crosswalk.qdc.namespace.QDC.dc = http://purl.org/dc/elements/1.1/
crosswalk.qdc.namespace.QDC.dcterms = http://purl.org/dc/terms/
crosswalk.qdc.schemaLocation.QDC = \
http://purl.org/dc/terms/ http://dublincore.org/schemas/xmls/qdc/2003/04/02/qualifieddc.xsd
http://purl.org/dc/terms/ http://dublincore.org/schemas/xmls/qdc/2006/01/06/dcterms.xsd \
http://purl.org/dc/elements/1.1/ http://dublincore.org/schemas/xmls/qdc/2006/01/06/dc.xsd
crosswalk.qdc.properties.QDC = crosswalks/QDC.properties

crosswalk.qdc.namespace.qdc.dc = http://purl.org/dc/elements/1.1/
crosswalk.qdc.namespace.qdc.dcterms = http://purl.org/dc/terms/
crosswalk.qdc.schemaLocation.qdc = \
http://purl.org/dc/terms/ http://dublincore.org/schemas/xmls/qdc/2003/04/02/qualifieddc.xsd
http://purl.org/dc/terms/ http://dublincore.org/schemas/xmls/qdc/2006/01/06/dcterms.xsd \
http://purl.org/dc/elements/1.1/ http://dublincore.org/schemas/xmls/qdc/2006/01/06/dc.xsd
crosswalk.qdc.properties.qdc = crosswalks/QDC.properties

# METS ingester configuration:
Expand Down Expand Up @@ -641,4 +643,4 @@ plugin.named.org.dspace.content.packager.PackageDisseminator = \

plugin.named.org.dspace.content.packager.PackageIngester = \
org.dspace.content.packager.PDFPackager = Adobe PDF, PDF, \
org.dspace.content.packager.DSpaceMETSIngester = METS
org.dspace.content.packager.DSpaceMETSIngester = METS
Expand Up @@ -68,6 +68,10 @@
*/
public interface DisseminationCrosswalk
{
/** XSI namespace, required for xsi:schemalocation attributes */
static final Namespace XSI_NS =
Namespace.getNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");

/**
* Get XML namespaces of the elements this crosswalk may return.
* Returns the XML namespaces (as JDOM objects) of the root element.
Expand Down
Expand Up @@ -116,7 +116,6 @@ public class MODSDisseminationCrosswalk extends SelfNamedPlugin

private final static String CONFIG_PREFIX = "crosswalk.mods.properties.";


/**
* Fill in the plugin alias table from DSpace configuration entries
* for configuration files for flavors of MODS crosswalk:
Expand Down Expand Up @@ -305,11 +304,28 @@ public String getSchemaLocation()
}

/**
* Returns object's metadata in MODS format, as XML structure node.
* Returns object's metadata in MODS format, as List of XML structure nodes.
*/
public List disseminateList(DSpaceObject dso)
throws CrosswalkException,
IOException, SQLException, AuthorizeException
{
return disseminateListInternal(dso, true);
}

public Element disseminateElement(DSpaceObject dso)
throws CrosswalkException,
IOException, SQLException, AuthorizeException
{
Element root = new Element("mods", MODS_NS);
root.setAttribute("schemaLocation", schemaLocation, XSI_NS);
root.addContent(disseminateListInternal(dso,false));
return root;
}

private List disseminateListInternal(DSpaceObject dso, boolean addSchema)
throws CrosswalkException,
IOException, SQLException, AuthorizeException
{
if (dso.getType() != Constants.ITEM)
throw new CrosswalkObjectNotSupported("MODSDisseminationCrosswalk can only crosswalk an Item.");
Expand All @@ -334,6 +350,8 @@ public List disseminateList(DSpaceObject dso)
try
{
Element me = (Element)trip.xml.clone();
if (addSchema)
me.setAttribute("schemaLocation", schemaLocation, XSI_NS);
Iterator ni = trip.xpath.selectNodes(me).iterator();
if (!ni.hasNext())
log.warn("XPath \""+trip.xpath.getXPath()+
Expand Down Expand Up @@ -366,15 +384,6 @@ else if (what instanceof Text)
return result;
}

public Element disseminateElement(DSpaceObject dso)
throws CrosswalkException,
IOException, SQLException, AuthorizeException
{
Element root = new Element("mods", MODS_NS);
root.addContent(disseminateList(dso));
return root;
}

public boolean canDisseminate(DSpaceObject dso)
{
return true;
Expand Down
14 changes: 13 additions & 1 deletion dspace/src/org/dspace/content/crosswalk/QDCCrosswalk.java
Expand Up @@ -328,6 +328,13 @@ public String getSchemaLocation()
public List disseminateList(DSpaceObject dso)
throws CrosswalkException,
IOException, SQLException, AuthorizeException
{
return disseminateListInternal(dso, true);
}

private List disseminateListInternal(DSpaceObject dso, boolean addSchema)
throws CrosswalkException,
IOException, SQLException, AuthorizeException
{
if (dso.getType() != Constants.ITEM)
throw new CrosswalkObjectNotSupported("QDCCrosswalk can only crosswalk an Item.");
Expand Down Expand Up @@ -356,6 +363,8 @@ public List disseminateList(DSpaceObject dso)
{
Element qe = (Element)elt.clone();
qe.setText(dc[i].value);
if (addSchema && schemaLocation != null)
qe.setAttribute("schemaLocation", schemaLocation, XSI_NS);
if (dc[i].language != null)
qe.setAttribute("lang", dc[i].language, Namespace.XML_NAMESPACE);
result.add(qe);
Expand All @@ -368,8 +377,11 @@ public Element disseminateElement(DSpaceObject dso)
throws CrosswalkException,
IOException, SQLException, AuthorizeException
{
init();
Element root = new Element("qualifieddc", DCTERMS_NS);
root.addContent(disseminateList(dso));
if (schemaLocation != null)
root.setAttribute("schemaLocation", schemaLocation, XSI_NS);
root.addContent(disseminateListInternal(dso, false));
return root;
}

Expand Down
Expand Up @@ -78,13 +78,10 @@ public class SimpleDCDisseminationCrosswalk extends SelfNamedPlugin
private static final Namespace DC_NS =
Namespace.getNamespace("dc", "http://purl.org/dc/elements/1.1/");


private static final Namespace XSI_NS =
Namespace.getNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");

// simple DC schema for OAI
private static final String DC_XSD =
"http://www.openarchives.org/OAI/2.0/oai_dc.xsd";
"http://dublincore.org/schemas/xmls/simpledc20021212.xsd";
//"http://www.openarchives.org/OAI/2.0/oai_dc.xsd";

private static final String schemaLocation =
DC_NS.getURI()+" "+DC_XSD;
Expand All @@ -104,7 +101,8 @@ public Element disseminateElement(DSpaceObject dso)
IOException, SQLException, AuthorizeException
{
Element root = new Element("simpledc", DC_NS);
root.addContent(disseminateList(dso));
root.setAttribute("schemaLocation", schemaLocation, XSI_NS);
root.addContent(disseminateListInternal(dso, false));
return root;
}

Expand All @@ -116,6 +114,13 @@ public Element disseminateElement(DSpaceObject dso)
public List disseminateList(DSpaceObject dso)
throws CrosswalkException,
IOException, SQLException, AuthorizeException
{
return disseminateListInternal(dso, true);
}

public List disseminateListInternal(DSpaceObject dso, boolean addSchema)
throws CrosswalkException,
IOException, SQLException, AuthorizeException
{
if (dso.getType() != Constants.ITEM)
throw new CrosswalkObjectNotSupported("SimpleDCDisseminationCrosswalk can only crosswalk an Item.");
Expand All @@ -142,6 +147,8 @@ public List disseminateList(DSpaceObject dso)
element = allDC[i].element;
Element field = new Element(element, DC_NS);
field.addContent(allDC[i].value);
if (addSchema)
field.setAttribute("schemaLocation", schemaLocation, XSI_NS);
dcl.add(field);
}
}
Expand Down

0 comments on commit f07180c

Please sign in to comment.