Skip to content

Commit

Permalink
Merge pull request #251 from keeps/hmiguim-patch-1
Browse files Browse the repository at this point in the history
Update README.md
  • Loading branch information
luis100 authored Feb 19, 2024
2 parents 35c1826 + a1c4985 commit 192ea71
Showing 1 changed file with 9 additions and 40 deletions.
49 changes: 9 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,39 +176,14 @@ The report generated by the validator is in **JSON** format and has the followin
2. Add the following dependency

```xml

<dependency>
<groupId>org.roda-project</groupId>
<artifactId>commons-ip2</artifactId>
<version>2.3.3</version>
<version>2.6.0</version>
</dependency>
```

If using Java 11 or greater, you might need the following extra dependencies:

```xml

<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0-b170201.1204</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.0-b170127.1453</version>
</dependency>
```

* Not using maven,
download [Commons IP latest jar](https://github.com/keeps/commons-ip/releases/download/2.0.0-beta1/commons-ip-2.0.0-beta1.jar)
, each of Commons IP dependencies (see pom.xml to know which dependencies/versions) and add them to your project
classpath.
* Not using Maven, use the GitHub packages to (download the dependency)[https://github.com/keeps/commons-ip/packages].

#### Write some code

Expand Down Expand Up @@ -319,50 +294,44 @@ SIP earkSIP=EARKSIP.parse(zipSIP);

## Development

In this sections are some relevant notes about Commons IP development.
In this section are some relevant notes about Commons IP development.

### XML Beans

XML Beans are used by Commons IP to manipulate METS files using Java code.

#### Details

Some changes were made to XML Schemas in order to be able to compile XML Schemas into Java classes using XJC as well as
to be able to validate a XML file against its XML Schema without Internet connections.
Some changes were made to XML Schemas to be able to compile XML Schemas into Java classes using XJC as well as
to be able to validate an XML file against its XML Schema without Internet connections.

The changes are:

* `src/main/resources/schemas2/mets1_12.xsd` XLink Schema location made local (and respectively file available locally)
* `src/main/resources/schemas2/mets1_12.xjb` Bindings file created to deal with attribute name conflict between METS and
XLink Schemas

After Java classes are created, some changes were made to produce METS XML files well defined in terms of namespaces.
After Java classes were created, some changes were made to produce METS XML files well-defined in terms of namespaces.
Namely:

* `src/main/java/org/roda_project/commons_ip2/mets_v1_12/beans/package-info.java` Annotations for corretly generate
* `src/main/java/org/roda_project/commons_ip2/mets_v1_12/beans/package-info.java` Annotations for correctly generate
namespaces were added. Following is the before & then the after:

```
@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.loc.gov/METS/", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.loc.gov/METS/", elementFormDefault = jakarta.xml.bind.annotation.XmlNsForm.QUALIFIED)
```

and the after

```
@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.loc.gov/METS/", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED, xmlns = {
@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.loc.gov/METS/", elementFormDefault = jakarta.xml.bind.annotation.XmlNsForm.QUALIFIED, xmlns = {
@javax.xml.bind.annotation.XmlNs(prefix = "", namespaceURI = "http://www.loc.gov/METS/"),
@javax.xml.bind.annotation.XmlNs(prefix = "xsi", namespaceURI = "http://www.w3.org/2001/XMLSchema-instance"),
@javax.xml.bind.annotation.XmlNs(prefix = "csip", namespaceURI = "https://DILCIS.eu/XML/METS/CSIPExtensionMETS"),
@javax.xml.bind.annotation.XmlNs(prefix = "sip", namespaceURI = "https://DILCIS.eu/XML/METS/SIPExtensionMETS"),
@javax.xml.bind.annotation.XmlNs(prefix = "xlink", namespaceURI = "http://www.w3.org/1999/xlink")})
```

#### How to generate/update XML Beans

```
xjc -d src/main/java/ -p "org.roda_project.commons_ip2.mets_v1_12.beans" src/main/resources/schemas2/mets1_12.xsd -b src/main/resources/schemas2/mets1_12.xjb
```

### IANA Media Types

The IANA Media Types list is required to perform SIP Validation. The list is located in the folder and named as follows:
Expand Down

0 comments on commit 192ea71

Please sign in to comment.