Force XML end tag to be on same line with start tag when InnerText is null [modified]
-
Hello, I'm using C# 2008 to create XML files where some elements have null text values, as shown in the following code. nodeUnderTest.InnerText = ""; The problem is that the end tag is being placed on the following line, as shown below where nodeUnderTest is :
Using C#, how can I force the start and end XML tags to either appear on the same line or merged as shown below? Thanks, Grant modified on Monday, April 20, 2009 4:01 PM
modified on Monday, April 20, 2009 4:03 PM
-
Hello, I'm using C# 2008 to create XML files where some elements have null text values, as shown in the following code. nodeUnderTest.InnerText = ""; The problem is that the end tag is being placed on the following line, as shown below where nodeUnderTest is :
Using C#, how can I force the start and end XML tags to either appear on the same line or merged as shown below? Thanks, Grant modified on Monday, April 20, 2009 4:01 PM
modified on Monday, April 20, 2009 4:03 PM
Don't set the
nodeUnderTest.InnerText
at all. Just create the element. Also,nodeUnderTest.InnerText="";
is being set to an empty string and not a null value."We make a living by what we get, we make a life by what we give." --Winston Churchill
-
Don't set the
nodeUnderTest.InnerText
at all. Just create the element. Also,nodeUnderTest.InnerText="";
is being set to an empty string and not a null value."We make a living by what we get, we make a life by what we give." --Winston Churchill
When I set nodeUnderTest.InnerText = null, the start and end tags were once again placed on separate lines. When I commented out the nodeUnderTest.InnerText line, it placed the tags on the same line, but they were separated by a single space. I still need to determine how to either force the tags to be appear on the same line with no space in between or as the shortened version where the start and end tags are inclusive. Thanks.
-
When I set nodeUnderTest.InnerText = null, the start and end tags were once again placed on separate lines. When I commented out the nodeUnderTest.InnerText line, it placed the tags on the same line, but they were separated by a single space. I still need to determine how to either force the tags to be appear on the same line with no space in between or as the shortened version where the start and end tags are inclusive. Thanks.
Post some code to show what you are doing.
"We make a living by what we get, we make a life by what we give." --Winston Churchill