Windows Vista Forums
Vista Forums Home Join Vista Forums Webcasts Windows 7 Forum Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

XML Dif?

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 02-09-2007   #1 (permalink)
nikhil
Guest


 

XML Dif?

Hi,
I am a new user to PowerShell. I have written a small program which
will send a request in XML and get the response in XML, Now I have to
compare the response which I got with Reference response XML. I don't
want to comapre line by line but it should be smart enough to give the
output saying so & so tag/attribute is missing/added in the actual
response xml. Is anybody aware of any such utility?

Thanks,
Nikhil


My System SpecsSystem Spec
Old 02-09-2007   #2 (permalink)
RichS
Guest


 

RE: XML Dif?

Do mean you want to compare to an XML schema or to an XML reference file?

Have you looked at test-xml in the powershell community extensions

http://www.codeplex.com/Wiki/View.as...e=PowerShellCX

--
Richard Siddaway
Please note that all scripts are supplied "as is" and with no warranty
Blog: http://richardsiddaway.spaces.live.com/
PowerShell User Group: http://www.get-psuguk.org.uk


"nikhil" wrote:

> Hi,
> I am a new user to PowerShell. I have written a small program which
> will send a request in XML and get the response in XML, Now I have to
> compare the response which I got with Reference response XML. I don't
> want to comapre line by line but it should be smart enough to give the
> output saying so & so tag/attribute is missing/added in the actual
> response xml. Is anybody aware of any such utility?
>
> Thanks,
> Nikhil
>
>

My System SpecsSystem Spec
Old 02-09-2007   #3 (permalink)
Keith Hill
Guest


 

Re: XML Dif?

"RichS" <RichS@discussions.microsoft.com> wrote in message
news:44E3F577-A033-4B8A-9C85-8E9244D91F1A@microsoft.com...
> Do mean you want to compare to an XML schema or to an XML reference file?
>
> Have you looked at test-xml in the powershell community extensions
>
> http://www.codeplex.com/Wiki/View.as...e=PowerShellCX
>


We don't have Compare-Xml yet but I've been thinking about it. It would be
quite useful I think.

--
Keith

My System SpecsSystem Spec
Old 02-09-2007   #4 (permalink)
Brandon Shell
Guest


 

Re: XML Dif?

Wouldn't compare-object do this?

Example:
[xml]$xmldoc1 = $pathtoXml\$xmlfilename
[xml]$xmldoc2 = $pathtoXml\$xmlfilename2

compare-object $xmldoc1 $xmldoc2

--
Brandon Shell
---------------
Stop by my blog some time
Blog: http://www.bsonposh.com/
PSH Scripts Project: www.codeplex.com/psobject
--------------------------------------

"Keith Hill" <r_keith_hill@mailhot.nospamIdotcom> wrote in message
news:4F6D2971-8463-4767-A9DC-4D8FD0300B68@microsoft.com...
> "RichS" <RichS@discussions.microsoft.com> wrote in message
> news:44E3F577-A033-4B8A-9C85-8E9244D91F1A@microsoft.com...
>> Do mean you want to compare to an XML schema or to an XML reference file?
>>
>> Have you looked at test-xml in the powershell community extensions
>>
>> http://www.codeplex.com/Wiki/View.as...e=PowerShellCX
>>

>
> We don't have Compare-Xml yet but I've been thinking about it. It would
> be quite useful I think.
>
> --
> Keith


My System SpecsSystem Spec
Old 02-09-2007   #5 (permalink)
Adam Geras
Guest


 

Re: XML Dif?

depending on the situation, it almost feels better to use an XML Schema
instead of comparing a generated document to a reference instance document

"Brandon Shell" wrote:

> Wouldn't compare-object do this?
>
> Example:
> [xml]$xmldoc1 = $pathtoXml\$xmlfilename
> [xml]$xmldoc2 = $pathtoXml\$xmlfilename2
>
> compare-object $xmldoc1 $xmldoc2
>
> --
> Brandon Shell
> ---------------
> Stop by my blog some time
> Blog: http://www.bsonposh.com/
> PSH Scripts Project: www.codeplex.com/psobject
> --------------------------------------
>
> "Keith Hill" <r_keith_hill@mailhot.nospamIdotcom> wrote in message
> news:4F6D2971-8463-4767-A9DC-4D8FD0300B68@microsoft.com...
> > "RichS" <RichS@discussions.microsoft.com> wrote in message
> > news:44E3F577-A033-4B8A-9C85-8E9244D91F1A@microsoft.com...
> >> Do mean you want to compare to an XML schema or to an XML reference file?
> >>
> >> Have you looked at test-xml in the powershell community extensions
> >>
> >> http://www.codeplex.com/Wiki/View.as...e=PowerShellCX
> >>

> >
> > We don't have Compare-Xml yet but I've been thinking about it. It would
> > be quite useful I think.
> >
> > --
> > Keith

>
>

My System SpecsSystem Spec
Old 02-09-2007   #6 (permalink)
Keith Hill
Guest


 

Re: XML Dif?

"Brandon Shell" <tshell.mask@gmail.com> wrote in message news:O4ei68GTHHA.5068@TK2MSFTNGP03.phx.gbl...
> Wouldn't compare-object do this?
>
> Example:
> [xml]$xmldoc1 = $pathtoXml\$xmlfilename
> [xml]$xmldoc2 = $pathtoXml\$xmlfilename2
>
> compare-object $xmldoc1 $xmldoc2


That didn't work when I tried it before:

21> $x1 | fxml
<doc>
<book author="Hugh Jass">
<title>To Here and back</title>
</book>
</doc>
22> $x2 | fxml
<doc>
<book author="R. Hugh Jass">
<title>Here, there and everywhere</title>
</book>
</doc>
23> Compare-Object $x1 $x2
24>

Compare doesn't work here unless you specify which properties to compare but that would be too cumbersome (if it would even provide a satisfying result).

--
Keith
My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes




Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51