You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Nathan Maves <na...@gmail.com> on 2007/02/14 23:20:25 UTC
Re: how to create
Why do you want to remove that line. It should not be causing you any
issues when parsing the xml file that is generated.
Nathan
On 2/14/07, disalle <di...@di.univaq.it> wrote:
>
> Hi all,
> I have a simple table (for example PERSON) and I would like to create an
> xml file containing all table rows, for example
> <?xml version="1.0" encoding="UTF-8"?>
> <PERSONS>
> <PERSON>
> <NAME>amleto</NAME>
> ......
> </PERSON>
> ......
> </PERSONS>
> I have used sqlMapClient.queryWithRowHandler and I have defined a CustomRowHandler
> but, I have noticed that IBatis for each row add the "<?xml version="1.0"
> encoding="UTF-8"?>" string.
> How can I deleted this string and/or is there another way to implement it?
>
> Here the xml configuration file:
> <select id="findAllPersons" resultClass="xmlCollection"
> xmlResultName="PERSON">
> SELECT * FROM PERSONS ORDER BY PERSON
> </select>
>
> BR
> /Amleto
>
>
>
>
>
R: how to create
Posted by disalle <di...@di.univaq.it>.
Here the code:
CustomRowHandler customRowHandler = new CustomRowHandler();
sqlMapClient.queryWithRowHandler( "xmlcommon.findAllPersons",
customRowHandler );
return "<?xml version=\"1.0\" encoding=\"UTF-8\"?><PERSONS>" +
customRowHandler.getResult() + "</PERSONS>";
public class CustomRowHandler implements RowHandler {
private StringBuilder result;
public CustomRowHandler() {
result = new StringBuilder( 1024 );
}
public void handleRow( Object object ) {
String element = ( String ) object;
result.append( element.substring( 38, element.length() ) );
}
public String getResult() {
return result.toString();
}
}
<select id="findAllPersons" resultClass="xmlCollection"
xmlResultName="PERSON">
SELECT * FROM PERSONS ORDER BY NAME
</select>
The problem is due to fact that I want an xml file with all PERSONS but
in the handleRow I have a row the the "<?xml version=\"1.0\"
encoding=\"UTF-8\"?>".
Is there another solution?
Thanks a lot for the previous responses
BR
/Amleto
-----Messaggio originale-----
Da: Nathan Maves [mailto:nathan.maves@gmail.com]
Inviato: mercoledì 14 febbraio 2007 23.30
A: user-java@ibatis.apache.org
Oggetto: Re: how to create
Did not catch that thanks Daniel.
Post the custom RH and your full sqlmap.
Nathan
On 2/14/07, Daniel Pitts < <ma...@cnet.com>
Daniel.Pitts@cnet.com> wrote:
It looks like his problem is that every row adds a <?xml version...>,
which is incorrect behavior.
But, It could also be that his CustomRowHandler is incorrectly
implemented.
_____
From: Nathan Maves [mailto:nathan.maves@gmail.com]
Sent: Wednesday, February 14, 2007 2:20 PM
To: user-java@ibatis.apache.org
Subject: Re: how to create
Why do you want to remove that line. It should not be causing you any
issues when parsing the xml file that is generated.
Nathan
On 2/14/07, disalle <di...@di.univaq.it> wrote:
Hi all,
I have a simple table (for example PERSON) and I would like to create an
xml file containing all table rows, for example
<?xml version="1.0" encoding="UTF-8"?>
<PERSONS>
<PERSON>
<NAME>amleto </NAME>
......
</PERSON>
......
</PERSONS>
I have used sqlMapClient.queryWithRowHandler and I have defined a
CustomRowHandler but, I have noticed that IBatis for each row add the
"<?xml version="1.0" encoding="UTF-8"?>" string.
How can I deleted this string and/or is there another way to implement
it?
Here the xml configuration file:
<select id="findAllPersons" resultClass="xmlCollection"
xmlResultName="PERSON">
SELECT * FROM PERSONS ORDER BY PERSON
</select>
BR
/Amleto
Re: how to create
Posted by Nathan Maves <na...@gmail.com>.
Did not catch that thanks Daniel.
Post the custom RH and your full sqlmap.
Nathan
On 2/14/07, Daniel Pitts <Da...@cnet.com> wrote:
>
> It looks like his problem is that every row adds a <?xml version...>,
> which is incorrect behavior.
> But, It could also be that his CustomRowHandler is incorrectly
> implemented.
>
> ------------------------------
> *From:* Nathan Maves [mailto:nathan.maves@gmail.com]
> *Sent:* Wednesday, February 14, 2007 2:20 PM
> *To:* user-java@ibatis.apache.org
> *Subject:* Re: how to create
>
> Why do you want to remove that line. It should not be causing you any
> issues when parsing the xml file that is generated.
>
> Nathan
>
> On 2/14/07, disalle <di...@di.univaq.it> wrote:
> >
> > Hi all,
> > I have a simple table (for example PERSON) and I would like to create an
> > xml file containing all table rows, for example
> > <?xml version="1.0" encoding="UTF-8"?>
> > <PERSONS>
> > <PERSON>
> > <NAME>amleto</NAME>
> > ......
> > </PERSON>
> > ......
> > </PERSONS>
> > I have used sqlMapClient.queryWithRowHandler and I have defined a CustomRowHandler
> > but, I have noticed that IBatis for each row add the "<?xml version="1.0"
> > encoding="UTF-8"?>" string.
> > How can I deleted this string and/or is there another way to implement
> > it?
> >
> > Here the xml configuration file:
> > <select id="findAllPersons" resultClass="xmlCollection"
> > xmlResultName="PERSON">
> > SELECT * FROM PERSONS ORDER BY PERSON
> > </select>
> >
> > BR
> > /Amleto
> >
> >
> >
> >
> >
>
>
RE: how to create
Posted by Daniel Pitts <Da...@cnet.com>.
It looks like his problem is that every row adds a <?xml version...>,
which is incorrect behavior.
But, It could also be that his CustomRowHandler is incorrectly
implemented.
________________________________
From: Nathan Maves [mailto:nathan.maves@gmail.com]
Sent: Wednesday, February 14, 2007 2:20 PM
To: user-java@ibatis.apache.org
Subject: Re: how to create
Why do you want to remove that line. It should not be causing you any
issues when parsing the xml file that is generated.
Nathan
On 2/14/07, disalle <di...@di.univaq.it> wrote:
Hi all,
I have a simple table (for example PERSON) and I would like to
create an xml file containing all table rows, for example
<?xml version="1.0" encoding="UTF-8"?>
<PERSONS>
<PERSON>
<NAME>amleto</NAME>
......
</PERSON>
......
</PERSONS>
I have used sqlMapClient.queryWithRowHandler and I have defined
a CustomRowHandler but, I have noticed that IBatis for each row add the
"<?xml version="1.0" encoding="UTF-8"?>" string.
How can I deleted this string and/or is there another way to
implement it?
Here the xml configuration file:
<select id="findAllPersons" resultClass="xmlCollection"
xmlResultName="PERSON">
SELECT * FROM PERSONS ORDER BY PERSON
</select>
BR
/Amleto