XML comparison help

M

matt

I am trying to compare a two segments of XML from two seperate files.
The two XML files are 1)a message pulled from my private Queue and
2)an XML file that is loaded as an XmlDocument object.

So in my winform app, i click a button(btnLoad)that sends a message
to the Queue.
Immediately following that, i click another button(btnCheck) that will
pull the message off of the queue and display it in xml form in my
Textbox and perform a comparison(with a pass/fail result).
Here is what is displayed in my form:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<wsa:Action>http://schemas.xmlsoap.org/ws/2004/01/eventing/SubscriptionEnd</wsa:Action>
<wsa:MessageID>uuid:27ccc20b-f223-4be4-87ab-b94069f99aa7</wsa:MessageID>
<wsa:To>soap.msmq:FormatName:DIRECT=OS:./PRIVATE$/PubSubTestQueue</wsa:To>
<SubscriptionEnd xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://schemas.xmlsoap.org/ws/2004/01/eventing">
<Id>c76e07b5-ef26-4a5a-8eff-7e9d11dd9a7c</Id>
<Code>wse:DuplicateDetected</Code>
<Reason>Subscription expired.</Reason>
</SubscriptionEnd>
<wsse:Security>
<wsu:Timestamp
wsu:Id="Timestamp-2cfe1fc1-b552-4b15-a4b1-7563b0b33c9f">
<wsu:Created>2004-09-16T22:58:24Z</wsu:Created>
<wsu:Expires>2004-09-16T23:03:24Z</wsu:Expires>
</wsu:Timestamp>
</wsse:Security>
</soap:Header>
<soap:Body />
</soap:Envelope>




Now where i'm stuck is that I want to validate this displayed Xml, in
particuliar I want to make sure that the following elements from the
above Textbox get compared(to an XML file that i have loaded in an
XmlDocument object):

<wsa:Action>http://schemas.xmlsoap.org/ws/2004/01/eventing/SubscriptionEnd</wsa:Action>
<wsa:To>soap.msmq:FormatName:DIRECT=OS:./PRIVATE$/PubSubTestQueue</wsa:To>
<wsa:MessageID>uuid:27ccc20b-f223-4be4-87ab-b94069f99aa7</wsa:MessageID>
<wsa:To>soap.msmq:FormatName:DIRECT=OS:./PRIVATE$/PubSubTestQueue</wsa:To>
<SubscriptionEnd xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://schemas.xmlsoap.org/ws/2004/01/eventing">
<Id>c76e07b5-ef26-4a5a-8eff-7e9d11dd9a7c</Id>
<Code>wse:DuplicateDetected</Code>
<Reason>Subscription expired.</Reason>

I want my application to be have a third button (btnTest) that will
take important content from the Textbox display and compare it against
the following arbitrary XML file:


<?xml version="1.0" encoding="utf-8" ?>
<Root xmlns:wsa='foo'>
<DataParameters>
<Topic>Test.TopicA</Topic>
<NotifyTo>soap.msmq:FormatName:DIRECT=OS:.\PRIVATE$\PubSubTestQueue</NotifyTo>
<ExpireAt>1</ExpireAt>
</DataParameters>
<AcceptanceValues>
<wsa:Action>http://schemas.xmlsoap.org/ws/2004/01/eventing/SubscriptionEnd</wsa:Action>
<wsa:To>soap.msmq:FormatName:DIRECT=OS:./PRIVATE$/PubSubTestQueue</wsa:To>
<wsa:MessageID>uuid:27ccc20b-f223-4be4-87ab-b94069f99aa7</wsa:MessageID>
<wsa:To>soap.msmq:FormatName:DIRECT=OS:./PRIVATE$/PubSubTestQueue</wsa:To>
<SubscriptionEnd xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://schemas.xmlsoap.org/ws/2004/01/eventing">
<Id>c76e07b5-ef26-4a5a-8eff-7e9d11dd9a7c</Id>
<Code>wse:DuplicateDetected</Code>
<Reason>Subscription expired.</Reason></AcceptanceValues>



I tried to keep this short and compact, but i just couldn't do it.
I'd appreciate any help any direction someone could give me.
 
M

matt

Unfortunately not Chris, but thanks anyway.
The reason that external utility doesnt work is because i'm trying to
add this functionality within a winform that does a series of other
tasks as well.
This would the last function, a "compare and report" button. The
comparison wouldn't be bad if it were just a straight file to file
compare, or one particuliar node's inner XML.

-Matt
 
C

Chris R. Timmons

(e-mail address removed) (matt) wrote in
Unfortunately not Chris, but thanks anyway.
The reason that external utility doesnt work is because i'm
trying to add this functionality within a winform that does a
series of other tasks as well.
This would the last function, a "compare and report" button.
The comparison wouldn't be bad if it were just a straight file
to file compare, or one particuliar node's inner XML.

Matt,

I'm not sure I understand. You want code you can link into your own
app, right? The XMLDiff link I posted has that. Click on the
download link and install the XMLDiffPatch code. It comes with
complete C# code and several example apps.
 
B

Brent D. Rockwood, MCP

The XMLDiffPatch code is quite useful, and can easily be incorporated
into a WinForms (or any other) app in just a few minutes. However, be
careful about putting it in an app for commercial use or
redistribution. The license does not permit this. If I remember
correctly, the email for more licensing info is
(e-mail address removed).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top