Difference between revisions of "LRM XML Support"
(→XML Parser Syntax) |
(→XML Parser Syntax) |
||
Line 5: | Line 5: | ||
The xmlParser.xml directs LRM on the location of the keys and values within the xml files as well as whether the key/value is translatable. The xml syntax is defined by 3 tokens: |
The xmlParser.xml directs LRM on the location of the keys and values within the xml files as well as whether the key/value is translatable. The xml syntax is defined by 3 tokens: |
||
<ul> |
<ul> |
||
− | <li><b>TOKEN_KEY</b></li> |
+ | <li><b>TOKEN_KEY</b></li> |
<li><b>TOKEN_TRANSLATABLE</b></li> |
<li><b>TOKEN_TRANSLATABLE</b></li> |
||
<li><b>TOKEN_VALUE</b></li> |
<li><b>TOKEN_VALUE</b></li> |
||
</ul> |
</ul> |
||
+ | |||
+ | === Limitations of XML Definition === |
||
+ | There are structural limitations to xml files that can be parser by LRM. |
||
+ | <ul> |
||
+ | <li><b>TOKEN_KEY must be defined before TOKEN_VALUE</b></li> |
||
+ | <li><b>TOKEN_TRANSLATABLE must be an attribute</b></li> |
||
+ | <li><b>TOKEN_VALUE cannot be an attribute</b></li> |
||
+ | <ul> |
||
=== OTB XML Parser Definitions === |
=== OTB XML Parser Definitions === |
Revision as of 17:52, 1 September 2017
Contents
Formatting xml files
LRM uses the xmlParser.xml file to parse any extensions that have a xml parser type. This file is located in the ../L10nStreamlining/<group>/projects/<project>/config folder.
XML Parser Syntax
The xmlParser.xml directs LRM on the location of the keys and values within the xml files as well as whether the key/value is translatable. The xml syntax is defined by 3 tokens:
- TOKEN_KEY
- TOKEN_TRANSLATABLE
- TOKEN_VALUE
Limitations of XML Definition
There are structural limitations to xml files that can be parser by LRM.
- TOKEN_KEY must be defined before TOKEN_VALUE
- TOKEN_TRANSLATABLE must be an attribute
- TOKEN_VALUE cannot be an attribute
- AndroidParser.xml format definition used for as the default for .xml extensions.
- ResxParser.xml format definition used for .resx extensions.
- RxmlParser.xml format definition used for .rxml extensions.
OTB XML Parser Definitions
There are 3 out-of-the-box parser definitions for XML files.
AndroidParser.xml structure
The AndroidParser.xml file defines the structure of Android files.
Sample Android xml file
A typical Android file has the following structure:
<?xml version="1.0" encoding="UTF-8"?> <resources> <string name=""hello_world"" translatable=""true"">Hello World</string> <string name=""goodbye"" translatable=""true"">Good Bye</string> </resources>
Parser definition for Android files
<?xml version='1.0' encoding='utf-8'?> <resources> <string name="TOKEN_KEY" translatable="TOKEN_TRANSLATABLE">TOKEN_VALUE</string> </resources>
ResxParser.xml structure
The ResxParser.xml file defines the structure of .resx xml files.
Sample Resx xml file
A typical Resx file has the following structure:
<?xml version="1.0" encoding="UTF-8"?> <root> <data name="hello_world"> <value>Hello World</value> <data name="goodbye"> <value>Good Bye</value> </root>
Parser definition for Resx files
<?xml version='1.0' encoding='utf-8'?> <root> <data name="TOKEN_KEY" > <value>TOKEN_VALUE</value> </root>
RxmlParser.xml structure
The RxmlParser.xml file defines the structure of .rxml xml files.
Sample Rxml xml file
A typical Rxml file has the following structure:
<?xml version="1.0" encoding="UTF-8"?> <properties> <entry key="hello_world">Hello World</entry> <entry key="goodbye">Good Bye</entry> </properties>
Parser definition for Rxml files
<?xml version="1.0" encoding="UTF-8"?> <properties> <entry key="TOKEN_KEY">TOKEN_VALUE</entry> </properties>