linq to xml selection/update

Posted by gleasonomicon on Stack Overflow See other posts from Stack Overflow or by gleasonomicon
Published on 2011-01-13T00:38:41Z Indexed on 2011/01/13 10:54 UTC
Read the original article Hit count: 203

Filed under:

If I have the following xml, how would I use linq to xml blank out the date fields in each video node? I wanted to do it for the purpose of a comparison in a unit test.

<?xml version="1.0" encoding="utf-8" standalone="yes" ?> 
<main>
<videos>
    <video>
        <id>00000000-0000-0000-0000-000000000000</id> 
        <title>Video Title</title> 
        <videourl>http://sample.com</videourl> 
        <thumbnail>http://sample.com</thumbnail> 
        <dateCreated>2011-01-12T18:54:56.7318386-05:00</dateCreated> 
        <dateModified>2011-02-12T18:54:56.7318386-05:00</dateModified>   
        <Numbers>
            <Number>28</Number> 
            <Number>78</Number> 
        </Numbers>
    </video>
    <video>
        <id>00000000-0000-0000-0000-000000000000</id> 
        <title>Video Title</title> 
        <videourl>http://sample.com</videourl> 
        <thumbnail>http://sample.com</thumbnail> 
        <dateCreated>2011-01-12T18:54:56.7318386-05:00</dateCreated> 
        <dateModified>2011-02-12T18:54:56.7318386-05:00</dateModified>   
        <Numbers>
            <Number>28</Number> 
            <Number>78</Number> 
        </Numbers>
    </video>
</videos>

© Stack Overflow or respective owner

Related posts about linq-to-xml