空XML元素样式? [英] Empty XML Element Styles?

查看:47
本文介绍了空XML元素样式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚花了很多时间在这个问题上,它确实不应该那么困难。

在服务器应用程序上,我有使用即时实例化的对象反射。我有一个管理客户端,出于测试和调试的目的,我可以请求一个空的序列化版本的对象,然后我可以编辑,然后提交回服务器。

所有空字符串显示为:
<会员名称/>

而不是:
<会员名称>< /会员名称>

我明白了这背后的原因;但是,如果在客户端编辑了20或30个成员对象,那么依靠手动重写所有标记是一个非常糟糕的主意。我正在寻找一种快速重新格式化XML的方法,以便更容易手动编辑。

有任何想法吗?

感谢掸丹

I've just spent a lot of time on this issue, it really shouldn't be so difficult.

On the server app, I've got objects that are instanciated on the fly using reflection.  I've got a management client that for test and debugging purposes lets me request an empty serialized version of an object, which I can then edit, and submit back to the server.

All of the empty strings are showing up as:
<MemberName/>

Instead of:
<MemberName></MemberName>

I understand the reason behind this; however when you have a 20 or 30 member object being edited on the client side, its a really bad idea to rely on rewriting all the tags by hand.  I'm just looking for a quick way to reformat the XML so its easier to edit by hand.

Any ideas?

Thanks
Dan

推荐答案

我不知道有办法做到这一点。您的服务正在生成XML。在XML中,< MemberName />和< MemberName>< / MemberName>是一回事。

您的问题似乎是您希望将XML视为文本。我不知道如何告诉服务假装它没有生成XML。
I don't know that there's a way to do this. Your service is producing XML. In XML, <MemberName/> and <MemberName></MemberName> are the same thing.

Your issue seems to be that you want to treat the XML as text. I don't know how to tell the service to pretend it's not generating XML.


这篇关于空XML元素样式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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