R
Rolf Welskes
Hello,
here a simple xml,
<?xml version="1.0" encoding="utf-8" ?>
<a>
this
is
a
little
text
</a>
here a simple program (wpf, but could also be winforms):
<Window x:Class="TestXmlText.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300">
<Grid Background="LightGray">
<TextBox Margin="40,38,47,111" Name="tx" AcceptsReturn="True" />
</Grid>
</Window>
using System;
using System.Xml;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace TestXmlText
{
/// <summary>
/// Interaction logic for Window1.xaml
/// </summary>
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
XmlDocument xdoc = new XmlDocument();
xdoc.Load("..\\..\\TestXml.xml");
XmlNode node = xdoc.ChildNodes[0].NextSibling;
tx.Text = node.InnerText;
}
}
}
So here you see: tx.Text = node.InnerText
This text look like this
this
is
a
little
text.
I want to get:
this is a little text.
No CR, LF, not unnecceary spaces, simle the text entered. (similar as it is
in html)
I cannot find any method or helper class to get the text clean from CRLF,
and the spaces.
Thank you for any help.
Rolf Welskes
here a simple xml,
<?xml version="1.0" encoding="utf-8" ?>
<a>
this
is
a
little
text
</a>
here a simple program (wpf, but could also be winforms):
<Window x:Class="TestXmlText.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300">
<Grid Background="LightGray">
<TextBox Margin="40,38,47,111" Name="tx" AcceptsReturn="True" />
</Grid>
</Window>
using System;
using System.Xml;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace TestXmlText
{
/// <summary>
/// Interaction logic for Window1.xaml
/// </summary>
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
XmlDocument xdoc = new XmlDocument();
xdoc.Load("..\\..\\TestXml.xml");
XmlNode node = xdoc.ChildNodes[0].NextSibling;
tx.Text = node.InnerText;
}
}
}
So here you see: tx.Text = node.InnerText
This text look like this
this
is
a
little
text.
I want to get:
this is a little text.
No CR, LF, not unnecceary spaces, simle the text entered. (similar as it is
in html)
I cannot find any method or helper class to get the text clean from CRLF,
and the spaces.
Thank you for any help.
Rolf Welskes