Tally XML is a markup language used by Tally, a popular accounting software, for importing and exporting data. Tally XML files have a specific structure and syntax, which can be understood by referring to the Tally XML schema and the Tally XML tags.
To understand Tally XML, it is helpful to have a basic understanding of XML and its syntax. Tally XML files are like other XML files, but they have specific tags and attributes that are used to represent accounting data.
The Tally XML schema defines the structure and rules for creating valid Tally XML files. It specifies the elements, attributes, and data types that can be used in a Tally XML file, and the relationships between them. The schema also provides documentation and examples for each tag and attribute, which can be helpful in understanding how to use them.
To understand a specific Tally XML file, it is helpful to look at the tags and attributes used in the file, and to refer to the Tally XML schema for documentation and examples. The tags and attributes used in a Tally XML file represent accounting data such as ledgers, groups, vouchers, and inventory items.
For example, here is a simple Tally XML file that creates a ledger:
<ENVELOPE>
<HEADER>
<TALLYREQUEST>Import Data</TALLYREQUEST>
</HEADER>
<BODY>
<IMPORTDATA>
<REQUESTDESC>
<REPORTNAME>All Masters</REPORTNAME>
<STATICVARIABLES>
<SVCURRENTCOMPANY>My Company</SVCURRENTCOMPANY>
</STATICVARIABLES>
</REQUESTDESC>
<REQUESTDATA>
<TALLYMESSAGE xmlns:UDF=”TallyUDF”>
<LEDGER RESERVEDNAME=”” NAME=”Sales”>
<PARENT>Sundry Debtors</PARENT>
<ADDRESS.LIST TYPE=”String”>
<ADDRESS></ADDRESS>
<ADDRESS></ADDRESS>
</ADDRESS.LIST>
</LEDGER>
</TALLYMESSAGE>
</REQUESTDATA>
</IMPORTDATA>
</BODY>
</ENVELOPE>
In this example, the Tally XML file creates a ledger named “Sales” under the group “Sundry Debtors”. The ledger has no address information, so the ADDRESS tags are left empty.
By understanding the syntax and structure of Tally XML files, and by referring to the Tally XML schema for documentation and examples, it is possible to create, import, and export accounting data in Tally using XML.
HOW CAN WE BUILD XML STRING USING EXCEL :
Here’s an example of how to use the CONCATENATE function in Excel to create the Tally XML code you provided:
=CONCATENATE(“<TALLYMESSAGE xmlns:UDF=””TallyUDF””><LEDGER RESERVEDNAME=”””” NAME=””Sales””><PARENT>Sundry Debtors</PARENT><ADDRESS.LIST
TYPE=””String””><ADDRESS></ADDRESS><ADDRESS></ADDRESS></ADDRESS.LIST></LEDGER></TALLYMESSAGE>”)
This formula concatenates various strings together to create the Tally XML code you provided. Note that the quotation marks are escaped with double quotation marks, as Excel requires this in order to include quotation marks in a string. Also note that any line breaks or indentation in the formula will be removed when the formula is evaluated, so the resulting XML code will be a single line.
XML ESCAPE CHARACTERS:
XML escape characters are special characters that have a specific meaning in XML, and therefore need to be encoded to be included as text within an XML document. The following are the five predefined XML escape characters:
1) < – Represents the less-than symbol “<“.
2) > – Represents the greater-than symbol “>”.
3) & – Represents the ampersand symbol “&”.
4) ' – Represents the apostrophe symbol “‘”.
5) " – Represents the double quotation mark symbol “”.
When one of these special characters appears within an XML element, it must be replaced with its corresponding escape sequence to ensure that the XML parser will interpret the text correctly. For example, the text “10 > 5” would need to be encoded as “10 > 5” in an XML document.
Here’s an example of how to use escape characters in XML:
<example>
<text>This & That</text>
<quote>He said, "Hello!"</quote>
</example>
It’s worth noting that manually building Tally XML using the CONCATENATE function in Excel can be time-consuming and error-prone, especially if you need to create a large amount of XML code. If you need to create a lot of Tally XML, it may be more efficient to use a dedicated tool or library that can help you generate the XML programmatically.