Difference between revisions of "LRM rxml Support"

From Lingoport Wiki
Jump to: navigation, search
(Example Project Definition File)
(xml parser type using RxmlParser.xml format definition)
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Example .rxml File ==
+
== Example .rxml File or a file extension using the ''xml'' parser type and the RxmlParser.xml definition ==
 
<pre>
 
<pre>
 
<?xml version="1.0" encoding="UTF-8"?>
 
<?xml version="1.0" encoding="UTF-8"?>
Line 13: Line 13:
 
</properties>
 
</properties>
 
</pre>
 
</pre>
  +
  +
== ''xml'' parser type using RxmlParser.xml format definition ==
  +
=== valid rxml syntax ===
  +
Files that use the ''xml'' parser and the [[LRM_XML_Support#RxmlParser.xml_structure|RxmlParser.xml]] format definition are expected to have valid rxml syntax
  +
  +
=== .rxml uses the ''xml'' parser type===
  +
When defining a project containing LRM Standard .rxml resource files, there is no need to define a ''&lt;parser-type&gt;'' as the ''xml'' parser will always be used along with the RxmlParser.xml format definition.
  +
  +
=== unique file extension needs to define ''xml'' parser type and copy over the RxmlParser.xml format definition ===
  +
If a unique file extension is a valid rxml file, then:
  +
<ul>
  +
<li>In the Project definition xml file, ''&lt;parser-type&gt;'' should be ''xml'' </li>
  +
<li>After creating the project
  +
<ul>
  +
<li>Copy over the RxmlParser.xml format definition located in ../lrm-server-&lt;x.x&gt;/samples/XmlParserExamples into the ../L10nStreamlining/&lt;group&gt;/projects/&lt;project&gt;/config folder</li>
  +
<li>Rename file RxmlParser.xml to xmlParser.xml</li>
  +
</ul>
  +
</ul>
   
 
== Example Project Definition File ==
 
== Example Project Definition File ==
Line 24: Line 42:
 
<top-level-dir>C:\acme\source</top-level-dir>
 
<top-level-dir>C:\acme\source</top-level-dir>
 
<detect-errors>
 
<detect-errors>
<missed-trans-error>1</missed-trans-error>
+
<missed-trans-error>0</missed-trans-error>
 
<parameter-mismatch-error>1</parameter-mismatch-error>
 
<parameter-mismatch-error>1</parameter-mismatch-error>
 
</detect-errors>
 
</detect-errors>
Line 37: Line 55:
 
<resource-extensions>
 
<resource-extensions>
 
<resource-extension>
 
<resource-extension>
  +
'''&lt;!-- parser-type not needed since .rxml is a standard LRM extension that maps to the xml parser type --&gt;'''
 
'''<extension>rxml</extension>'''
 
'''<extension>rxml</extension>'''
  +
'''<file-name-pattern>*-l_c_v</file-name-pattern>'''
  +
'''<use-pattern-on-dflt-locale>0</use-pattern-on-dflt-locale>'''
  +
'''<file-location-pattern/>'''
  +
'''<use-location-pattern-on-dflt-locale>0</use-location-pattern-on-dflt-locale>'''
  +
'''<base-file-encoding>UTF-8</base-file-encoding>'''
  +
'''<localized-file-encoding>UTF-8</localized-file-encoding>'''
  +
'''<parameter-regex-pattern><![CDATA[%[ds]|%\d+\$[ds]|%\{\w+\}]]></parameter-regex-pattern>'''
  +
</resource-extension>
  +
<resource-extension>
  +
'''&lt;!-- parser-type is required because .myext is not a standard LRM extension --&gt;'''
  +
'''<extension>''myext''</extension>'''
  +
'''''&lt;!-- Once the project is created, the RxmlParser.xml, located in the samples/XmlParserExamples, '''''
  +
''''' needs to copied over the project's config folder and renamed xmlParser.xml --&gt;'''''
  +
'''''<parser-type>xml</parser-type>'''''
 
'''<file-name-pattern>*-l_c_v</file-name-pattern>'''
 
'''<file-name-pattern>*-l_c_v</file-name-pattern>'''
 
'''<use-pattern-on-dflt-locale>0</use-pattern-on-dflt-locale>'''
 
'''<use-pattern-on-dflt-locale>0</use-pattern-on-dflt-locale>'''
Line 48: Line 81:
 
</resource-extensions>
 
</resource-extensions>
 
<dirset>
 
<dirset>
  +
<includes>
<!--Define the search patterns to include and/or exclude. (Uses Apache Ant pattern search).-->
 
<!--Examples: -->
+
<include-dir-file>**/**</include-dir-file>
  +
</includes>
<!-- A. '**/*.properties' matches all .properties files/dirs in a directory tree.-->
 
<!-- B. 'test/a??.resx' matches all files/dirs which start with an 'a', -->
 
<!-- then two more characters and then '.resx', in a directory called test.-->
 
<!-- C. '**' matches everything in a directory tree. -->
 
<!-- D. '**/source/**/XYZ*' matches all files/dirs which start with 'XYZ'-->
 
<!-- and where there is a parent directory called source (e.g. 'abc/source/def/ghi/XYZ123'). -->
 
<includes>
 
<!--Directories to include in the search for base resource files -->
 
<!--Examples: -->
 
<!-- <include-dir>**/source/**</include-dir>-->
 
<include-dir>**/**</include-dir>
 
</includes>
 
 
<excludes>
 
<excludes>
<!--Directories or files to exclude in the search -->
+
<exclude-dir-file>**/source/bin/**</exclude-dir-file>
<!--Examples: -->
+
</excludes>
<!-- <exclude-dir-file>**/source/bin/**</exclude-dir-file> -->
 
<!-- <exclude-dir-file>**/fileToIgnore.*</exclude-dir-file> -->
 
</excludes>
 
 
</dirset>
 
</dirset>
 
</lrmconf>
 
</lrmconf>

Latest revision as of 19:05, 1 September 2017

Example .rxml File or a file extension using the xml parser type and the RxmlParser.xml definition

<?xml version="1.0" encoding="UTF-8"?>
<properties>
    <!--SOURCE_FILE C:/Path/to/source/file/StringBug2.h-->
    <entry xml:space="preserve" key="STRI_MCAFEEC_15"><![CDATA[\\McAfee.com Personal Firewall]]></entry>
    <!--SOURCE_FILE C:/Path/to/source/file/StringBug3.cpp-->
    <entry xml:space="preserve" key="STRI_40FORAL_16"><![CDATA[%40 for all]]></entry>
    <entry xml:space="preserve" key="STRI_WRITELO_18"><![CDATA[Write Log Error]]></entry>
    <!--SOURCE_FILE C:/Path/to/source/file/weird.cpp-->
    <entry xml:space="preserve" key="WEIR_TWASTHE_20"><![CDATA['Twas the night before \"Christmas\"]]></entry>
    <entry xml:space="preserve" key="WEIR_ANDALLT_21"><![CDATA[and all through the house]]></entry>
</properties>

xml parser type using RxmlParser.xml format definition

valid rxml syntax

Files that use the xml parser and the RxmlParser.xml format definition are expected to have valid rxml syntax

.rxml uses the xml parser type

When defining a project containing LRM Standard .rxml resource files, there is no need to define a <parser-type> as the xml parser will always be used along with the RxmlParser.xml format definition.

unique file extension needs to define xml parser type and copy over the RxmlParser.xml format definition

If a unique file extension is a valid rxml file, then:

  • In the Project definition xml file, <parser-type> should be xml
  • After creating the project
    • Copy over the RxmlParser.xml format definition located in ../lrm-server-<x.x>/samples/XmlParserExamples into the ../L10nStreamlining/<group>/projects/<project>/config folder
    • Rename file RxmlParser.xml to xmlParser.xml

Example Project Definition File

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<lrmconf>
 <model-version>2.0.11</model-version>
 <project-name>DemoRxml</project-name>
 <project-desc>This is a sample LRM Project definition file, configured for Globalyzer Rxml resource files</project-desc>
 <group-name>acme</group-name>
 <top-level-dir>C:\acme\source</top-level-dir>
 <detect-errors>
   <missed-trans-error>0</missed-trans-error>
   <parameter-mismatch-error>1</parameter-mismatch-error>
 </detect-errors>
 <track-back-locale>br</track-back-locale>
 <pseudo-locale>eo</pseudo-locale>
 <target-locales>
   <locale>es_MX</locale>
   <locale>fr_CA</locale>
   <locale>fr_FR</locale>
 </target-locales>
 <default-locale>en_US</default-locale>
 <resource-extensions>
   <resource-extension>
     <!-- parser-type not needed since .rxml is a standard LRM extension that maps to the xml parser type -->
     <extension>rxml</extension>
     <file-name-pattern>*-l_c_v</file-name-pattern>
     <use-pattern-on-dflt-locale>0</use-pattern-on-dflt-locale>
     <file-location-pattern/>
     <use-location-pattern-on-dflt-locale>0</use-location-pattern-on-dflt-locale>
     <base-file-encoding>UTF-8</base-file-encoding>
     <localized-file-encoding>UTF-8</localized-file-encoding>
     <parameter-regex-pattern><![CDATA[%[ds]|%\d+\$[ds]|%\{\w+\}]]></parameter-regex-pattern>
   </resource-extension>
   <resource-extension>
     <!-- parser-type is required because .myext is not a standard LRM extension -->
     <extension>myext</extension>
     <!-- Once the project is created, the RxmlParser.xml, located in the samples/XmlParserExamples, 
       needs to copied over the project's config folder and renamed xmlParser.xml  -->
     <parser-type>xml</parser-type>
     <file-name-pattern>*-l_c_v</file-name-pattern>
     <use-pattern-on-dflt-locale>0</use-pattern-on-dflt-locale>
     <file-location-pattern/>
     <use-location-pattern-on-dflt-locale>0</use-location-pattern-on-dflt-locale>
     <base-file-encoding>UTF-8</base-file-encoding>
     <localized-file-encoding>UTF-8</localized-file-encoding>
     <parameter-regex-pattern><![CDATA[%[ds]|%\d+\$[ds]|%\{\w+\}]]></parameter-regex-pattern>
   </resource-extension>
 </resource-extensions>
 <dirset>
  <includes>
    <include-dir-file>**/**</include-dir-file>
  </includes>
   <excludes>
    <exclude-dir-file>**/source/bin/**</exclude-dir-file>
  </excludes>
 </dirset>
</lrmconf>