XML中回车的问题 - Web 开发 / XML/SOAP
大家请看,这个是我写的生成xml的方法,用的是jdom,请问如何可以使生成的xml中的段落里带“回车”???
public void bulidprotocolxml(String textarea)throws IOException, JDOMException {
Element root, e1;
Document Doc;
root = new Element("protocol_");
Doc = new Document(root);
//第一个protocol结点及子结点
e1 = new Element("protocol");
e1.setAttribute("id","01");
Element e11 = new Element("content");
e11.setText(textarea);
e1.addContent(e11);
root.addContent(e1);
XMLOutputter XMLOut = new XMLOutputter();
Format format = Format.getCompactFormat();
format.setIndent(" "); //在元素后换行,每一层元素缩排两格
format.setEncoding("gb2312"); //设置字符编码
XMLOut.setFormat(format); //设定格式
XMLOut.output(Doc, new FileOutputStream(/test.xml));
}
貌似不行啊朋友
{{
相关问答:
用SAX解析XML中,使用这段代码
String feed="http://www.google.com/ig/api?weather="+strCity;
URL url = new URL(feed.replace(" ", "%20"));
......
<?xml version="1.0" encoding="utf-8" ?>
<HuiSin>
<admin>100,100</admin>
<user>200,200</user>
怎样在这里添加一个新的呢?
< ......
loadxmldoc.js文件内容:
function loadXMLDoc(dname)
{
try //Internet Explorer
{
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
}
catch(e)
{
&nb ......
先上代码
public override string SerializeToXml(object objArg)
{
if (objArg == null)
return "";
StringBuild ......