When I read the file below, the Deserializer works fine.
But if I try to serialize the document read, I get this error:
Unhandled Exception: Localization.Xliff.OM.Exceptions.InvalidXmlSpecifierException: A valid XML prefix, namespace, and local name must be specified for the entity named 'version'. ---> System.Xml.XmlException: The '/' character, hexadecimal value 0x2F, cannot be included in a name.
If I replace the '/' in the ITS namespace URI by '_' all works fine.
<?xml` version="1.0"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:2.0" version="2.0" srcLang="en-us"
xmlns:its="http://www.w3.org/2005/11/its" its:version="2.0">
<file id="f1" original="test.html">
<unit id="tu1">
<segment>
<source>Test</source>
</segment>
</unit>
</file>
</xliff>
class Program
{
static void Main(string[] args)
{
using (IO.FileStream stream = new IO.FileStream(args[0], IO.FileMode.Open))
{
XliffReader reader = new XliffReader();
XliffDocument doc = reader.Deserialize(stream);
System.Console.WriteLine("cont 0 = " + doc.Files[0].Containers[0].Id);
String path2 = "C:\\temp\\out.xlf";
using (IO.FileStream stream2 = new IO.FileStream(path2, IO.FileMode.Create, IO.FileAccess.Write))
{
XliffWriter writer = new XliffWriter();
writer.Serialize(stream2, doc);
}
}
}
}