This article describes the an and XML conversion tool classes in detail, which has some reference value. let's take a look at the jar packages using XStream.
X-stream.github.io/index.html
For the jar package, see the attachment.
XStream is a simple library to serialize objects to XML and back again.
Entity class
public class Person { private String firstname; p
Here is an example of customer information conversion ?? "Basic customer information ". We place the data in the microsoft SQL SERVER 2000 database, and then use JSP and JDOM Technology to dynamically generate XML instance documents.
We created a data table CUSTOM in the Microsoft SQL Server database CUSTOM in advance. Its data structure is shown in the following table:
Whether
Marshaller and unmarshaller can be used to implement conversion between Java object and XML.
First, create a simple boy object.
[Java]
View plaincopyprint?
@ Xmlrootelement (name = "root ")
@ Xmlaccessortype (xmlaccesstype. Property)
Public class boy {
Private string name = "AA ";
Public String getname (){
Return name;
}
Public void setname (string name ){
This. Name = Name;
}
}
@XmlR
;Artifactid>Jackson-mapper-aslArtifactid>version>1.9.13version>Dependency>This dependency is based on the JSON serialization dependency, respectively.Ok. We add a method to the controller:@RequestMapping ("/Xmlorjson") @ResponseBody public map Xmlorjson () {Map New hashmap(); Map.put ("List", Employeeservice.list ()); return map;}Direct Access Address:We see that in just a few lines of configuration. After using @responsebody annotations, the object returned by the controller is automatically c
The first two sections are about socket server, client building and packet encapsulation. Let's talk about the conversion between Java objects and XML format files today.In the previous section we listed a message format, which we can actually understand as a string. But we can't write strings every time, so it's going to be crazy. Since it is object-oriented programming, there is certainly a good way to so
Recently made an RSS online aggregator, most of the RSS 2.0 encoded XML encoding. NET compiler can read correctly, but some such as GBK code, our. NET can not read, if the encoding of that XML manually changed to "gb2312" or other encoding, is not read. However, the code changes do not change, ie can be viewed correctly. What to do next, it really baffled me. How about changing the code? The RSS 2.0 file th
Well known in. NET, the key generated by the RSA class is in XML format, while other languages such as Java generally use the PKCS8 format key, JavaScript generally uses the PKCS1 format. We in the development process is likely to encounter the need to interface with other languages developed API, if we encounter RSA encryption and decryption, we must ensure that key is the same, in order to ensure the correct processing of data, we definitely need to
Example of how php implements xml Conversion array and phpxml Array
The example in this article describes how php converts arrays into xml. We will share this with you for your reference. The details are as follows:
The running result is as follows:
Array (1) {["GeocoderSearchResponse"] => array (2) {[0] => array (2) {["status"] => string (2) "OK" ["result"] =>
First, when Java read the XML configuration file, always through the dom4j third-party library actively resolved, recently discovered that the JDK class library can be converted to Pojo XML.Ii. Writing XML conversion tool class XmlutilsPackage Com.moy.demo.common.utils;import Javax.xml.bind.jaxbcontext;import javax.xml.bind.unmarshaller;import Java.io.inputstream
PHP in the background server, often encounter this situation, need to parse the XML file from the front desk, and the data returned in XML format, in this case, XML and PHP associative array conversion is very frequent things. For example, flex and other client programs interact with the server, often using this approa
About JAXB:1.JAXB is able to use Jackson's support implementation for JAXB annotations (jackson-module-jaxb-annotations), which facilitates the generation of XML and facilitates the generation of JSON, which can better flag Java classes that can be converted to JSON objects. JAXB allows Java people to map Java classes to XML representations, common annotations include: @XmlRootElement, @XmlElement, and so o
You may encounter a situation in which a file is converted to another format in your daily work, and in this article you will learn how to use the control free Spire.xls for. NET (Community Edition) to convert Excel documents to PDF, IMAGE, HTML, TXT, XML, XPS, CSV, ODS, SVG, EMF, xlsm and other formats for your reference.Tool Use:After installation, reference Spire.XLS.dll in the project (the DLL can be obtained in the Bin folder under the installati
Conversion Between XML and List
Using System;
Using System. Collections. Generic;
Using System. Linq;
Using System. Text;
Using System. Xml;
Namespace XmlHelper{/// /// Convert objects to Xml and Xml to object classes/// /// Public class XmlHelper {# Convert region object c
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.