primer commit
This commit is contained in:
commit
0350379e0f
20
.classpath
Normal file
20
.classpath
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-24">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry including="**/*.java" kind="src" output="target/classes" path="src">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
/bin/
|
||||
*.class
|
||||
23
.project
Normal file
23
.project
Normal file
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>aadd_act1_12</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
14
.settings/org.eclipse.jdt.core.prefs
Normal file
14
.settings/org.eclipse.jdt.core.prefs
Normal file
@ -0,0 +1,14 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=24
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=24
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
|
||||
org.eclipse.jdt.core.compiler.release=enabled
|
||||
org.eclipse.jdt.core.compiler.source=24
|
||||
4
.settings/org.eclipse.m2e.core.prefs
Normal file
4
.settings/org.eclipse.m2e.core.prefs
Normal file
@ -0,0 +1,4 @@
|
||||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
resolveWorkspaceProjects=true
|
||||
version=1
|
||||
119
informacion-IES.xml
Normal file
119
informacion-IES.xml
Normal file
@ -0,0 +1,119 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<instituto nombre="IES Virgen de la Paloma" tipo="FP">
|
||||
<ciclo codigo="IFC05" nivel="CFGS" familia="IFC" numero_horas="2000">
|
||||
<nombre_corto>DAM</nombre_corto>
|
||||
<nombre_largo>Técnico Superior en Desarrollo de Aplicaciones Multiplataforma</nombre_largo>
|
||||
<curso numero="1">
|
||||
<modulo id="11" ref="0186">
|
||||
<titulo> Bases de datos</titulo>
|
||||
<numerohoras>205</numerohoras>
|
||||
</modulo>
|
||||
<modulo id="12" ref="0188">
|
||||
<numerohoras>90</numerohoras>
|
||||
<titulo>Entornos de desarrollo </titulo>
|
||||
</modulo>
|
||||
<modulo id="13" ref="0194">
|
||||
<numerohoras>90</numerohoras>
|
||||
<titulo>Formación y orientación laboral</titulo>
|
||||
</modulo>
|
||||
<modulo id="14" ref="0190">
|
||||
<numerohoras>140</numerohoras>
|
||||
<titulo>Lenguaje de marcas y sistemas de gestión de información</titulo>
|
||||
</modulo>
|
||||
<modulo id="14" ref="0189">
|
||||
<numerohoras>270</numerohoras>
|
||||
<titulo>Programación</titulo>
|
||||
</modulo>
|
||||
<modulo id="15" ref="0191">
|
||||
<numerohoras>205</numerohoras>
|
||||
<titulo>Sistemas informáticos</titulo>
|
||||
</modulo>
|
||||
</curso>
|
||||
<curso numero="2">
|
||||
<modulo id="21" ref="0286">
|
||||
<titulo>Acceso a Datos</titulo>
|
||||
<numerohoras>120</numerohoras>
|
||||
</modulo>
|
||||
<modulo id="22" ref="0288">
|
||||
<numerohoras>120</numerohoras>
|
||||
<titulo>Diseño de interfaces</titulo>
|
||||
</modulo>
|
||||
<modulo id="23" ref="0294">
|
||||
<numerohoras>65</numerohoras>
|
||||
<titulo>Empresa e iniciativa emprendedora </titulo>
|
||||
</modulo>
|
||||
<modulo id="24" ref="0290">
|
||||
<numerohoras>80</numerohoras>
|
||||
<titulo>Programación de servicios y procesos</titulo>
|
||||
</modulo>
|
||||
<modulo id="25" ref="0289">
|
||||
<numerohoras>80</numerohoras>
|
||||
<titulo>Programación multimedia y dispositivos móviles</titulo>
|
||||
</modulo>
|
||||
<modulo id="26" ref="0291">
|
||||
<numerohoras>40</numerohoras>
|
||||
<titulo>Inglés técnico para grado superior</titulo>
|
||||
</modulo>
|
||||
</curso>
|
||||
</ciclo>
|
||||
<ciclo codigo="IFC06" nivel="CFGS" familia="IFC" numero_horas="2000">
|
||||
<nombre_corto>DAW</nombre_corto>
|
||||
<nombre_largo>Técnico Superior en Desarrollo de Aplicaciones Web</nombre_largo>
|
||||
<curso numero="1">
|
||||
<modulo id="31" ref="0186">
|
||||
<titulo> Bases de datos</titulo>
|
||||
<numerohoras>205</numerohoras>
|
||||
</modulo>
|
||||
<modulo id="32" ref="0188">
|
||||
<numerohoras>90</numerohoras>
|
||||
<titulo>Entornos de desarrollo </titulo>
|
||||
</modulo>
|
||||
<modulo id="33" ref="0194">
|
||||
<numerohoras>90</numerohoras>
|
||||
<titulo>Formación y orientación laboral</titulo>
|
||||
</modulo>
|
||||
<modulo id="34" ref="0190">
|
||||
<numerohoras>140</numerohoras>
|
||||
<titulo>Lenguaje de marcas y sistemas de gestión de información</titulo>
|
||||
</modulo>
|
||||
<modulo id="34" ref="0189">
|
||||
<numerohoras>270</numerohoras>
|
||||
<titulo>Programación</titulo>
|
||||
</modulo>
|
||||
<modulo id="35" ref="0191">
|
||||
<numerohoras>205</numerohoras>
|
||||
<titulo>Sistemas informáticos</titulo>
|
||||
</modulo>
|
||||
</curso>
|
||||
<curso numero="2">
|
||||
<modulo id="41" ref="0286">
|
||||
<titulo>Desarrollo web en entorno cliente</titulo>
|
||||
<numerohoras>115</numerohoras>
|
||||
</modulo>
|
||||
<modulo id="42" ref="0288">
|
||||
<numerohoras>180</numerohoras>
|
||||
<titulo>Desarrollo web en entorno servidor</titulo>
|
||||
</modulo>
|
||||
<modulo id="43" ref="0294">
|
||||
<numerohoras>85</numerohoras>
|
||||
<titulo>Despliegue de aplicaciones web</titulo>
|
||||
</modulo>
|
||||
<modulo id="44" ref="0290">
|
||||
<numerohoras>115</numerohoras>
|
||||
<titulo>Diseño de interfaces web </titulo>
|
||||
</modulo>
|
||||
<modulo id="45" ref="0289">
|
||||
<numerohoras>30</numerohoras>
|
||||
<titulo>Proyecto de desarrollo de aplicaciones web </titulo>
|
||||
</modulo>
|
||||
<modulo id="46" ref="0291">
|
||||
<numerohoras>40</numerohoras>
|
||||
<titulo>Inglés técnico para grado superior</titulo>
|
||||
</modulo>
|
||||
<modulo id="23" ref="0294">
|
||||
<numerohoras>65</numerohoras>
|
||||
<titulo>Empresa e iniciativa emprendedora </titulo>
|
||||
</modulo>
|
||||
</curso>
|
||||
</ciclo>
|
||||
</instituto>
|
||||
26
pom.xml
Normal file
26
pom.xml
Normal file
@ -0,0 +1,26 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>aadd_act1_12</groupId>
|
||||
<artifactId>aadd_act1_12</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<dependencies>
|
||||
<!-- https://mvnrepository.com/artifact/tools.jackson.dataformat/jackson-dataformat-xml -->
|
||||
<dependency>
|
||||
<groupId>tools.jackson.dataformat</groupId>
|
||||
<artifactId>jackson-dataformat-xml</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.13.0</version>
|
||||
<configuration>
|
||||
<release>24</release>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
122
src/es/palomafp/aadd/inm/GestorInstitutoXML.java
Normal file
122
src/es/palomafp/aadd/inm/GestorInstitutoXML.java
Normal file
@ -0,0 +1,122 @@
|
||||
package es.palomafp.aadd.inm;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Scanner;
|
||||
|
||||
import tools.jackson.databind.JsonNode;
|
||||
import tools.jackson.databind.ObjectMapper;
|
||||
import tools.jackson.databind.node.ArrayNode;
|
||||
import tools.jackson.dataformat.xml.XmlMapper;
|
||||
|
||||
/**
|
||||
*
|
||||
* GestorInstitutoXML: Clase que procesa un fichero XML de un instituto
|
||||
* utilizando Jackson
|
||||
*
|
||||
* @author Isidoro Nevares Martín - IES Virgen de la Paloma
|
||||
* @date 26 sept 2025
|
||||
*/
|
||||
|
||||
public class GestorInstitutoXML {
|
||||
private static final String RUTA_FICHERO_XML = "informacion-IES.xml";
|
||||
|
||||
public static void main(String[] args) {
|
||||
GestorInstitutoXML gestor = new GestorInstitutoXML();
|
||||
|
||||
Scanner scanner = new Scanner(System.in); // Crear el scanner
|
||||
|
||||
System.out.print("Introduce una opción de procesamiento XML: \n");
|
||||
String opcion = scanner.nextLine(); // Leer una opción introducida.
|
||||
|
||||
switch (opcion) {
|
||||
case "1":
|
||||
System.out.println("Imprimir instituto");
|
||||
gestor.imprimirInstituto();
|
||||
break;
|
||||
case "2":
|
||||
System.out.println("Imprimir ciclos");
|
||||
gestor.imprimirCiclos();
|
||||
break;
|
||||
case "3":
|
||||
System.out.println("Imprimir módulos que empiezan por 'Programa'");
|
||||
gestor.imprimirModulosPrograma();
|
||||
break;
|
||||
}
|
||||
|
||||
scanner.close();
|
||||
}
|
||||
|
||||
private void imprimirInstituto() {
|
||||
JsonNode nodoRaiz = obtenerJsonNodeDeFichero(); // El nodo raíz es el nodo "instituto" (y únicamente hay uno).
|
||||
// Obtener los atributos del nodo "instituto"
|
||||
String nombreInstituto = nodoRaiz.path("nombre").asString();
|
||||
String tipoInstituto = nodoRaiz.path("tipo").asString();
|
||||
|
||||
System.out.println("Nombre del Instituto: " + nombreInstituto + " - Tipo del Instituto: " + tipoInstituto);
|
||||
}
|
||||
|
||||
private void imprimirCiclos() {
|
||||
JsonNode nodoRaiz = obtenerJsonNodeDeFichero();
|
||||
// Obtener los nodos "ciclo"
|
||||
ArrayNode ciclos = convertirJsonNodeEnArrayNode(nodoRaiz.path("ciclo"));
|
||||
|
||||
for (JsonNode ciclo : ciclos) {
|
||||
String codigo = ciclo.path("codigo").asString();// Accedemos al atributo 'codigo'
|
||||
String nombreCorto = ciclo.path("nombre_corto").asString();// Accedemos al atributo 'nombre corto'
|
||||
|
||||
System.out.println("Ciclo - Código: " + codigo + ", Nombre Corto: " + nombreCorto);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void imprimirModulosPrograma() {
|
||||
JsonNode nodoRaiz = obtenerJsonNodeDeFichero();
|
||||
|
||||
// Obtener los nodos "ciclo"
|
||||
ArrayNode ciclos = convertirJsonNodeEnArrayNode(nodoRaiz.path("ciclo"));
|
||||
for (JsonNode ciclo : ciclos) {
|
||||
// Obtener los nodos "curso"
|
||||
ArrayNode cursos = convertirJsonNodeEnArrayNode(ciclo.path("curso"));
|
||||
for (JsonNode curso : cursos) {
|
||||
// Obtener los nodos "modulo"
|
||||
ArrayNode modulos = convertirJsonNodeEnArrayNode(curso.path("modulo"));
|
||||
|
||||
for (JsonNode modulo : modulos) {
|
||||
String titulo = modulo.path("titulo").asString();
|
||||
if (!titulo.isEmpty() && titulo.startsWith("Programa")) {
|
||||
String id = modulo.path("id").asString();
|
||||
String referencia = modulo.path("ref").asString();
|
||||
String numeroHoras = modulo.path("numerohoras").asString();
|
||||
|
||||
System.out.println("Modelo: - Id: " + id + ", Referencia: " + referencia + ", Título: " + titulo
|
||||
+ ", Número de horas: " + numeroHoras);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private JsonNode obtenerJsonNodeDeFichero() {
|
||||
// Cargar el XML
|
||||
XmlMapper xmlMapper = new XmlMapper();
|
||||
JsonNode root = xmlMapper.readTree(new File(RUTA_FICHERO_XML));
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
private ArrayNode convertirJsonNodeEnArrayNode(JsonNode node) {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
if (node.isArray()) {
|
||||
return (ArrayNode) node;
|
||||
} else {
|
||||
ArrayNode arrayNode = mapper.createArrayNode();
|
||||
if (!node.isMissingNode()) {
|
||||
arrayNode.add(node);
|
||||
}
|
||||
return arrayNode;
|
||||
}
|
||||
}
|
||||
}
|
||||
4
target/classes/META-INF/MANIFEST.MF
Normal file
4
target/classes/META-INF/MANIFEST.MF
Normal file
@ -0,0 +1,4 @@
|
||||
Manifest-Version: 1.0
|
||||
Build-Jdk-Spec: 21
|
||||
Created-By: Maven Integration for Eclipse
|
||||
|
||||
@ -0,0 +1,7 @@
|
||||
#Generated by Maven Integration for Eclipse
|
||||
#Wed Oct 22 18:09:00 CEST 2025
|
||||
artifactId=aadd_act1_12
|
||||
groupId=aadd_act1_12
|
||||
m2e.projectLocation=C\:\\Users\\Isidoro NM\\02-AccesoDatos-2AMT\\workspace\\aadd_act1_12
|
||||
m2e.projectName=aadd_act1_12
|
||||
version=0.0.1-SNAPSHOT
|
||||
@ -0,0 +1,26 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>aadd_act1_12</groupId>
|
||||
<artifactId>aadd_act1_12</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<dependencies>
|
||||
<!-- https://mvnrepository.com/artifact/tools.jackson.dataformat/jackson-dataformat-xml -->
|
||||
<dependency>
|
||||
<groupId>tools.jackson.dataformat</groupId>
|
||||
<artifactId>jackson-dataformat-xml</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.13.0</version>
|
||||
<configuration>
|
||||
<release>24</release>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
Loading…
Reference in New Issue
Block a user