Click here to Skip to main content
15,884,987 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# datetime compared to sql server datetime Pin
Matt T Heffron27-Feb-13 10:07
professionalMatt T Heffron27-Feb-13 10:07 
GeneralRe: C# datetime compared to sql server datetime Pin
PIEBALDconsult27-Feb-13 3:31
mvePIEBALDconsult27-Feb-13 3:31 
SuggestionRe: C# datetime compared to sql server datetime Pin
Matt T Heffron27-Feb-13 9:58
professionalMatt T Heffron27-Feb-13 9:58 
AnswerRe: C# datetime compared to sql server datetime Pin
jschell28-Feb-13 10:08
jschell28-Feb-13 10:08 
QuestionList view Question Pin
Member 979920426-Feb-13 14:57
Member 979920426-Feb-13 14:57 
AnswerRe: List view Question Pin
Richard MacCutchan26-Feb-13 22:31
mveRichard MacCutchan26-Feb-13 22:31 
AnswerRe: List view Question Pin
Amir Mohammad Nasrollahi29-Jul-13 21:29
professionalAmir Mohammad Nasrollahi29-Jul-13 21:29 
QuestionHow do I populate child elements in XML? Pin
Magela26-Feb-13 12:56
Magela26-Feb-13 12:56 
XML
Hi,

I have an xml (Foo.xml)template which is defined as follows:


    <Parent:Request xmlns:user="http://xxx.com/">
    <Parent:ElemA></Parent:ElemA>
    <Parent:ChildNode>
        <ElemB></ElemB>
        <ElemC></ElemC>
    </Parent:ChildNode>
    <Parent:ParentName></Parent:ParentName>
    </Parent:Request>


In my code, I am able to set the parent elements in the xmltemplate as follows:

    public void FooA( MyDomainObject DoM)
    {
    private readonly XNamespace myNS = "http://ANameSpace.com/";
    XElement fooRequestDoc = XElement.Load("Templates/Foo.xml");

    XElement ElemA_El = fooRequestDoc.Descendants(myNS + "ElemA").FirstOrDefault();
    ElemA_El.SetValue(DoM.ElemA);
    }

In this case, if ElemA has a value of "ElementA", then the ElemA_El parameter would be set to this value.

My question is, how do I set a specific Child Note elements such as ElemB or ElemC?

I've tried using "Element" (since I understand it's used to retreive child elements) as follows:

    XElement ElemB_El = fooRequestDoc.Element(myNS + "ChildNode");

But it's returning the entire block rather than just ElemB which I seek.
Any help is greatly appreciated!

AnswerRe: How do I populate child elements in XML? Pin
Mangal Deep Gupta26-Feb-13 23:24
Mangal Deep Gupta26-Feb-13 23:24 
GeneralRe: How do I populate child elements in XML? Pin
Magela27-Feb-13 4:26
Magela27-Feb-13 4:26 
AnswerRe: How do I populate child elements in XML? Pin
Jegan Thiyagesan27-Feb-13 4:31
Jegan Thiyagesan27-Feb-13 4:31 
GeneralRe: How do I populate child elements in XML? Pin
Magela27-Feb-13 4:38
Magela27-Feb-13 4:38 
QuestionOffice Development problems Pin
Daytona67526-Feb-13 11:32
Daytona67526-Feb-13 11:32 
AnswerRe: Office Development problems Pin
Matt T Heffron26-Feb-13 11:58
professionalMatt T Heffron26-Feb-13 11:58 
AnswerRe: Office Development problems Pin
Jegan Thiyagesan27-Feb-13 5:04
Jegan Thiyagesan27-Feb-13 5:04 
GeneralRe: Office Development problems Pin
Matt T Heffron27-Feb-13 9:32
professionalMatt T Heffron27-Feb-13 9:32 
GeneralRe: Office Development problems Pin
Jegan Thiyagesan27-Feb-13 11:57
Jegan Thiyagesan27-Feb-13 11:57 
QuestionTab Delimited file to sql database Pin
gavindon26-Feb-13 10:03
gavindon26-Feb-13 10:03 
AnswerRe: Tab Delimited file to sql database Pin
Matt T Heffron26-Feb-13 10:27
professionalMatt T Heffron26-Feb-13 10:27 
GeneralRe: Tab Delimited file to sql database Pin
gavindon26-Feb-13 11:25
gavindon26-Feb-13 11:25 
QuestionListbox colours. Pin
Septimus Hedgehog26-Feb-13 7:35
Septimus Hedgehog26-Feb-13 7:35 
AnswerRe: Listbox colours. Pin
Alan N26-Feb-13 8:40
Alan N26-Feb-13 8:40 
AnswerRe: Listbox colours. Pin
Dave Kreskowiak26-Feb-13 9:05
mveDave Kreskowiak26-Feb-13 9:05 
GeneralRe: Listbox colours. Pin
Septimus Hedgehog26-Feb-13 22:59
Septimus Hedgehog26-Feb-13 22:59 
GeneralRe: Listbox colours. Pin
Dave Kreskowiak27-Feb-13 1:01
mveDave Kreskowiak27-Feb-13 1:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.