[jdom-interest] Using a reader to get XML problems

Jason Hunter jhunter at collab.net
Fri Jan 26 12:17:20 PST 2001


When I said "it built" I meant the SAXBuilder worked fine.  Therefore,
it parsed fine.

C:/tmp/jdom 24 % cat root.xml
<?xml version='1.0'?>

<Merchant>
<ID>100000</ID>
<Username>uk</Username>
<Password>uktest2</Password>
</Merchant>

C:/tmp/jdom 25 % cat TestClass.java
import java.io.*;
import java.util.*;
import org.jdom.*;
import org.jdom.input.*;
import org.jdom.output.*;

public class TestClass {

  public static void main(String[] args) throws Exception {
    try {
      FileInputStream in = new FileInputStream(args[0]);
      Document d = new SAXBuilder().build(in);
      XMLOutputter outp = new XMLOutputter("", false);
      outp.output(d, System.out);

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}

C:/tmp/jdom 26 % java TestClass root.xml
<?xml version="1.0" encoding="UTF-8"?>
<Merchant>
<ID>100000</ID>
<Username>uk</Username>
<Password>uktest2</Password>
</Merchant>

It's probably something in your client/server interaction.  I'll leave
that for you, or maybe someone else here, to work on.

-jh-

TassoA at trustmarque.ca wrote:
> 
> Well yeah it compiles it's just that the parser canot parse the data in the
> buffer.
> 
> -----Original Message-----
> From: Jason Hunter [mailto:jhunter at collab.net]
> Sent: Friday, January 26, 2001 2:40 PM
> To: TassoA at trustmarque.ca
> Cc: jdom-interest at jdom.org
> Subject: Re: [jdom-interest] Using a reader to get XML problems
> 
> TassoA at trustmarque.ca wrote:
> >
> > Hi I wrote a small client server application.
> >
> > The client application send XML data using a buffered writter.
> > And the server application receives the data using a bufferedreader.
> >
> > But some how I can get it to parse the data I get exceptions.
> >
> > <?xml version='1.0'?>
> >
> > <Merchant>
> > <ID>100000</ID>
> > <Username>uk</Username>
> > <Password>uktest2</Password>
> > </Merchant>
> 
> This file builds fine on its own.  Probably a client/server issue.
> 
> -jh-



More information about the jdom-interest mailing list