microsoft / XLIFF2-Object-Model

If you’re looking to store localization data and propagate it through your localization pipeline allowing tools to interoperate then you may want to use the XLIFF 2.0 object model. The XLIFF 2.0 object model implements the OASIS Standard for the XLIFF 2.0 specification as defined at http://docs.oasis-open.org/xliff/xliff-core/v2.0/xliff-core-v2.0.html.
Other
86 stars 26 forks source link

Custom namespace prefixes should be allowed for attributes from known namespaces #33

Open arnoldbeiland opened 4 years ago

arnoldbeiland commented 4 years ago

Opening a sample file with the content below through XliffReader throws a NotSupportedException: "The attribute 'ns1:storageRestriction' is not supported on the Unit element.".

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:2.0" xmlns:ns1="urn:oasis:names:tc:xliff:sizerestriction:2.0" version="2.0" srcLang="de" trgLang="en">
    <file id="fQNQ3186">
        <ns1:profiles generalProfile="xliff:codepoints" storageProfile="xliff:utf16">
            <ns1:normalization general="nfc" storage="nfc"/>
        </ns1:profiles>
        <unit id="reference_info" ns1:storageRestriction="255">
            <segment>
                <source/>
                <target/>
            </segment>
        </unit>
    </file>
</xliff>

If the "ns1" namespace prefix is renamed to "slr", the file can be opened normally. Since the original version of the file is also valid, the XliffReader should not check what the prefix name is, only that it refers to the correct namespace ("urn:oasis:names:tc:xliff:sizerestriction:2.0" in this case).