I wrote a web tool in Java EE, performing the following subtasks:
When writing to the file, I was using Writer. The solution is switching to OutputStream.
From JDOM reference, org.jdom2.output.XMLOutputter, output(Document doc, java.io.Writer out):
Warning: using your own Writer may cause the outputter's preferred character encoding to be ignored. If you use encodings other than UTF-8, we recommend using the method that takes an OutputStream instead.
Notepad++ is a free source code editor and Notepad replacement that supports several formats. In its basic edition it can already do some nice things like:
If you download the XML Tools Plugin you can also pretty print XML documents without witespaces. Just select it from the plugins menu or use the keyboard shortcut "Ctrl"+"Alt"+"Shift"+"B". Check out also the other features provided with the plugin.
1. We have to define the repeated tables that have to be join
2. We have to define the fields in the repeated table
3. We have to define help fields (here is the text of the join of the repeated tabele)
This method will join two differnt repeated table in two different text fields. to understand the method how it works.
public void zusammenfassung_wtabs_anfang()
{
try
{
XPathNodeIterator itemnodes;
string[] wtabs = {
"/my:XPath_to_repeated_tabel_1",
"/my:XPath_to_repeated_tabel_2",
};
string[] fields = {
"my:field_1_of_repeated_table_1~my:fiedl_2_of_repeated_1",
"my:field_1_of_repeated_table_2~my:fiedl_2_of_repeated_2",
};
string[] zielfelder = {
"/XPath_to_help_field_repeated_table_1/my:help_1",
"/XPath_to_help_field_repeated_table_2/my:help_2"
};
string[] satzende = {
".",
"."
};
for (int i = 0; i < wtabs.Length; i++)
{
string endtext = "";
itemnodes = this.MainDataSource.CreateNavigator().Select(wtabs[i], NamespaceManager);
foreach (XPathNavigator itemNode in itemnodes)
{
for (int j = 0; j < fields[i].Split('~').Length; j++)
{
endtext += itemNode.SelectSingleNode(fields[i].Split('~')[j], NamespaceManager).Value + " ";
}
endtext = endtext.Substring(0, endtext.Length - 1);
endtext += ", ";
}
try
{
endtext = endtext.Substring(0, endtext.Length - 2);
}
catch (Exception ex)
{ }
if (endtext.Trim().Length < 2)
endtext = "";
else
endtext = endtext + satzende[i].ToString();
this.MainDataSource.CreateNavigator().SelectSingleNode(zielfelder[i], this.NamespaceManager).SetValue(endtext);
endtext = "";
}
}
catch (Exception ex)
{
MessageBox.Show("Test" + ex.Message);
}
}