0

I have a node <name></name> where I put name. Now I want to put an array of names there.

1
  • 1
    How would you like to put array of names? Comma separated or you mean <names><name></name></names> structure? Commented May 31, 2010 at 12:54

2 Answers 2

2

If you must put ARRAY to this object you can use some syntax like:

<name>
 <element>X</element>
 <element>Y</element>
</name>

or use a some serialization to string and pack to it.

<name>X,Y</name>
Sign up to request clarification or add additional context in comments.

Comments

0
XmlNode node = xdoc.SelectSingleNode(path);            

foreach(string x in val)
{
    XmlNode subNode = xdoc.CreateNode(XmlNodeType.Element, subNodeName, null);
    subNode.InnerText = x;
    node.AppendChild(subNode);
}

path is the path to the node in xml

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.