views:

83

answers:

2

I'm new to SSRS. We'll have two slightly different chunks of XML in a single row of an SQL Server database table. In an SSRS report we'll want to show only the differences between the XML chunks. I don't know how to do this, but I suspect the XML Type in SQLServer 2005 might be useful, or XSLT transformations in SSRS. Could anyone point me in the right direction?

A: 

I am not sure whether there is something readily available to identify the differences in two XML documents. However, I once wrote a function that can compare two XML documents and say whether they have the same content or not.

You can find the code here. May be you can take the code, modify it and return the differences between the two XML documents - in case no other option is left.

Jacob Sebastian
A: 

I didn't underetand your question as well, But if you mean that, You have two XML (string) and in your Report you want to show just the different partof these two strings.

If I were you, I wrote a class in .NET (c#) which 'take two xml' and process the different with .NET abilities, then I return the different in an Array like

note that the following code is a pseudu code not a real one.

public string[] ComapreXML(XMLDocument first, XMLDocument second)
{
    string[] result = null;
    if(first.element.content != second.element.content)
         result.add(first.element.getData());
   return result;
}

the I'd compile this class and add this class to SSRS (I wrote an article about How to extend SSRS Functionalities here)

And finally inthe report I use this code to get result.

Let me know was it usefull or not.

Nasser Hadjloo
I was hoping for a declarative solution. I did not know SSRS could be extended like this, but this would perhaps do the job. Thanks.
silves89