Re: JDOM and &qout;
From: mali_djuro (mali_djuro_REMOVE_at_net.hr)
Date: 02/03/04
- Next message: dh: "producer-consumer? no, a race to stop memory filling up!"
- Previous message: Minti: "Weird Problem in using MouseListener"
- In reply to: Raymond DeCampo: "Re: JDOM and &qout;"
- Next in thread: Raymond DeCampo: "Re: JDOM and &qout;"
- Reply: Raymond DeCampo: "Re: JDOM and &qout;"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 3 Feb 2004 09:21:30 +0100
"Raymond DeCampo" <rdecampo@spam-I-am-not.twcny.rr.com> wrote in message
news:tICTb.28348$n62.22674@twister.nyroc.rr.com...
> mali_djuro wrote:
> > Hi,
> > i didn't understand you.
> > i need to create document object and than transform it to string, or
file.
> >
> > if you have some examples please write to me.
> >
> > thanks.
> >
> > "Raymond DeCampo" <rdecampo@spam-I-am-not.twcny.rr.com> wrote in message
> > news:AGWSb.15452$%72.3792@twister.nyroc.rr.com...
> >
> >>mali_djuro wrote:
> >>
> >>>Hi all,
> >>>i used JDOM to create XML file.
> >>>first, i get data from database and create Document object. in some
data
> >
> > i
> >
> >>>have quotas, so it makes replacment in content of elements. for
example:
> >>>if i have "Hi" in database, i will have "Hi" in content of
> >>>element. And it is ok, because in xml does not exist ", at least i
think
> >>>that.
> >>>After it i want to make convert from document to string. I used
> >>>
> >>>XMLOutputter serializer = new XMLOutputter();
> >>>String output = serializer.outputString(document);
> >>>
> >>>now, when i look what's happened with "Hi" i found following
> >>>string
> >>>&quot;Hi&quot;
> >>>it makes conversion of & again, and that is not ok.
> >>>
> >>>has someone similiar problem? or do you know how to solve it?
> >>>
> >>>i can make parsing of string again and cut what is wrong, but is it
> >
> > possible
> >
> >>>to set something without that?
> >>>
> >>
> >>Friend,
> >>
> >>It is likely that the good people at JDOM have already considered your
> >>problem and are accounting for it themselves. So, it is probably safe
> >>to simply pass "Hi" directly to the JDOM API without prior escaping.
> >>
> >>Ray
> >>
> >
>
> Please do not top post, especially in reply to someone who has bottom
> posted.
>
> If you wish more specific advise, you will have to supply more specific
> code yourself. For example, what is document in your code above?
> Ideally, you should post the smallest possible complete program that
> exhibits the issue you are having. Provide the expected and actual
> outputs. I suspect you will be most pleased from the response of the
group.
>
> Ray
>
sorry, ray.
i didn't think when i answered on your post.
i am back on my problem:
function transformXMLToString(){
//here, i got some object
SomeObject so = new SomeObject();
so.setName("mali");
so.setHi("\"Hi\""); // here i have value of so.hi = "Hi" with qoutas
//now i make Document object
Element root = new Element("mainNode");
String output = new String();
Document document = new Document(root);
try{
//NodeName
Element sub = new Element("nodeName");
sub.addContent(so.getName());
root.addContent(prom);
//NodeHi
sub = new Element("NodeHi");
sub.addContent(so.getHi()); //content of sub is "Hi"
root.addContent(prom);
XMLOutputter serializer = new XMLOutputter();
output = serializer.outputString(document);
}
catch(Exception e){
System.out.println(e.getMessage());
}
return output;
}
so, for output i get
<?xml version="1.0"?>
<nodeMain>
<NodeName>mali</NodeName>
<NodeHi>&quot;Hi&quot;</NodeHi>
</nodeMain>
but i want for output following string
<?xml version="1.0"?>
<nodeMain>
<NodeName>mali</NodeName>
<NodeHi>"Hi"</NodeHi>
</nodeMain>
thanks
- Next message: dh: "producer-consumer? no, a race to stop memory filling up!"
- Previous message: Minti: "Weird Problem in using MouseListener"
- In reply to: Raymond DeCampo: "Re: JDOM and &qout;"
- Next in thread: Raymond DeCampo: "Re: JDOM and &qout;"
- Reply: Raymond DeCampo: "Re: JDOM and &qout;"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|