Monday, March 16, 2009

Rules to Remember with XML

Rules to Remember

We have covered the basic knowledge of XML. Now there are some standard rules you need to follow when you work with XML files. Any validation of the rules will throw you an error by any standard XML processor including the one used by BI Publisher. Good news is, XML has only a few rules and all the rules actually make sense and most importantly they are easy enough to follow.

So here is a list of main rules to remember for you at least.

  • All XML Elements must have a closing tag
  • Element and Attribute names are case sensitive
  • Element must be properly nested
  • Documents must have a root element
  • Attribute Values must be quoted
  • White Space value is preserved
  • Element/Attribute Values can contain letters, numbers, and other characters
  • Element Name Must not start with a number or punctuation character
  • Element Name Must not start with the letters ‘xml’ (or XML)
  • Element Name cannot contain spaces

I’ve seen many users at our clients have encountered errors when they developed or run BI Publisher reports (RTF template or Data template) because of the non-compliance with the above rules. As you know currently we still need to develop the Data Template files manually and many of us uses text editors to edit the XML format files. And we make some typo, forgot single/double quotes, mistakenly put a space in the element name, or forgot to end the node with closing element. All of these cases will throw you out an error. Also there is another type of problem because of the strict rules listed above. For example when you are developing a RTF Template but couldn’t get any data in the output even though there should be a data and you have mapped the XML element data in the RTF Template. This can often be the case where you have typed the element name in lower case when the element name is presented in upper case in your XML data. Yes, XML Element name is case sensitive! So you need to make sure if the XML Element name is upper case or lower case (or combination) in the XML data file first then need to correctly type the name in your RTF Template.

Many cases when you start developing Data Template or RTF Template and get some strange error that you have no idea are caused by violations of the above rules. So let’s keep those rules in your mind when you work with Data Template and RTF Template.

Provided by Kanichiro Nishida, Consulting Manager, Oracle EPM & BI Consulting


  1. It would be very useful to know what limitations exist for XSD schemas that are used as input sources to the Template Builder. For example, we have recently learned that you cannot use XSD schemas that contain Import or Include elements. What about Choice or other parts of the standard that are not supported? Are these documented anywhere?

  2. So far we know only of import/include statements.
    The main issue with XSD support is that hardly anybody is using XSD with BI Publisher.

    It was implemented for the Peoplesoft integration,
    which then did not make use of the functionality.

    I always thought it was a good idea, but since
    most customers just generate XML using our data engine or generate themselves they often don't
    have an XSD or do not want to create one.

    So given that the feature may be more buggy then
    some others because hardly anyone uses it.

    I was suprised, but is the realty is I was contacted about twice in 4 years about XSD.

    Development Manager, BI Publisher