Click here to Skip to main content
15,113,245 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# datetime compared to sql server datetime Pin
Matt T Heffron27-Feb-13 11:07
professionalMatt T Heffron27-Feb-13 11:07 
GeneralRe: C# datetime compared to sql server datetime Pin
PIEBALDconsult27-Feb-13 4:31
professionalPIEBALDconsult27-Feb-13 4:31 
SuggestionRe: C# datetime compared to sql server datetime Pin
Matt T Heffron27-Feb-13 10:58
professionalMatt T Heffron27-Feb-13 10:58 
AnswerRe: C# datetime compared to sql server datetime Pin
jschell28-Feb-13 11:08
Memberjschell28-Feb-13 11:08 
QuestionList view Question Pin
Member 979920426-Feb-13 15:57
MemberMember 979920426-Feb-13 15:57 
AnswerRe: List view Question Pin
Richard MacCutchan26-Feb-13 23:31
mveRichard MacCutchan26-Feb-13 23:31 
AnswerRe: List view Question Pin
Amir Mohammad Nasrollahi29-Jul-13 22:29
professionalAmir Mohammad Nasrollahi29-Jul-13 22:29 
QuestionHow do I populate child elements in XML? Pin
Magela26-Feb-13 13:56
MemberMagela26-Feb-13 13: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 Gupta27-Feb-13 0:24
MemberMangal Deep Gupta27-Feb-13 0:24 
GeneralRe: How do I populate child elements in XML? Pin
Magela27-Feb-13 5:26
MemberMagela27-Feb-13 5:26 
AnswerRe: How do I populate child elements in XML? Pin
Jegan Thiyagesan27-Feb-13 5:31
MemberJegan Thiyagesan27-Feb-13 5:31 
GeneralRe: How do I populate child elements in XML? Pin
Magela27-Feb-13 5:38
MemberMagela27-Feb-13 5:38 
QuestionOffice Development problems Pin
Daytona67526-Feb-13 12:32
MemberDaytona67526-Feb-13 12:32 
AnswerRe: Office Development problems Pin
Matt T Heffron26-Feb-13 12:58
professionalMatt T Heffron26-Feb-13 12:58 
AnswerRe: Office Development problems Pin
Jegan Thiyagesan27-Feb-13 6:04
MemberJegan Thiyagesan27-Feb-13 6:04 
GeneralRe: Office Development problems Pin
Matt T Heffron27-Feb-13 10:32
professionalMatt T Heffron27-Feb-13 10:32 
GeneralRe: Office Development problems Pin
Jegan Thiyagesan27-Feb-13 12:57
MemberJegan Thiyagesan27-Feb-13 12:57 
QuestionTab Delimited file to sql database Pin
gavindon26-Feb-13 11:03
Membergavindon26-Feb-13 11:03 
AnswerRe: Tab Delimited file to sql database Pin
Matt T Heffron26-Feb-13 11:27
professionalMatt T Heffron26-Feb-13 11:27 
GeneralRe: Tab Delimited file to sql database Pin
gavindon26-Feb-13 12:25
Membergavindon26-Feb-13 12:25 
QuestionListbox colours. Pin
Septimus Hedgehog26-Feb-13 8:35
MemberSeptimus Hedgehog26-Feb-13 8:35 
AnswerRe: Listbox colours. Pin
Alan N26-Feb-13 9:40
MemberAlan N26-Feb-13 9:40 
AnswerRe: Listbox colours. Pin
Dave Kreskowiak26-Feb-13 10:05
mveDave Kreskowiak26-Feb-13 10:05 
GeneralRe: Listbox colours. Pin
Septimus Hedgehog26-Feb-13 23:59
MemberSeptimus Hedgehog26-Feb-13 23:59 
GeneralRe: Listbox colours. Pin
Dave Kreskowiak27-Feb-13 2:01
mveDave Kreskowiak27-Feb-13 2: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.