Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用java在xml中创建换行符_Java_Xml_Line Breaks_Setattribute - Fatal编程技术网

如何使用java在xml中创建换行符

如何使用java在xml中创建换行符,java,xml,line-breaks,setattribute,Java,Xml,Line Breaks,Setattribute,我想创建一个带有换行符的xml文件,看起来有点像这样: <Instrument currencyId="THB" disabledCount="0" hasBeenEnabledOnce="TRUE" </Instrument> 我得到以下结果: <Instrument currencyId="THB" disabledCount="0" hasBeenEnabledOnce="TRUE" “4”。但一切都没有改变。 不管我是用记事本++还是作为网页打开文件。您的XM

我想创建一个带有换行符的xml文件,看起来有点像这样:

<Instrument currencyId="THB"
disabledCount="0"
hasBeenEnabledOnce="TRUE"
</Instrument>
我得到以下结果:

<Instrument currencyId="THB" disabledCount="0" hasBeenEnabledOnce="TRUE"
“4”。但一切都没有改变。

不管我是用记事本++还是作为网页打开文件。

您的XML格式不正确。请更正它(看起来像一个丢失的“>”,但只有你能知道)这不是我真正的问题,但是的,在“真”之后有一个“>”,应该在那里,我只是在从我的代码复制时错过了它。另一方面,我的问题是,是否可以在“currencyId=“THB”和“disabledCount=“0”之间换行,使其看起来像上面的预期代码?不清楚您希望在哪里使用结束标记,或者是否希望使用“/>”构造,或者是否有可能省略的内容。通常,开始标记内的格式设置通常取决于您的工具链-您可能必须对序列化类进行子类化
<Instrument currencyId="THB" disabledCount="0" hasBeenEnabledOnce="TRUE"