[jdom-interest] XML file in a servlet
Zach Hollandsworth
zholland at quarem.com
Sun Nov 4 14:16:12 PST 2001
Very simply, trying to get XmlFile.xml (well formed HTML as XML) out to the
browser. I have try quite possibly hundreds of combinations of charsets,
and encoding types. The file is quite large and has been run through tidy.
If I load the file straight through the browser, it works fine. But when
run through this servlet, it does not. In IE, it runs and you can see it in
the "view source", and it work more often in NN, but I can't nail anything
down for sure.
-------------------------------------------------
public void doGet(...
{
try
{
response.setContentType("text/html; charset=UTF-8");
PrintWriter writer = response.getWriter();
org.jdom.input.SAXBuilder sb = new org.jdom.input.SAXBuilder();
org.jdom.Document d = sb.build(new java.io.File("XmlFile.xml"));
org.jdom.output.XMLOutputter xo = new org.jdom.output.XMLOutputter("",
false, "UTF-8");
xo.setEncoding("UTF-8");
xo.output(d, writer);
}
catch (org.jdom.JDOMException jde)
{
jde.printStackTrace(response.getWriter());
}
}
-------------------------------------------------
Thanks in advance.
Zach Hollandsworth
-----Original Message-----
From: jdom-interest-admin at jdom.org
[mailto:jdom-interest-admin at jdom.org]On Behalf Of Matthew MacKenzie
Sent: Sunday, November 04, 2001 4:04 PM
To: 'JDOM'
Subject: RE: [jdom-interest] XML file in a servlet
You need to elaborate upon this sporadic behaviour, maybe by including
your code and/or exceptions.
Regards,
Matt
-----Original Message-----
From: jdom-interest-admin at jdom.org [mailto:jdom-interest-admin at jdom.org]
On Behalf Of Zach Hollandsworth
Sent: November 4, 2001 11:54 AM
To: 'JDOM'
Subject: [jdom-interest] XML file in a servlet
I realize that this is not fully a JDOM question, but it is close. I
have been working on this for quite some time with no success. I have a
strong feeling that it is some type of encoding issue.
What I am trying to do is simple, Load an XML file from a file, and
display it via a servlet to the browser.
The behavior that I get is very sporadic.
Any suggestions?
Thanks
Zach Hollandsworth
_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@you
rhost.com
_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com
More information about the jdom-interest
mailing list