JDOM
Publicado por cristina (27 intervenciones) el 28/03/2006 10:57:11
Hola
Estoy creando un documento xml con JDOM. El documento debe tener esta estructura:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve">
<f href="Alstom_ExamenServicio.pdf"/>
<fields>
<field name="operaciones.linea1.codigo">
<value>52</value>
</field>
<field name="Texto1">
<value>Estado</value>
</field>
</fields>
</xfdf>
Genero el fichero xml correctamente, pero el problema es que no se como especificar el namespace del elemento xfdf. He probado así:
Namespace ns = Namespace.getNamespace("http://ns.adobe.com/xfdf/");
Attribute at= new Attribute("space", "preserve",ns);
Element root = new Element("xfdf");
root.setAttribute(at);
pero me da este error:
org.jdom.IllegalNameException: The name "" is not legal for JDOM/XML attribute namespaces: An attribute namespace without a prefix can only be the NO_NAMESPACE namespace.
Alguna idea? Gracias
Estoy creando un documento xml con JDOM. El documento debe tener esta estructura:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve">
<f href="Alstom_ExamenServicio.pdf"/>
<fields>
<field name="operaciones.linea1.codigo">
<value>52</value>
</field>
<field name="Texto1">
<value>Estado</value>
</field>
</fields>
</xfdf>
Genero el fichero xml correctamente, pero el problema es que no se como especificar el namespace del elemento xfdf. He probado así:
Namespace ns = Namespace.getNamespace("http://ns.adobe.com/xfdf/");
Attribute at= new Attribute("space", "preserve",ns);
Element root = new Element("xfdf");
root.setAttribute(at);
pero me da este error:
org.jdom.IllegalNameException: The name "" is not legal for JDOM/XML attribute namespaces: An attribute namespace without a prefix can only be the NO_NAMESPACE namespace.
Alguna idea? Gracias
Valora esta pregunta


0