为什么XML在记事本++和记事本中看起来不一样? [英] Why does XML look differently in notepad++ and notepad?

查看:928
本文介绍了为什么XML在记事本++和记事本中看起来不一样?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,所以文件看起来不同的原因是因为EOL(End Of Line)在UNIX和Windows中是不同的格式。记事本无法处理UNIX EOL,因此它将XML全部放在一行上。记事本+ +处理两个,所以它知道如何正确格式化文件时显示它。改变编辑 - > EOL转换(EOL转换为+ 1到Uberfuzzy注意到)到窗口将使记事本可以正确查看文件。



ORIGINAL POST



好的,所以这个问题产生了另一个我创建的问题,我将在下面链接,我想知道为什么XML的工作方式确实。所以,我用notepad ++打开了一个XML文件,如下所示:

 <?xml version =1.0?> ; 
< settings>
< tag_1>一些标签内容< / tag_1>
< tag_2 />
< / settings>

在旧的简单记事本中打开的相同文件看起来像这样

 <?xml version =1.0?>< settings> < tag_1>一些标签内容< / tag_1> < TAG_2 />< /设置> 

现在回到记事本++中,我使用插件 - > XML工具 - >线性化XML插件 - > XML工具 - >漂亮的打印(只有XML - 换行符)(荣誉如何在Notepad ++中格式化XML?帮助我解决这个问题),现在,这个文件看起来和记事本++中的一样,但是在记事本中它现在看起来就像

 <?xml version =1.0?> 
< settings>
< tag_1>一些标签内容< / tag_1>
< tag_2 />
< / settings>

我的其他问题,可以在这里找到如何在ACE中加载XML?只有在记事本中正确加载XML才能正确加载XML。那么为什么XML在notepad ++和notepad中看起来不一样呢?有没有一个我不知道被使用的字符?还是记事本++自动格式化XML,因为它知道如何阅读标签?我不知道...任何帮助,将不胜感激!记事本使用标准的Windows样式换行符(CRLF),而同时, Unix使用(LF)。我认为你的XML文件是一个Unix格式的文本文件,这就是记事本没有正确显示的原因。在Notepad ++中使用插件后,它必须在文件中添加系统特定的新行,但这是我正在做的一个假设。


UPDATE

Ok, so the reason the files look differently is because the EOL(End Of Line) is different in UNIX and Windows format. Notepad can not handle UNIX EOL so it places the XML all on one line. Notepad++ handles both so it knows how to properly format the file when displaying it. Changing the EOL in Edit->EOL Conversion (+1 to Uberfuzzy for noting that) to windows will make it so notepad can view the file properly.

ORIGINAL POST

Ok, so this question spawns off of another question I created, which I will link below, and I want to know why XML works the way it does. So, I have an XML file open in notepad++ that looks like this:

<?xml version="1.0"?>
<settings>
    <tag_1>some tag content</tag_1>
    <tag_2/>
</settings>

the same file opened in good old simple notepad looks like this

<?xml version="1.0"?><settings> <tag_1>some tag content</tag_1> <tag_2/></settings>

Now, back in notepad++ I use "Plugins->XML Tools->Linearize XML" and then "Plugins->XML Tools->Pretty print (XML Only - with line breaks)" (kudos to How to format XML in Notepad++? for helping me figure that out) and now, that file looks the same as it did before in notepad++ but in notepad it now looks like

<?xml version="1.0"?>
<settings>
    <tag_1>some tag content</tag_1>
    <tag_2/>
</settings>

My other question, which can be found here How to load XML in ACE? only loads XML properly IF it looks correctly in notepad. So why does XML look differently in notepadd++ and notepad? Is there a character that I am unaware of being used? Or is it notepad++ formatting the XML automatically because it knows how to read tags? I do not know... Any help would be appreciated!

解决方案

Notepad uses the standard Windows style newlines (CRLF) while, Unix uses (LF). I think your XML file is a Unix formatted text file, that's why Notepad is not displaying it properly. And after you used the plugin in Notepad++ it must have added the system specific new line in your file, but this an assumption I am making.

这篇关于为什么XML在记事本++和记事本中看起来不一样?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆