开发者

how to design correct XML and retrieve values on the basis of request name?

I want to create singleton class that read request name values from the XML configuration file only one time and store values into an memory, but i am confused how to design my XML configuration file which full fill my requirement.

my designed XML file:

       <?xml version="1.0"?>
       <config>
               <Request name="validateEmailRequest">
                   <req开发者_开发知识库uestqueue>emailrequest</requestqueue>
                   <responsequeue>emailresponse</responsequeue>
               </Request>

             <Request name="cleanEmail">
                   <requestqueue>cleanrequest</requestqueue>
                   <responsequeue>cleanresponse</responsequeue>
             </Request>

       </config>

please help me to design an XML and also how to store and retrieve respected values.

Thanks


For configuring Java applications, it is really recommended to use the build-in Properties functionality. Properties are (singleton) key/value-pairs. They are however stored in a plain-text format rather than XML. More information can be found here: http://download.oracle.com/javase/tutorial/essential/environment/properties.html

In order to structure the properties, the naming convention is to use dotted names. Your properties-file, could thus look like this:

validateEmailRequest.requestQueue = emailrequest
validateEmailRequest.responsQueue = emailresponse
cleanEmail.requestQueue = cleanrequest
cleanEmail.responseQueue = cleanresponse

The above link also provides information about reading and writing the properties.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜