有没有办法让XDocument在使用ToString方法时打印xml版本?输出这样的东西:
<?xml version="1.0"?>
<!DOCTYPE ELMResponse [
]>
<Response>
<Error> ...Run Code Online (Sandbox Code Playgroud)
我有以下内容:
var xdoc = new XDocument(new XDocumentType("Response", null, null, "\n"), ...Run Code Online (Sandbox Code Playgroud)
这将打印出这个很好的,但它缺少如上所述的"<?xml版本".
<!DOCTYPE ELMResponse [
]>
<Response>
<Error> ...Run Code Online (Sandbox Code Playgroud)
我知道你可以通过手动输出我自己来做到这一点.只是想知道是否可以使用XDocument.
我有一个主干设置,我的所有生产代码都在这里.
然后我有一个debug分支(父母是trunk),我添加调试代码,如日志记录,var转储等...这应该永远不会在生产中.这个分支很少改变.
最后,我有一个feature分支(父母是debug),我在那里编写所有编码,具有调试的好处.这个分支有不断的提交.
我只想知道是否有更简单的方法将我的feature代码移动到trunk.这就是我目前所做的事情:
feature分支master并进行git svn rebase更改.rebase我的feature分支到master分支(git rebase --onto master debug feature)merge 功能 mastergit svn dcommit 改变其他开发者rebase debug到master(git rebase master debug)feature分支feature从debug分支创建一个新的.我试图将毫秒时间戳转换为XMLGregorianCalendar并返回,但我似乎得到了错误的结果.难道我做错了什么?看来我好几天了.
// Time stamp 01-Jan-0001 00:00:00.000
Long ts = -62135740800000L;
System.out.println(ts);
System.out.println(new Date(ts)); // Sat Jan 01 00:00:00 PST 1 .. Cool!
// to Gregorian Calendar
GregorianCalendar gc = new GregorianCalendar();
gc.setTimeInMillis(ts);
// to XML Gregorian Calendar
XMLGregorianCalendar xc = DatatypeFactory.newInstance().newXMLGregorianCalendar(gc);
// back to GC
GregorianCalendar gc2 = xc.toGregorianCalendar();
// to Timestamp
Long newTs = gc2.getTimeInMillis();
System.out.println(newTs); // -62135568000000 .. uh?
System.out.println(new Date(newTs)); // Mon Jan 03 00:00:00 PST 1 .. where did the extra days come from?
Run Code Online (Sandbox Code Playgroud) 我正在创建一个简单的图像浏览器。我正在使用JList带包装的:
assetList.setLayoutOrientation(JList.HORIZONTAL_WRAP);
assetList.setVisibleRowCount(-1);
但我想让空白处变暗。我尝试了子类化JList并让该paintComponent方法更改背景颜色,但它似乎不起作用,它只是不断向空白区域添加白色。