XML

I wrote a web tool in Java EE, performing the following subtasks:

  • Reverse engineer the project file (zip-File with an XML describing the project and folders containing the device drivers)
  • Reverse engineer the XML file representing the entire project (i.e. house)
  • Reverse engineer the XML structure representing programs the installers wrote for old and new proxy versions
  • Create models for old and new proxies
  • Create a mapping between these models
  • Provide an online tool where installers can upload a project which is then migrated to the new versions:
    • replace the old drivers with new ones
    • configure them accordingly
    • automatically re-implement programs using the new interfaces
    • clean up invalid parts of the project file
    • be as fault-tolerant as possible: migrate as many drivers/devices as possible; inform the installer about parts that failed to migrate
  • Iterative process: based on failed migrations, learn more about the internal workings of the project file and improve the migration tool accordingly

Technology:

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.

Technology:

Wrong character encoding in XML file

After my Java code finished editing an XML file using JDOM2, the resulting project.xml has an incorrect encoding. Special characters (like italian "è") are not represented correctly, resulting in an unreadable character. XML Explorer (and sometimes even WinMerge) refuses to open the file.

The configuration is done in the file "server.xml" (it is in the installed server's config directory, which you can find under "Servers" in your project explorer in Eclipse), in the element "Resource" (under element "GlobalNamingResources").

Technology:

Increase website visibility in search engines

I want to increase my website visibility in google search engine, so that users finds my websites faster and correct keywords they use in google search guides to my pages. My pages are also rapidly changing because of new information. So I want google search to be up to date what is on my websites.

XML without whitespaces not human readable

To save storage and network bandwidth, XML documents are sometimes provided without whitespaces. This makes it hard for an average user to read and understand the content of the document. A tool to add this whitespaces again and pretty print the document would be helpful. Also it would be nice to be able to collapse certain hierarchy levels, to focus on the areas you want to read.

Taggings:

Use Notepad++ to view and edit XML documents

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:

  • collapse structured texts like XML on a certain hierarchy level with the key combination "Alt"+X, where X is a number between 1 and 8. Uncollapse with "Shift"+"Alt"+X.
  • Extended search and replace with e.g. line breaks or search and replace using regular expressions.
  • Vertical selection and simultaneous editing of text holding down the "Alt" key.
  • and many more...
  • 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.

    Taggings:

    How to join entries of a repeated table in one text field in InfoPath

    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);
    }
    }

    Taggings:

    How to reset font size formatting in XML/InfoPath file with c#

    Currently i am developing an medical software. Therefor i use InfoPath form template with code behind c# and MS SQL or Infomix databse was a very comfortable solution. As the complexety of the system grows i had to broaden my horizon and find some tricky solutions to achieve the surreal requirements of the client. If users change the standard size formation of an richtext field and you wish to reset the font size back to the standard formatation this method will help you. People always want everyhing flexibel, fast and automatically,... properties which are very hard to reach within a software. So someday i encountered a very hard problem which took me a long time to solve it (although, afterwards it wasn't so difficult). If someone has programmed a little bit with c# before and knows about XML formating, its not that hard to rest the font size of richtext fields. So a solution had to be found. After hours of internet surfing and testing many methods i found the best way to solve this problem.

    Display a local public transport route by using the Wiener Linien API

    The core problem of this challenge is the proper formulation (encoding) of the request and the correct interpretation (decoding) of the server-response. Another problem is the sending and the receiving of the XML-files with a server-side scripting language such as PHP.

    Pages

    Subscribe to XML