Saturday, December 29, 2012

Fixing the BAD XML Instance Issue – OBIEE 11g


“The current xml is invalid with the following errors: Bad xml instance!” is very unusual error but when this has been encountered it is become frustrating as it sounds the entire report can’t be saved !
I remember last time I had faced the similar issue in 11.1.1.3 version while I was building a new report from scratch . The error enforced me not to even edit the reports so I neither I can move to criteria nor I can save this . That was weird !  The only option left was to edit the XML using Catalog manager but until and unless you know where the problem lies you can’t fix it right ?
Now recently I got similar kind of issue in one of our upgraded 11.1.1.6 report which is a Combined request report and when I tried to edit the Criteria Analysis properties Interaction tab to remove Sort column of un-check any other options it throws me below error during the save:
Okay … so the error was at the very last line of the displayed XML as below:
Line:814, Col:61, Element ‘criteria’ is not valid for content model: ‘((criteria,interactionOptions,views,prompts,listOptions),segmentOptions)’
so the bug is around the green circled tags !! Reason is whenever you un-check some options under “Analysis-Properties” it will throw errors !! Probably this is some problem with the up-graded code in 11g from 10g as I tried to replicate the same creating a new reports from scratch which was pretty cool and removing any interaction works perfectly okay in the dashboard report .
After spending some times the reason of the issue found with the fix . I have customized the location for the below tag from Advanced XML :
<saw:interactionOptions drill=”true” movecolumns=”true” sortcolumns=”false” addremovevalues=”true” groupoperations=”true” calcitemoperations=”true” showhidesubtotal=”true” showhiderunningsum=”true” inclexclcolumns=”true”/>
Edited the XML and moved it from beforesection to the end of all. As it is combined request hence several would be present but placed it after all of them.
 After that apply the changes in Advanced XML and voila …. your problem fixed !  Note that this could be the one of incident with BAD XML error and probably you can found it in several other places with no relation to my above fix note . This those cases you need to dig down into more details of the Advanced XML generated and fix those issues as applicable for your case .
Bottom line is same . Dig into the XML details to find out the crappy code and the fix it !