XML Java
XML Java
DOM: Ejemplo
SAX: Ejemplo
Manejador XML
Estndar OPEN SOURCE (http://www.jdom.org) Ms evolucionado, maduro y extendido que el API JAXP (Sun Microsystems) Soporta:
n n n
Element raiz=new Element(Orden); Document documentoXML = new Document(raiz); Element hijo1=new Element(codigo); raiz.addContent(hijo1.addContent(10)); raiz.addContent(new Element(codigo).addContent(10)); Attribute tipo =new Attribute(TIPO); tipo.addContent(A); hijo1.addAttribute(tipo);
Document doc = builder.build(new File("estudiantes.xml")) Element root=doc.getRootElement(); List hijos = root.getChildren(); Iterator navegador =hijos.iterator();
Lectura/Recorrido
SAX (Metodo endElement) DOM Leer documento (Desde archivo o Memoria) Obtener nodos/Elementos hijos. Iterar la lista de nodos hijos Ejecutar codicin de bsqueda.
XSL:
n
Transformacin
Contenido / Datos.
XSLT: Ejemplo
Laboratorio No. 4
n
Crearlo y serializarlos a salida estandar y archivo. Recibir un archivo XML y hacerle parser. JDOM SAX DOM XMLOutput.
RECURSOS
n
DOM website
n
Proyecto XML-Apache
n