parsing one xml String with JDOM


X

[XaToA]

Hello, i am trying to parse the next xml (i have into une String) using JDOM
with this code:
java.io.InputStream reader = new java.io.StringBufferInputStream(xml);
Vector vBase = new Vector();
Hashtable ht = new Hashtable();
try{
SAXBuilder builder = new SAXBuilder();
Document document = builder.build(reader);

but appears the bellow error in the 32 line (Document document =
builder.build(reader);)

how cai i solve this problem?

please can you help me?
thanks

<?xml version="1.0" encoding="ISO-8859-1" standalone="yes" ?>
<registros>
<registro>
<cliente_id>2</cliente_id>
<usuario_id>0</usuario_id>
<cliente_nombre>mm</cliente_nombre>
<cliente_apellidos>mm</cliente_apellidos>
<cliente_email>adf</cliente_email>
<cliente_falta>2004-03-02 00:00:00+01</cliente_falta>
<cliente_fbaja></cliente_fbaja>
<cliente_pathplantillas>mm/</cliente_pathplantillas>
<cliente_estado>t</cliente_estado>
</registro>
<registro>
<cliente_id>1</cliente_id>
<usuario_id>0</usuario_id>
<cliente_nombre>m</cliente_nombre>
<cliente_apellidos>m</cliente_apellidos>
<cliente_email>m</cliente_email>
<cliente_falta>2004-03-02 00:00:00+01</cliente_falta>
<cliente_fbaja></cliente_fbaja>
<cliente_pathplantillas>m</cliente_pathplantillas>
<cliente_estado>t</cliente_estado>
</registro>
</registros>


org.jdom.input.JDOMParseException: Error on line 1: Falta elemento de raÝz
de do
cumento.
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:466)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:769)
at
com.administracion.ventanas.utiles.xml.AnalizaXML.devuelve(AnalizaXML
..java:32)
at
com.administracion.ventanas.cliente.Clientes.llenaComboUsuariosActivo
s(Clientes.java:98)
at
com.administracion.ventanas.cliente.Clientes$2.actionPerformed(Client
es.java:79)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at
javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknow
n Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown
Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown
Sour
ce)
at java.awt.Component.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown
Source)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown
Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: org.xml.sax.SAXParseException: Falta elemento de raÝz de
documento.
at org.apache.crimson.parser.Parser2.fatal(Unknown Source)
at org.apache.crimson.parser.Parser2.fatal(Unknown Source)
at org.apache.crimson.parser.Parser2.parseInternal(Unknown Source)
at org.apache.crimson.parser.Parser2.parse(Unknown Source)
at org.apache.crimson.parser.XMLReaderImpl.parse(Unknown Source)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:455)
... 27 more
Caused by: org.xml.sax.SAXParseException: Falta elemento de raÝz de
documento.
at org.apache.crimson.parser.Parser2.fatal(Unknown Source)
at org.apache.crimson.parser.Parser2.fatal(Unknown Source)
at org.apache.crimson.parser.Parser2.parseInternal(Unknown Source)
at org.apache.crimson.parser.Parser2.parse(Unknown Source)
at org.apache.crimson.parser.XMLReaderImpl.parse(Unknown Source)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:455)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:769)
at
com.administracion.ventanas.utiles.xml.AnalizaXML.devuelve(AnalizaXML
..java:32)
at
com.administracion.ventanas.cliente.Clientes.llenaComboUsuariosActivo
s(Clientes.java:98)
at
com.administracion.ventanas.cliente.Clientes$2.actionPerformed(Client
es.java:79)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at
javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknow
n Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown
Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown
Sour
ce)
at java.awt.Component.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown
Source)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown
Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: org.xml.sax.SAXParseException: Falta elemento de raÝz de
documento.
at org.apache.crimson.parser.Parser2.fatal(Unknown Source)
at org.apache.crimson.parser.Parser2.fatal(Unknown Source)
at org.apache.crimson.parser.Parser2.parseInternal(Unknown Source)
at org.apache.crimson.parser.Parser2.parse(Unknown Source)
at org.apache.crimson.parser.XMLReaderImpl.parse(Unknown Source)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:455)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:769)
at
com.administracion.ventanas.utiles.xml.AnalizaXML.devuelve(AnalizaXML
..java:32)
at
com.administracion.ventanas.cliente.Clientes.llenaComboUsuariosActivo
s(Clientes.java:98)
at
com.administracion.ventanas.cliente.Clientes$2.actionPerformed(Client
es.java:79)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at
javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknow
n Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown
Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown
Sour
ce)
at java.awt.Component.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown
Source)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown
Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top