This article supporting source code
Through an article (DOM4J)--using dom4j to read data source configuration from XML, so that we have some preliminary understanding and understanding of dom4j, but also mastered the basic operating methods, this article will undertake the previous article, for reference to the OpenFire Project menu design Advantages, Combine our own needs with a small example to illustrate how to use dom4j to implement this functionality.
Can be downloaded here in http://www.igniterealtime.org/downloads/index.jsp to OpenFire's release and source version, OpenFire's introduction is not described here, there are many online related information, Interested friends can download the source code research, in fact, do not understand OpenFire also does not matter, because we just learn from some of these ideas, and so finished the example, there will be a more intuitive understanding.
Elephants recommend that you download the source code and the necessary jar packages at the end, let the program run to see the effect, and then look at the detailed instructions below.
Development environment: Eclipse 3.2.1 MyEclipse 5.10GA Tomcat 6.10
Dom4j-1.6.1.jar Jaxen-1.1-beta-7.jar Sitemesh-2.2.1.jar
1. Create Tag-console.xml
In the SRC directory to build a tag-console.xml file, this configuration file is written in the menu information, which reads as follows:
<?xml version= "1.0" encoding= "GBK"?>
<bookstore>
<global>
<appname> Menu Navigation demo</appname>
<version>ver 1.0</version>
<creator> Pineapple Elephant </creator>
</global>
<catalog id= "Catalog-program" name= "Programming Development" Url= "index.jsp" description= "Programming Development" >
<item id= "Item-program-java" name= "Java Development" url= "index.jsp" description= "Java Development" >
<book id= "695043" Name= "Struts2 in-depth detailed" Url= "index.jsp" description= "in-depth detailed" Struts2
<book id= "691254" name= "Ant Integration Development" url= "book_ant.jsp" description= "Ant integration development"/>
<book id= "693668" Name= "Java Programming idea" Url= "book_java.jsp" description= "Java Programming idea"/>
</item>
<item id= "item-program-database" name= "Database Development" url= "book_oracle9.jsp" description= "Database Development" >
<book id= "691245" name= "Oracle 9i Database Treasure" url= "book_oracle9.jsp" description= "Oracle 9i database Treasure"/>
<book id= "693254" name= "SQL Server 2005 application Development" Url= "book_sqlserver.jsp" description= "SQL Server 2005 application development"/>
<book id= "690215" name= "Oracle 10g Advanced Development" url= "book_oracle10.jsp" description= "Oracle 10g Advanced Development"/>
</item>
</catalog>
<catalog id= "Catalog-system" name= "System related" url= "book_vista.jsp" description= "System related" >
<item id= "item-system-windows" name= "Windows System" url= "book_vista.jsp" description= "Windows System" >
<book id= "691258" name= "Getting Started with Windows Vista" Url= "book_vista.jsp" description= "Getting Started with Windows Vista"/>
<book id= "695489" name= "Windows Registry Combat" Url= "book_windows.jsp" description= "Windows Registry Combat"/>
</item>
<item id= "Item-system-linux" name= "Linux system" url= "book_linux9.jsp" description= "Linux system" >
<book id= "696598" Name= "Linux 9.0 detailed" Url= "book_linux9.jsp" description= "Linux 9.0 detailed"/>
<book id= "694585" Name= "Linux Treasure" url= "book_linux.jsp" description= "Linux Treasure"/>
</item>
</catalog>
</bookstore>
Above the XML inside of the things I was casually written, we must not be serious, I use books to cook a single is convenient for everyone to understand, the other is to simplify the program, in fact, OpenFire server is a background management system, it is based on XMPP (Extensible Message Processing Field protocol) developed, XMPP throughout the system design, if you want to use its console frame, but do not want to use XMPP, please start from the Web portal, combined with the page to carefully analyze the code, the need to extract the part of the line, others do not have to pipe. The elephant has not studied xmpp, only has extracted the console frame, to OpenFire source code also did not have the thorough research, the main or E Wen is too rotten. ^_^
OpenFire has not adopted the current very popular technology architecture (SSH), only the use of Jsp+javabean, but it has its own system design, even the log is made by themselves, not using our familiar log4j, really is too admire bird ~ ~ ~ ~