← Prev in month
← Prev in thread
Next in thread →
Next in month →
Options for allowing XML in <skl> element
Title: Message Hello, In support of the idea by Christian to enable XML in the <skl> element, I will walk through the options for updating the XLIFF XML schema to allow XML markup in the skeleton element as follows. Suppose we had this simple XML file: (item 1) <note> <title>Things I Like</title> <para>This sample XML file is about guitars.</para> <para>I have three nice guitars (so far) that I like</para> <list> <listitem>Fender Jazz Bass</listitem> <listitem>Fender Stratocaster</listitem> <listitem>Fender Telecaster</listitem> </list> </note> It would be perfectly valid, today to express it the following way in XLIFF (please ignore the reference to XLIFF prototype 2.0 for the moment): (item 2) <?xml version="1.0" encoding="utf-8"?> <xliff xmlns="urn:oasis:names:tc:xliff:document:2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xmarker="http://www.xmarker.com" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:2.0 xliff-proto-2.0-strict.xsd http://www.xmarker.com xmarker_trial.xsd" version="2.0"> <file original="guitars.xml" source-language="en-us" datatype="plaintext" xml:space="default" target-language="de"> <header> <skl> <internal-file>guitars!</internal-file> </skl> </header> <body> <trans-unit id="title-0001"> <source xml:lang="en-us">Things I Like</source> </trans-unit> <trans-unit id="para-0001"> <source xml:lang="en-us">This sample XML file is about guitars.</source> </trans-unit> <trans-unit id="para-0002"> <source xml:lang="en-us">I have three nice guitars (so far) that I like</source> </trans-unit> <trans-unit id="listitem-0001"> <source xml:lang="en-us">Fender Jazz Bass</source> </trans-unit> <trans-unit id="listitem-0002"> <source xml:lang="en-us">Fender Stratocaster</source> </trans-unit> <trans-unit id="listitem-0003"> <source xml:lang="en-us">Fender Telecaster</source> </trans-unit> </body> </file> </xliff> The following (desired) improvement to <internal-file>guitars!</internal-file>, would be invalid: (item 3) <internal-file> <xmarker:note> <xmarker:title xid="title-0001">Things I Like</xmarker:title> <xmarker:para xid="para-0001">This sample XML file is about guitars.</xmarker:para> <xmarker:para xid="para-0002">I have three nice guitars (so far) that I like</xmarker:para> <xmarker:list> <xmarker:listitem xid="listitem-0001">Fender Jazz Bass</xmarker:listitem> <xmarker:listitem xid="listitem-0001">Fender Stratocaster</xmarker:listitem> <xmarker:listitem xid="listitem-0001">Fender Telecaster</xmarker:listitem> </xmarker:list> </xmarker:note> </internal-file> Escaping the XML, or using CDATA would be valid, but not friendly for implementers: (item 4) <internal-file> <xmarker:note> <xmarker:title xid="title-0001">Things I Like</xmarker:title> <xmarker:para xid="para-0001">This sample XML file is about guitars.</xmarker:para> <xmarker:para xid="para-0002">I have three nice guitars (so far) that I like</xmarker:para> <xmarker:list> <xmarker:listitem xid="listitem-0001">Fender Jazz Bass</xmarker:listitem> <xmarker:listitem xid="listitem-0001">Fender Stratocaster</xmarker:listitem> <xmarker:listitem xid="listitem-0001">Fender Telecaster</xmarker:listitem> </xmarker:list> </xmarker:note> </internal-file> Also, the work-around I previously offered would work. But it goes against the "spirit" of the skeleton element: (item 5) <header> <skl> <internal-file>Internal file is namespaced after the skeleton.</internal-file> </skl> <xmarker:note> <xmarker:title xid="title-0001">Things I Like</xmarker:title> <xmarker:para xid="para-0001">This sample XML file is about guitars.</xmarker:para> <xmarker:para xid="para-0002">I have three nice guitars (so far) that I like</xmarker:para> <xmarker:list> <xmarker:listitem xid="listitem-0001">Fender Jazz Bass</xmarker:listitem> <xmarker:listitem xid="listitem-0001">Fender Stratocaster</xmarker:listitem> <xmarker:listitem xid="listitem-0001">Fender Telecaster</xmarker:listitem> </xmarker:list> </xmarker:note> </header> Option 1 would be to allow an XML file to be embedded in the skeleton directly, not impacting internal-file or external file. The schema would need to be updated to something like this (from) <xsd:complexType name="ElemType_ExternalReference"> <xsd:choice> <xsd:element ref="xlf:internal-file"/> <xsd:element ref="xlf:external-file"/> </xsd:choice> </xsd:complexType> (to) <xsd:complexType name="ElemType_ExternalReference"> <xsd:choice> <xsd:element ref="xlf:internal-file"/> <xsd:element ref="xlf:external-file"/> <xsd:any maxOccurs="unbounded" minOccurs="0" namespace="##other" processContents="lax"/> </xsd:choice> </xsd:complexType> That would make the following valid: (Item 6) <xliff xmlns="urn:oasis:names:tc:xliff:document:2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xmarker="http://www.xmarker.com" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:2.0 xliff-proto-2.0-strict.xsd http://www.xmarker.com xmarker_trial.xsd" version="2.0"> <file original="guitars.xml" source-language="en-us" datatype="plaintext" xml:space="default" target-language="de"> <header> <skl> <xmarker:note> <xmarker:title xid="title-0001">Things I Like</xmarker:title> <xmarker:para xid="para-0001">This sample XML file is about guitars.</xmarker:para> <xmarker:para xid="para-0002">I have three nice guitars (so far) that I like</xmarker:para> <xmarker:list> <xmarker:listitem xid="listitem-0001">Fender Jazz Bass</xmarker:listitem> <xmarker:listitem xid="listitem-0001">Fender Stratocaster</xmarker:listitem> <xmarker:listitem xid="listitem-0001">Fender Telecaster</xmarker:listitem> </xmarker:list> </xmarker:note> </skl> </header> <body> <trans-unit id="title-0001"> <source xml:lang="en-us">Things I Like</source> </trans-unit> <trans-unit id="para-0001"> <source xml:lang="en-us">This sample XML file is about guitars.</source> </trans-unit> <trans-unit id="para-0002"> <source xml:lang="en-us">I have three nice guitars (so far) that I like</source> </trans-unit> <trans-unit id="listitem-0001"> <source xml:lang="en-us">Fender Jazz Bass</source> </trans-unit> <trans-unit id="listitem-0002"> <source xml:lang="en-us">Fender Stratocaster</source> </trans-unit> <trans-unit id="listitem-0003"> <source xml:lang="en-us">Fender Telecaster</source> </trans-unit> </body> </file> </xliff> Option 2 would be to add a new element to <skl> that acts as a "holder" element for the XML file. The schema would need to be updated to something like this (from) <xsd:complexType name="ElemType_ExternalReference"> <xsd:choice> <xsd:element ref="xlf:internal-file"/> <xsd:element ref="xlf:external-file"/> </xsd:choice> </xsd:complexType> (to) <xsd:complexType name="ElemType_ExternalReference"> <xsd:choice> <xsd:element ref="xlf:internal-file"/> <xsd:element ref="xlf:external-file"/> <xsd:element ref="xlf:internal-holder"/> </xsd:choice> </xsd:complexType> (and add) <xsd:element name="internal-holder"> <xsd:complexType> <xsd:sequence> <xsd:any maxOccurs="unbounded" minOccurs="0" namespace="##other" processContents="lax"/> </xsd:sequence> </xsd:complexType> </xsd:element> That would make the following valid: (Item 7) <xliff xmlns="urn:oasis:names:tc:xliff:document:2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xmarker="http://www.xmarker.com" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:2.0 xliff-proto-2.0-strict.xsd http://www.xmarker.com xmarker_trial.xsd" version="2.0"> <file original="guitars.xml" source-language="en-us" datatype="plaintext" xml:space="default" target-language="de"> <header> <skl> <internal-holder> <xmarker:note> <xmarker:title xid="title-0001">Things I Like</xmarker:title> <xmarker:para xid="para-0001">This sample XML file is about guitars.</xmarker:para> <xmarker:para xid="para-0002">I have three nice guitars (so far) that I like</xmarker:para> <xmarker:list> <xmarker:listitem xid="listitem-0001">Fender Jazz Bass</xmarker:listitem> <xmarker:listitem xid="listitem-0001">Fender Stratocaster</xmarker:listitem> <xmarker:listitem xid="listitem-0001">Fender Telecaster</xmarker:listitem> </xmarker:list> </xmarker:note> </internal-holder> </skl> </header> <body> <trans-unit id="title-0001"> <source xml:lang="en-us">Things I Like</source> </trans-unit> <trans-unit id="para-0001"> <source xml:lang="en-us">This sample XML file is about guitars.</source> </trans-unit> <trans-unit id="para-0002"> <source xml:lang="en-us">I have three nice guitars (so far) that I like</source> </trans-unit> <trans-unit id="listitem-0001"> <source xml:lang="en-us">Fender Jazz Bass</source> </trans-unit> <trans-unit id="listitem-0002"> <source xml:lang="en-us">Fender Stratocaster</source> </trans-unit> <trans-unit id="listitem-0003"> <source xml:lang="en-us">Fender Telecaster</source> </trans-unit> </body> </file> </xliff> Finally, Magnus mentioned that it would be useful for people to have the ability to add extensible attributes on the <internal-file> and <external-file> elements. This could be achieved by adding an extensibility point to these elements, like this: (Item 8) (from) <xsd:element name="internal-file"> <xsd:complexType> <xsd:simpleContent> <xsd:extension base="xsd:string"> <xsd:attribute name="form" type="xsd:string"/> <xsd:attribute name="crc" type="xsd:NMTOKEN"/> </xsd:extension> </xsd:simpleContent> </xsd:complexType> </xsd:element> <xsd:element name="external-file"> <xsd:complexType> <xsd:attribute name="href" type="xsd:string" use="required"/> <xsd:attribute name="crc" type="xsd:NMTOKEN"/> <xsd:attribute name="uid" type="xsd:NMTOKEN"/> </xsd:complexType> </xsd:element> (to) <xsd:element name="internal-file"> <xsd:complexType> <xsd:simpleContent> <xsd:extension base="xsd:string"> <xsd:attribute name="form" type="xsd:string"/> <xsd:attribute name="crc" type="xsd:NMTOKEN"/> <xsd:anyAttribute namespace="##other" processContents="skip"/> </xsd:extension> </xsd:simpleContent> </xsd:complexType> </xsd:element> <xsd:element name="external-file"> <xsd:complexType> <xsd:attribute name="href" type="xsd:string" use="required"/> <xsd:attribute name="crc" type="xsd:NMTOKEN"/> <xsd:attribute name="uid" type="xsd:NMTOKEN"/> <xsd:anyAttribute namespace="##other" processContents="skip"/> </xsd:complexType> </xsd:element> Which would make this markup valid: (Item 9) <skl> <internal-file xmarker:location="my.guitar.xml">guitars!</internal-file> </skl> I've attached sample files for you to test. If I missed the nature of the proposals, please let me know. Thanks, Bryan xliff2.0_proto.zip
← Prev in month
← Prev in thread
Next in thread →
Next in month →