An XML Validator
To help you check the syntax of your XML files, we have created an XML validator to syntax-check your XML.
Valid XML Documents
A valid XML document is not the same as a well formed XML document.
The first rule, for a valid XML document, is that it must be well formed (see previous paragraph).
The second rule is that a valid XML document must conform to a document type.
Rules that defines legal elements and attributes for XML documents are often called document definitions, or document schemas.
When to Use a Document Definition?
A document definition is the easiest way to provide a reference to the legal elements and attributes of a document.
A document definition also provides a common reference that many users (developers) can share.
A document definition provides a standardization that makes life easier.
When NOT to Use a Document Definition?
XML does not require a document definition.
When you are experimenting with XML, or when you are working with small XML files, creating document definitions may be a waste of time.
If you develop applications, wait until the specification is stable before you add a document definition. Otherwise, your software might stop working because of validation errors.
There are different types of document definitions that can be used with XML:
- The original Document Type Definition (DTD)
- The newer, and XML based, XML Schema
Usually elements are used to capture the data however attributes can be to capture the metadata (data about data – something that provides additional information about the data) ie the data which might not be used to display but can be used for search or other such features.There is no rule as such that says something should be an attribute or a element. I recommend to avoid it
Some of the problems with using attributes are:
- attributes cannot contain multiple values (elements can)
- attributes cannot contain tree structures (elements can)
- attributes are not easily expandable (for future changes)
Attributes are difficult to read and maintain. Use elements for data. Use attributes for information that is not relevant to the data.
The following three XML documents contain exactly the same information:
A date attribute is used in the first example:
<body>Don’t forget me this weekend!</body>
A date element is used in the second example:
<body>Don’t forget me this weekend!</body>
An expanded date element is used in the third: Preferred :
<body>Don’t forget me this weekend!</body>
Metadata is data that describes other data. Meta is a prefix that in most information technology usages means “an underlying definition or description.”
Metadata summarizes basic information about data, which can make finding and working with particular instances of data easier. For example, author, date created and date modified and file size are examples of very basic document metadata. Having the abilty to filter through that metadata makes it much easier for someone to locate a specific document.
In addition to document files, metadata is used for images, videos, spreadsheets and web pages. The use of metadata on web pages can be very important. Metadata for web pages contain descriptions of the page’s contents, as well as keywords linked to the content. These are usually expressed in the form of metatags. The metadata containing the web page’s description and summary is often displayed in search results by search engines, making its accuracy and details very important since it can determine whether a user decides to visit the site or not. Metatags are often evaluated by search engines to help decide a web page’s relevance, and were used as the key factor in determining position in a search until the late 1990s.
Metadata can be created manually, or by automated information processing. Manual creation tends to be more accurate, allowing the user to input any information they feel is relevant or needed to help describe the file. Automated metadata creation can be much more elementary, usually only displaying information such as file size, file extension, when the file was created and who created the file.
All code can be classified into two distinct roles; code that does work (algorithms) and code that coordinates work (coordinators).
The real complexity that gets introduced into a code bases is usually directly related to the creation of classes that group together both of these roles under one roof.
Computer electronics have two roles: doing work and binding together the stuff that does the work. If you take out the CPU, the memory and all the other components that actually do some sort of work, you’ll be left with coordinators. Wires and busses that bind together the components in the system.
So now that we understand that code could potentially be divided into two broad categories, the next question of course is why? And can we even do it?
Let’s address why first.
The biggest benefit to pulling algorithmic code into separate classes from any coordinating code is that it allows the algorithmic code to be free of dependencies. (Practically all dependencies.)
Once you free this algorithmic code of dependencies you’ll find 3 things immediately happen to that code:
- It becomes easier to unit test
- It becomes more reusable
- Its complexity is reduced
Debugging application is always a common topic for all developers and it may cover more than 60%+ of total development time if using traditional way like using debugging message.
After the release of Sun Java Development Kit 1.4.2, you can be benefited by the magic tool called JDWP (Java Debugging Wire Protocol), It provides sophisticated implementation for debugging your JAVA application in a modern way, especially when you want to debug server java application like Tomcat, JBoss, etc..
Okay, you may say you are happy using debug message for debugging remote application and thus let me list the summary of how JDWP can aid the development.
- Thread stepping execution: Suspend/Resume particular thread
- Breakpoints management: Insert/Remove breakpoint for investigate failure point
- Hotswap Bug Fixing: Recompile the classes on-the-fly for bug fixing without redeployment
I thought you may be interested with the features 3, which greatly reduces the re-deployment time for debugging an application.
This articles will focus how the setup for debugging remote java application. Tomcat5.5 and Eclipse Europa will be used for an example.
1. High Level View
Basically it is divided into two entities: Debuggee and Debugger. The Debuggee is the application that you want to debug and for our example it is Tomcat. The Debugger is the vendor of JDI (Java Debugging Interface) : Eclipse.
2. Enable JDWP in the Debuggee (Tomcat)
JDWP can be enabled out of the box by setting the appropriate system properties :
This enables JVM with JDWP at port 9002 using server mode with any suspension.
- (“n” or “y”) If “y,” listen for a debugger application to attach; otherwise, attach to the debugger application at the specified address.
- transport address for the connection. If server=n, attempt to attach to a debugger application at this address. If server=y, listen for a connection at this address.
- If server=y, this specifies the timeout, in milliseconds, to wait for the debugger to attach. If server=n, this specifies the timeout, in milliseconds, to use when attaching to the debugger.
- If “y,” JVM suspends the execution until a debugger connects to the debuggee JVM. Preferably set this option to “n” else the application will not start unless the debugger attaches the port on which debugee application is lessoning.
Some times you have to debug a application which is not running from it’s source code in a IDE. So to do it we use this remote debug concept. In the scenario which is shown above the application runs in a remote machine, but when it runs it will broadcast debug information via a socket deployed. The IDE running locally will capture those broadcast debug information through that socket and it will do the debug through the source code.
JAVA language provides this in its JVM. We can use commands like this to run a application in the remote debug mode in java.
java -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,suspend=n,server=y -jar Name_of_Your_Jar.jar
Then it will broadcast some debug information and will wait until some IDE capture those debug information and start debugging the source code. When Some IDE connects to the Socket specified it will start the debugging process.
Configuring the IDEs will depend on them. The links given below will give you a good understanding about those concepts. Hope you learn some thing from this post. Following links are really interesting to learn about remote debugging.
- Application to be debugged would attach a socket to itself and then would listen debug instructions on that socket.
- Debugger would bind itself to that socket and then send instructions on that socket.
What is Remote Debugging :
Remote Debugging with Eclipse :
Remote Debugging with IntelliJ IDEA :
Remote Debugging Web Services, Apache Axis 2 :
WAR stands for Web application ARchive. A Web application is a group of HTML pages, JSP pages, servlets, resources and source file, which can be managed as a single unit. A Web archive (WAR) file is a packaged(zipped/compressed) Web application. WAR files can be used to import a Web application into a Web server.
Here’s how to compress a ‘myWebApp’ web application into a “Web Archive” file named myWebApp.war so that you can easily transport it to another server.
* Open a command prompt and cd to
* Use the java archive command ‘jar’ to bundle up your application
jar -cvf myWebApp.war *
or go to one level before your web application folder the folder you want to package as Web Archieve
you file is somewhere like d:\webapps\myWebApp
d:\webapps:>jar -cvf myWebApp.war myWebApp
In English, “compress everything in this directory into a file named myWebApp.war”
(c=create, v=verbose, f=file)
Now you can copy myWebApp.war to any the webapps directory on a new Tomcat Server. When you save the file to a new server BE SURE not to save it as a ZIP file, choose “all files”. If Tomcat is running on the new server the war file will be automatically installed as soon as you save it. If not, start up Tomcat on the new server to install the application after you have saved it. Do NOT attempt to unzip the war file or do any installation yourself. Tomcat will do everything for you!
When the server is restarted it will automatically uncompress the files and recreate a web application named ‘myWebApp’.