Friday, November 4, 2016

827 (5 of 10 series) XML TEXT EDITOR for adding, searching, deleting records in XML Files WITHOUT XML VALIDATION

How this XML Text Editor, made in Java 8 is different from the Text Editors given in previous blog posts? Ans: Though this is still a text editor, it has been made more XML friendly, when compared to the earlier posts. .java file SOURCE used for compiling is also given in full, in the text box below. This is in addition to the Zip file containing the Sample xml file- of a small medical xml -, the Main Class, and the sub classes, Readme Files, Screenshots. Read me is reproduced below, to have a clear idea:

README FOR : An XML TEXT Editor, notional record by record, with NO SAX PARSING, NO XML PARSING, NO XML VALIDATION.


This XML Text editor is yet a text editor, with many buttons added. It does not XMLparse, SAXparse, or XML validate. For maintaining simplicity, we have not added them.
Searches are case sensitive. That means while making search we have to keep in mind Capital Letter / small letter differences in the search word, and in the XML file.

Most XML files we get, usually do not have 'id No.' tag, which gives some individuality and uniqueness to the nodes. It is not possible to add idNos. to each record, manually, especially when Number of Records run into thousands. We have to write some Java code to add id Nos. to each node, programmatically and dynamically. I hope to do it shortly.


You can use this Java Class and the accompanying dictionary files only for your private purposes. You cannot put it to commercial use.


Use of this software is entirely at your risk and responsibility. No warranty or guarantee whatsoever, whatever be the purpose of its use. While we have tried our best to provide Users an error-free package, we cannot accept any liability/responsibility pecuniary or otherwise, whatsoever.


This Java class needs no installation. Just unzip. You will get your medicsmall.xml file, your java class, some screenshot jpgs of the windows you will get, and this readme file. All these things will be in YXPAJFR2 folder.


You need Java 8 to run this package. You can either install it on your system, or keep it on a USB Drive or some C: D: etc. folders or in case of linux /home/usr/xxx folder.


In case Java 8 is installed on your System, you can straightaway, go to the dos prompt/Commandline and type java yxpajf2.


At the dos prompt/linux commandline/or other mac equivalent, go to the folder where you have unzipped this package. Then type (path to your Java file yxpajf2.


Download this zip file Click here to download from my subdomain at free webhost site: I have uploaded the file there.
Unzip at any place of your choice.

Whether you are in windows / Linux / probably Mac. go to the Commandline / Dos prompt.

Then type Path to your java 8/bin/java yxpajfr2 & press enter.

If you already have an installed Java8/JRE : command will be: java yxpajfr2.

Then your XMLTEXTEDITOR window will open.

1) You can edit the medicsmall.xml file given to you as a sample. Or you can use any other xml file you have, in any folder. First copy that file into the yxpajfr2 folder. Purpose: The Java classes and the xml file to be edited are to be on the same folder.

2) In the recordno. box you can type a number from 1 to maximum number (It depends on the number of nodes in the xml file you are editing). Then press get. Default starts from 0. Result will appear in the top Result box. As bonus, an additional file ybmedicdicti.txt file, MEDICAL DICTIONARY is also being given, in the folder. You can change the file name in the .txt text box to ybmedicdicti.txt, and use the Medical Dictionary. It can also be modified. Words can be added, and deleted.

3) You can also use next, prev buttons.

4) If you want to correct a word or its meaning, you change the text in the Text Box. Then press Update button. The word and its meaning in the text file will get changed.

5a) If you press "Search Single button" a message box will ask you to for the search word. Type it , and press ok. You will get the FIRST RECORD which matches your search term. Part-words can also be searched. After you get the Search result, you can change it and press update. If you want to the next record, you can use next and prev. buttons.

5b) If you press "Search Multiple Records button", a message box will ask you to for the search word. Type it , and press ok. You will get all the records which contains your search word/phrase. These records you cannot modify/update. Reason: They are situated in different parts of the file, in hundreds/thousands of records.


6) If you want to add a new word, you have an add button. Here there is a problem. XML files have a root node at the begininng-top of the file, and at the end-bottom of the file. Different XML files have different root node names. When you press the add button, whatever is in the result box will be added as a new record. Thus there will be a root-node error.


First open your XML in any text editor such as note pad /gedit. Change the root node name from existing one (eg. or etc. and bottom or etc.), and change it to , respectively. And then start using this package for 'adding records'.

Then type the newrecord on the Result Area (Also called Clean Slate in our package. If it is not clean (blank), you can press the Clean Slate button at the bottom. Then The Result area will become clean. You type your new record(s) with the node names, elements names of your choice and press ADD button. At a time, even multiple records can be added in one go, after typing all those records.

7) If you have a delete button. If you press 'delete' button, without cautioning you, the current record in the result box will be deleted.

8) You can change the XML file, by typing some other XML file in the .txt box, and pressing 'get' button.



This window gives suggestions to you, and provides you some notes. Yet to do: To make it context-responsive.

You are welcome to send to: ybhask @
Following is the source code of the .java file. If readers wish to compile the source code themselves, they have to copy the .java text in the textbox below and paste into the .java file. The file is to be saved as For compiling the file , a command similar to the following: (path)/javac Then the file gets compiled into 1 main class and 10 sub classes with numbers 1 to 10. For opening window, command to be typed: (path)/java yxpajfr2 , then press enter.

To continue. सशेष. ఇంకా ఉంది.


  1. AvaHost is definitely the best web-hosting provider for any hosting services you need.


ఘోరమైన విమర్శలకు కూడ స్వాగతం, జవాబులు ఇవ్వబడతాయి. Harsh Criticism is also welcome.