请问净4.5支持XML 1.1,但(对于字符XML 1.0无效)?字符、XML

2023-09-02 01:41:37 作者:烟、指尖缭绕

这是Web服务(客户端)的范围内。 我需要一个后端系统(Java)的接口,它是发送要求在一些控制字符&放大器;#14; &放大器;#31; 范围

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 (多大的XML支持的核心。 NET)支持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。我的猜测是,它永远不会是,因为它不是一个特别新的建议。最新版本是第2版其历史可以追溯到到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.