.Net 4.5 是否还支持 XML 1.1(对于 XML 1.0 中无效的字符)? [英] Does .Net 4.5 support XML 1.1 yet (for characters invalid in XML 1.0)?

查看:36
本文介绍了.Net 4.5 是否还支持 XML 1.1(对于 XML 1.0 中无效的字符)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是在 Web 服务(客户端)的上下文中.我需要与后端系统(Java)接口,并且需要在  中传输一些控制字符范围.

This is in the context of Web Services (client end). I need to interface with a back-end system (Java) and it is a requirement to transmit some control characters in the  and  range.

我很清楚 XML 1.0 不支持这一点,但我很想知道 .NET 4 平台或 .NET 4.5 Web 服务框架是否支持 XML 1.1 中的对话.

I'm well aware that XML 1.0 doesn't support this, but am interested to know if the .NET 4 platform or .NET 4.5 web services framework support conversations in XML 1.1.

推荐答案

不,它看起来不像 XmlReader(.NET 中大部分 XML 支持的核心)支持 1.1:

No, it doesn't look like XmlReader (the core of much of the XML support in .NET) supports 1.1:

using System;
using System.IO;
using System.Xml;

class Program
{
    static void Main(string[] args)
    {
        string xml = "<?xml version="1.1" ?><tag>&#x1</tag>";
        var reader = XmlReader.Create(new StringReader(xml));
        while (reader.Read());
    }
}

输出:

Unhandled Exception: System.Xml.XmlException: Version number '1.1' is invalid.
Line 1, position 16.

我看过XmlReaderSettings 看看是否有任何帮助,但我认为没有.基本上我认为你暂时被困住了:(

I've looked at XmlReaderSettings to see if anything there would help, but I don't think it does. Basically I think you're stuck for the moment :(

稍微阅读一下 XML 1.1,看起来它没有被广泛部署或推荐,所以我并不特别惊讶它在 .NET 4.5 中不受支持.我的猜测是它永远不会,因为它不是一个特别新的建议.最新版本是 第二版,可追溯到 2006 年.如果不支持 7多年后,我怀疑必须有一些重大事件才能让它在未来值得支持.

Reading around XML 1.1 a bit, it looks like it's not widely deployed or recommended, so I'm not particularly surprised that it's not supported in .NET 4.5. My guess is that it never will be, given that it's not a particularly new recommendation. The most recent version is the 2nd edition which dates back to 2006. If it's not supported 7 years later, I suspect there'd have to be some significant event to make it worth supporting in the future.

这篇关于.Net 4.5 是否还支持 XML 1.1(对于 XML 1.0 中无效的字符)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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