ENI (6) ENI Inside

 1. Introduction

ENI format does not accept complementary metadata. So the Spanish Government has tried to solve this issue. So they have created a new XML schema so you can add additional metadata to "Document" and "Expedient"

You can download the xsd schemas from

https://administracionelectronica.gob.es/ctt/resources/Soluciones/323/Descargas/Esquemas%20documento%20y%20expediente%20con%20metadatos%20adicionales.zip?idIniciativa=323&idElemento=11977

If you want to build the classes, you should add these 2 schemas to the src/main/resources/xsd folder from the project described in this post


Now you do not need to change the schemas as they point to the local folder, and if you don't want to destroy the previously generated classes you can modify the build.gradle file as follows

sourceCompatibility = 12
targetCompatibility = 12

configurations {
    jaxb
}

dependencies {
    
    jaxb (
        'com.sun.xml.bind:jaxb-xjc:4.0.1',
        'com.sun.xml.bind:jaxb-impl:4.0.1',
        'org.glassfish.jaxb:jaxb-runtime:4.0.1'
    )
    
    api libs.jakarta.xml.bind.api
    
    compileOnly             libs.lombok // use version catalog in the file "settings.gradle"
    annotationProcessor     libs.lombok // use version catalog in the file "settings.gradle"
    testCompileOnly         libs.lombok // use version catalog in the file "settings.gradle"
    testAnnotationProcessor libs.lombok // use version catalog in the file "settings.gradle"
       
}

task jaxb {
    System.setProperty('javax.xml.accessExternalSchema', 'all')
    def jaxbTargetDir = file("src/generated-sources/jaxb")
    doLast {
        jaxbTargetDir.mkdirs()
        ant.taskdef(
            name: 'xjc',
            classname: 'com.sun.tools.xjc.XJCTask',
            classpath: configurations.jaxb.asPath
        )
        ant.jaxbTargetDir = jaxbTargetDir
        ant.xjc(
            destdir: '${jaxbTargetDir}',
            //package: 'eni.documento',
            //package: 'eni.expediente',
            //package: 'eni.xmldsig',
            //package: 'eni.xades',
            //package: 'eni.afirma',
            package: 'eni.inside',
            
            //schema: 'src/main/resources/xsd/documentoEni.xsd'
            //schema: 'src/main/resources/xsd/expedienteEni.xsd'
            //schema: 'src/main/resources/xsd/xmldsig-core-schema.xsd'
            //schema: 'src/main/resources/xsd/xades.xsd'
            schema: 'src/main/resources/xsd/TipoExpedienteInsideConMAdicionales.xsd'
        )
    }
}

jar {   
    from sourceSets.main.allSource  //Include java sources
    duplicatesStrategy = DuplicatesStrategy.EXCLUDE
    
}
compileJava.dependsOn jaxb


And build the project to get the generated classes.



Comments

Popular posts from this blog

ORVE WS (Dynamic) (4) Jackson XML mapper

AutoFirma ins and outs (4). Errors in tests in afirma-core, jmulticard-jse

Creating a WS Client consumer