Zi's Blog


Text-xml

Posted in Tips n Tricks by zimakki on the July 24th, 2008

Just stumbled on this cool PowerShell method. Below is are a couple of examples of how I see myself using it:

73> ni -type file -value “<crap></xml>” -name “crap.xml”

    Directory: Microsoft.PowerShell.Core\FileSystem::C:\projects\depot\Test

Mode           LastWriteTime       Length Name
—-           ————-       —— —-
-a—    24/07/2008    19:36           12 crap.xml

74> test-xml .\crap.xml
False
75> ni -type file -value “<hello></hello>” -name “valid.xml”

    Directory: Microsoft.PowerShell.Core\FileSystem::C:\projects\depot\Test

Mode           LastWriteTime       Length Name
—-           ————-       —— —-
-a—    24/07/2008    19:37           15 valid.xml

76> test-xml .\valid.xml
True
77> test-xml .\crap.xml -ErrorVariable
Test-Xml : Missing an argument for parameter ‘ErrorVariable’. Specify a parameter of type ‘System.String’ and try again.
At line:1 char:35

+ test-xml .\crap.xml -ErrorVariable <<<<

 

This will help me out when I fiddling around with all the nAnt build scripts I seem to be playing with these days!

 

Technorati Tags:

3 Responses to 'Text-xml'

Subscribe to comments with RSS or TrackBack to 'Text-xml'.


  1. on September 23rd, 2011 at 5:24 am

    platform, Windows and the processor will try and sabotage your efforts


  2. on October 24th, 2011 at 9:22 am

    You may be looking for any men’s natural uggs outlet together with the muted begin browsing which is every trendy and practical.


  3. on November 16th, 2011 at 7:07 am

    Wear the Tory Burch Heels are so comfortable and beautiful.When you wear the tory burch shoes and take the Tory Burch Wallets to go outside,you are the most fashion women.

Leave a Reply