XML to ASCII Conversion


A chief benefit of XML is that it allows you to tag data and output (or transform) element content into any one of a number of formats including plain text (ASCII). While this can be done programmatically, XSL transformation is designed specifically for this purpose. The main challenges in creating a flawless conversion are twofold: getting the correct data from the XML-tagged document; and handling special characters.

XML Schema

  • XML is by definition structured information. Many XML documents define a formal schema that describes how your XML elements can be used. In effect, the schema acts like a roadmap to your XML document. So the first step is to analyze your schema and map your elements to their ASCII counterparts. This can be a simple matter of pulling data directly from an element's content. Be aware, however, that an element's attributes may also contain critical data, such as a database record number that must be included in the conversion.

Implied Schema

  • When no formal schema is provided, the structure of the XML document is still implied. This makes it possible to reconstruct the schema. A good strategy in this case is to examine the elements within your document instance and write out a schema that handles every instance in your document.

Character Sets

  • There are many character sets to cover the specialized characters used in different languages around the world. The ASCII character set specifically references text for the English language. According to Richard Ishida of the World Wide Web Consortium, "the Unicode character set contains characters for most of the living languages and scripts in the world." (http://www.w3.org/International/getting-started/characters.) To avoid potential problems, a good practice is to use the Unicode UTF-8 character set when making your conversions.


  • XML defines a small set of characters, called predefined entities. These entities include the characters for the ampersand and the semicolon, which have specific uses in XML and are therefore restricted. To get around this, you must escape these characters. For example, you must use "&" to represent the ampersand character in XML. Be aware of these and other special escaped characters in your data.

Related Searches


Promoted By Zergnet



You May Also Like

  • How to Create XSL From an XML File

    XSL is a stylesheet language used to format elements created in XML. Therefore, XSL is typically written by hand using a stylesheet...

  • HTML to XML Conversion Tools

    Although similar in appearance and function, Web-based HyperText Markup Language, or HTML is not the same as XML, or Extensible Markup Language....

Related Searches

Check It Out

Geek Vs Geek: Robot battles, hoverboard drag race, and more

Is DIY in your DNA? Become part of our maker community.
Submit Your Work!