Sunday, December 30, 2007

The Rules of XML at The Publisher's Arms

Good Evening Ladies & Gents,

Been a little while since the last posting, what with the Christmas and New Year holidays on us, we have been a little stretched behind the bar here.

After talking to a couple of our regulars here at The Publisher's, it seems that a few people are having some issues when it comes to writing well-formed and valid XML for Bursting Control Files and Data Templates. On further investigation, I discovered that a lot of people are unaware of the correct Rules of XML. The Publisher engines will not accept XML that does not adhere to the Rules of XML.

To help people out, I decided to jot the rules down on a beer mat for the regulars to share, and now I am typing them up here.

Defintions

  • Well-Formed XML - XML is well-formed when it conforms to the very strict, but simple rules laid out in the W3C XML Specification.
  • Valid XML - XML is valid when it conforms to the rules dictated by the W3C XML Specification and also the rules specified by a DTD or a Schema. (Note: All Bursting Control Files and Data Templates are validated against a schema when they are uploaded to a Data Definition)

The Rules of XML

  1. Close on the way out - All XML elements must have a closing tag.
  2. Keep an eye on your cases - XML elements are case sensitive. "Message" is not the same as "message". Open and Closing tags must be exactly the same.
  3. Get nested - XML elements must be properly nested. This means all Child Elements must be closed before the parent element can be closed.
  4. Root marks the spot - An XML document must have one and only one root element. All other XML elements must be within this root. The only exception is Processing Instructions which must be at the start of the document, above the root.
  5. Quote my attributes - All XML element attributes must have quotes around the values. You may use either single (') or double (") quotes, but be consistent throughout your document to make it easier for someone else to modify in the future.
  6. Preserve my white-space - All white-space is preserved in an XML document. If you add a line break in your data, it will remain. (Note: When viewing XML through IE, it will suppress the white-space, but it is still there if you view the document in Notepad!)
  7. Going to a naming convention - Finally, there are a couple of restrictions around the names for XML elements:
  • Element names can contain numbers, letters and other special characters such as (,.#
  • Element names MUST NOT start with a number or a punctuation character
  • Element names MUST NOT start with XML, or any upper or lower case combination of these three letters (xml, or XmL)
  • Element names may not contain any white-spaces

Do be careful when naming elements and including special characters, for example if you were to call an element element.name1, when this is parsed it could be interpreted as name1 being an attribute of the class element, which would obviously be incorrect! Similarly for the element name a+b, XML Publisher will interpret this as a summation of the elements a and b and will subsequently error or produce a blank.

As you can see, we have very large beer mats here at The Publisher's Arms, but if you adhere to these very simple rules you should have fewer problems when creating your Bursting Control Files and Data Templates.

Ding, ding... drink up please... give us your glasses then show us your a*ses!!

Remember people. don't drink and drive!!

Cj

Wednesday, December 19, 2007

Two pints of Data Template and a Packet of XML please Guv!

Evenin' All

I saw a forum post today about how to show the XML data when developing a Data Developing with BI Publisher Standalone.


As I like to start of simply, I thought this would be a good one for my first proper Publisher's Arms blog post... so here goes.

First you need to create a Data Template to query the data from the selected Data Source and bring it into BI Publisher. The example below simply queries the EMP table in the SCOTT schema to return the ENAME and EMPNO columns:

After this click the "Save" button then click the "View" link. and you should be able to see the XML output from the data template on the screen. If you cannot see the data, try clicking the "View" button to refresh the page. You can then export this and save it to your local drive to help you develop your templates using the Template Builder Plug-In for MS Word.

I hope this helps at least one person.

Have a good evening everyone, next I think we will go over Bursting eText templates. Any comments, feedback and suggestions for future blogs are much appreciated.

In the meantime, "It's closing time... you don't have to go home, but you can't stay here!"

Cj

Welcome to the Publisher's Arms!

Evening Ladies & Gents,

Of late I have started receiving emails from users wondering just what BI / XML Publisher is and how to use it. With the amount of repetition I was doing, and the fact that my small, free email address was starting to run out of space, I have decided to start my own blog to share some of this information.

Why the Pub theme?

No particular reason, apart from the fact that whenever I tend to answer questions in the BI Publisher forum, I am usually sitting in a hotel bar somewhere, wondering what on earth I can do with all this time on my hands and reading books about American ex-spies getting their revenge on their redundancy paying ex-employer!! God bless Robert Ludlum!!!!

I am also from the UK where the Great British Pub is a national institution. Raise your glasses everybody, and throw another log on the fire. CHEERS!!

So who am I to talk about such a hot topic?

Well... I work for Oracle UK as a Technical Consultant, with expertise in XML and BI Publisher. I have been working with it for a few years and have developed many solutions for clients both within the UK and abroad.

I couldn't tell you exactly how I got into it, as I don't exactly remember. I do remember having a training course on it during my induction to Oracle, and thinking, WOW, this technology is really clever, I want to know more..... So... after several projects, lots of self-study time and plenty of support from my boss, I finally decided that I had enough examples, experience and lonely hotel nights to start up my own pub... erm... I mean blog!!

I do not claim to be any kind of author, or even someone who could differentiate between prose and punctuation, but as any good barman would tell you, they hope the advise and views they give will be of use and help you out in the time when you need it most (if they are really nice, you might even by them a pint!!)

Please feel free to ask me questions, or drop suggestions as to what you would like to see here. I haven't checked yet, but I am really hoping there is "Post Reply" functionality for this blog!!!

Ding, ding, "Time at the bar, show us ya' empty glasses please!"

Cj