Use the ultraedit32 editor to format source code: XML, Java, C/C ++, and C #

Source: Internet
Author: User
Tags xml parser ultraedit


Http://blog.163.com/chou_ke/blog/static/103413720077136349866/

The UE editor has always been a good helper for programming and editing texts. The most profound feature of its image is the column mode editing function, which brings a lot of convenience to my work, however, being a programming tool without formatting the source code seems to make ue less beautiful, but this is not the case, two open-source command line tools provided by UE can well format the source code of several popular programming languages.
In ue, You Can format XML, Java, C/C ++, and C # source code files. This function is relatively hidden, so it may not be noticed by users. These source code formatting functions are implemented through two open-source command line tools:
Xmllint ---- open source XML file command line parser
Astyle ----- the open source code formatting command line tool. Currently, Supported languages include Java, C/C ++, and C #.
The following describes how to use these two tools to extend the UE editor to enable source code formatting and general configuration:
First, assume that the installation directory of the UE is "C: \ Program Files \ IDM computer solutions \ UltraEdit-32 \" (the UE path mentioned below should be modified according to the actual situation ).
 
The XML file is formatted as follows:
1. Open the XML file to be formatted, click format --> xmllint tool menu item, and select
2. "reformat and reindent the output, where indentaion is:" And click "parse". The formatted result will appear in the outpu window, to obtain formatted text, right-click the output window and choose Copy to clipboard from the shortcut menu to copy the text to the clipboard for processing by other programs;

If you need to format the current XML file opened by UE and output the result directly to the current file, you can:
1. Click the advanced --> tool configuration menu item, click the "insert" button in the pop-up dialog box, and enter the name of the command menu in the "menu item name" Column (for example: "format the XML file"), and then enter the following command in the "command line" column:
"C: \ progra ~ 1 \ idmcom ~ 1 \ UltraEdit-32 \ GNU \ xmllint.exe -- format -- output % F"
In the output tab, remove the "Capture output" option and click "OK" to complete the configuration.
2. Now, if you want to format the opened XML file, you only need to select the "format XML file" menu item under the "advanced" menu.

The methods for formatting source code files of Java, C/C ++, and C # are as follows:
1. The configuration is similar to the XML format configuration, except that the commands entered in the "command line" column in the "tool configuration" dialog box are different.
Use the following command line for Java source code:
"C: \ progra ~ 1 \ idmcom ~ 1 \ UltraEdit-32 \ GNU \ astyle.exe -- style = ANSI -- mode = Java % F"
Use the following command line for C/C ++ source code:
"C: \ progra ~ 1 \ idmcom ~ 1 \ UltraEdit-32 \ GNU \ astyle.exe -- style = ANSI -- mode = C % F"
C # use the following command line as the source code:
"C: \ progra ~ 1 \ idmcom ~ 1 \ UltraEdit-32 \ GNU \ astyle.exe -- style = ANSI -- mode = cs % F"
Remember to remove the "Capture output" option in the output tab, and click "OK" to complete the configuration.

 Note: the path of the file to be formatted cannot contain spaces or Chinese characters. I have not solved this problem yet.
2. Now, you only need to select the corresponding formatting menu item to format the opened file!

The above astyle configuration only uses the general options of this command line. In fact, this tool has many other formatting options, you can view its help documentation to learn about the usage of other option switches (UE does not include help documentation, need to log on to the http://astyle.sourceforge.net/download its source code compressed package, this package has ).
The XML file Formatting Function of xmllint is not its main function. It is actually an XML Parser (I haven't used any of the functions yet, so I can't say it, haha ...), for instructions on it, browse the http://xmlsoft.org/learn about it.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.