多行XML拆分属性值 [英] XML split attribute value on multiple line

查看:68
本文介绍了多行XML拆分属性值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有包含长属性值的XML数据.该值不包含空格字符.我想通过分割XML文本来格式化XML以提高可读性,以使该行不超过最大列数.
有什么办法做到这一点?我可以在每一行的末尾放置任何换行符,以使XML解析器不会将其视为空白(例如Visual Basic中的下划线字符)吗?

I have XML data which contains a long attribute value. The value does not contain white space characters. I want to format the XML for readability by splitting the XML text so that the line does not exceed a maximum number of column.
Is there any mean to accomplish this? Is there any break character that I can put at each end of line so that the XML parser does not consider it as a white space (like underscore character in visual basic)?

例如:

<element attribute="this_is_a_very_long_text_attribute_value_that_I_want_to_split_on multiple_line_for_readability"/>

我想要类似的东西:

<element attribute="this_is_a_very_long
_text_attribute_value_that_I_want_to_split
_on multiple_line_for_readability"/>

推荐答案

XML本身中没有关于Attribute Values
中换行符的规定 但是可以完成此操作,具体取决于要使用它编写的IDE
IE.如果您使用的是Visual Studio,则可以使用换行符,并且由IDE本身进行处理
但是,如果您使用的是诸如记事本之类的底层文本编辑器,则无法完成此操作
您应该检查一下XML编辑器的文档

there is no provision in XML itself for line feed character in Attribute Values
however this can be done depending upon the IDE you are using this to write
ie. if you are using Visual Studio there is a provision to break lines and is handled by the IDE itself
but if you are using some low level text editor like Notepad this cant be done
you should probably check in the documentation of your XML editor

这篇关于多行XML拆分属性值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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