TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Joao Scoob
NA
18
3k
XElement Displaying Child Node of parent if parent Empty
Nov 25 2018 5:16 AM
Hello guys is there any way that i can force in the final output to Display the Empty ChildNodes of the parent Node. The thing is since all the Child nodes of the parent node are Empty i am getting this output (this is just a segment of my XML):
<fpc::Header>
<fpc:Data>?fpc:Data>
and i want to be displayed like this through all the nodes where this happens:
<fpc:Header>
<fpc:Data>
<fpc:Id>?fpc:Id>
<fpc:Access>?</fpc:Access>
<fpc:Password>?</fpc:Password>
>
and this is the code:
foreach (XElement child in body.DescendantNodes().OfType().ToList())
{
child.Name = nsCsdb.GetName(child.Name.LocalName);
if (String.IsNullOrWhiteSpace(child.Value) || child.IsEmpty)
child.ReplaceWith(new XElement(child.Name, "?"));
}
so how can i enforce this to generate my soap Envelope as desired?
PS: ahh i am replacing self-closing tags to the normal start and end tag that's why the creation of the new XElement
Reply
Answers (
1
)
how to get data from database between two dates in c# mvc
export excel data and edit it, save it again as a file