Logo

Navigation
  • Home
  • Services
    • ERP Solutions
    • Implementation Solutions
    • Support and Maintenance Solutions
    • Custom Solutions
    • Upgrade Solutions
    • Training and Mentoring
    • Web Solutions
    • Production Support
    • Architecture Designing
    • Independent Validation and Testing Services
    • Infrastructure Management
  • Expertise
    • Microsoft Development Expertise
    • Mobile Development
    • SQL Server Database and BI
    • SAP BI, SAP Hana, SAP BO
    • Oracle and BI
    • Oracle RAC
  • Technical Training
    • Learn Data Management
      • Business Intelligence
      • Data Mining
      • Data Modeling
      • Data Warehousing
      • Disaster Recovery
    • Learn Concepts
      • Application Development
      • Client Server
      • Cloud Computing Tutorials
      • Cluster Computing
      • CRM Tutorial
      • EDI Tutorials
      • ERP Tutorials
      • NLP
      • OOPS
      • Concepts
      • SOA Tutorial
      • Supply Chain
      • Technology Trends
      • UML
      • Virtualization
      • Web 2.0
    • Learn Java
      • JavaScript Tutorial
      • JSP Tutorials
      • J2EE
    • Learn Microsoft
      • MSAS
      • ASP.NET
      • ASP.NET 2.0
      • C Sharp
      • MS Project Training
      • Silverlight
      • SQL Server 2005
      • VB.NET 2005
    • Learn Networking
      • Networking
      • Wireless
    • Learn Oracle
      • Oracle 10g
      • PL/SQL
      • Oracle 11g Tutorials
      • Oracle 9i
      • Oracle Apps
    • Learn Programming
      • Ajax Tutorial
      • C Language
      • C++ Tutorials
      • CSS Tutorial
      • CSS3 Tutorial
      • JavaScript Tutorial
      • jQuery Tutorial
      • MainFrame
      • PHP Tutorial
      • VBScript Tutorial
      • XML Tutorial
    • Learn Software Testing
      • Software Testing Types
      • SQA
      • Testing
  • Career Training
    • Career Improvement
      • Career Articles
      • Certification Articles
      • Conflict Management
      • Core Skills
      • Decision Making
      • Entrepreneurship
      • Goal Setting
      • Life Skills
      • Performance Development
      • Personal Excellence
      • Personality Development
      • Problem Solving
      • Relationship Management
      • Self Confidence
      • Self Supervision
      • Social Networking
      • Strategic Planning
      • Time Management
    • Education Help
      • Career Tracks
      • Essay Writing
      • Internship Tips
      • Online Education
      • Scholarships
      • Student Loans
    • Managerial Skills
      • Business Communication
      • Business Networking
      • Facilitator Skills
      • Managing Change
      • Marketing Management
      • Meeting Management
      • Process Management
      • Project Management
      • Project Management Life Cycle
      • Project Management Process
      • Project Risk Management
      • Relationship Management
      • Task Management
      • Team Building
      • Virtual Team Management
    • Essential Life Skills
      • Anger Management
      • Anxiety Management
      • Attitude Development
      • Coaching and Mentoring
      • Emotional Intelligence
      • Stress Management
      • Positive Thinking
    • Communication Skills
      • Conversation Skills
      • Cross Culture Competence
      • English Vocabulary
      • Listening Skills
      • Public Speaking Skills
      • Questioning Skills
    • Soft Skills
      • Assertive Skills
      • Influence Skills
      • Leadership Skills
      • Memory Skills
      • People Skills
      • Presentation Skills
    • Finding a Job
      • Etiquette Tips
      • Group Discussions
      • HR Interviews
      • Interview Notes
      • Job Search Tips
      • Resume Tips
      • Sample Resumes
 

What You Should Know About Java XML

By Exforsys | on July 25, 2006 |
J2EE

What You Should Know About Java XML

XML is a format that has become an important part of information technology. In addition to this, the combination of Java and XML have become very important for those who work with back end business components.

Combining Java with XML has allowed developers to save a large amount of time and energy in the creation of new programs. If this technology is used correctly it will make your applications more flexible and ready for change. Another thing that you will want to become familiar with is XStream.

Before I talk about how XStream can serialize Java elements, it is first important to understand how Java XML binding is separate from Java XML serialization. These technologies are similar in the fact that they can transfer XML objects into Java objects and vice versa. At the same time, Java XML binding shows a step that will create basic Java code from XML schemas. A large number of binding libraries are very efficient, and an example of this would be JAXB by Sun. Java XML serialization uses a runtime conversion that is dependent on the API to transfer a Java object into an XML object. Libraries like XStream will use powerful APIs to control how XML objects are produced to make sure they can be read.

Serialization is easier because there is no need to create the necessary source code. However, the disadvantage to serialization is that is that there will be no way to make sure the XML source will properly deserialize if it is not created within the same library. To use Java XML with XStream, you will need to have Java 1.4 or newer, and you will also need to have the XStream serialization library. The xstream-1.1.2.jar file is very important. You will also need to have basic to intermediate skills with both Java and XML. Xstream is controlled by a large team of highly skilled programmers.

Even though XStream can be defined as a serialization library, the classes that you serialize won’t need to show the serialized marker. XStream works by using the internal fields of an object, and these fields will be handled by a converter. If you use a solution that is dependent on the reflection, there could be problems with performance. However, it should be noted that the library is generally fast. If this is your first time working with the combination of Java and XML, you will need to know that changing the characteristics of a class or techniques after you’ve serialized the class can place the deserialization of the object at risk.

The programmers who created Xstream tried to make sure the program could properly deal with situations where the class is altered. It only takes three lines of code in order to serialize or undo an object which has been serialized. You will want to make sure your XML is correct, because XStream will not give you any confirmation. The code below was taken from the Xstream website, and this is a high quality XML library. You may need to adjust it to suit your needs:

//Convert a Java object to XML
XStream xstream = new XStream();
XStream xstream = new XStream(new DomDriver()); // does not require XPP3 library
String xml = xstream.toXML(joe);

//Convert XML to a Java object using the
//same xstream reference
Person joe = xstream.fromXML(joeXML); //joeXML not shown

While XStream has a number of good features, it does have some problems. If you are using a JDK version which is older than 1.4, you will need to use a no-arg default constructor. This is important when you want to deserialize an object. Using an updated version of JDK can help you avoid this additional step. When you work with XML, it is important to make sure your information can be read. This is extremely important. It is also important for you to understand the design of Xstream. You may notice in the sample code that Xstream can serialize object graphs which are nested.



Xstream has designed its XML by using a number of conversion classes that can deal with the many basic Java elements you will run into. This includes many collection classes. Converters play an important role with Xstream, and it is best to look at their reference guide before you begin work on a project. Having an idea of how XML looks will make things easier to understand.

« « Tips You Can Use To Improve Your Memory
Customer Information Control System (CICS) » »

Author Description

Avatar

Editorial Team at Exforsys is a team of IT Consulting and Training team led by Chandra Vennapoosa.

Free Training

RSSSubscribe 394 Followers
  • Popular
  • Recent
  • How To Run J2ME Programs on Palm Devices

    July 14, 2006 - 0 Comment
  • Future of Java Technology

    November 26, 2005 - 0 Comment
  • Antipatterns In Java Programs

    July 1, 2006 - 0 Comment
  • How To Use Java DB as Your Client Mobile Database

    July 14, 2006 - 0 Comment
  • Is Ejb really significant in enterprise applications?

    November 26, 2005 - 0 Comment
  • How a Profiler Can Improve Your Java Applications

    July 1, 2006 - 0 Comment
  • Java Overview

    July 17, 2006 - 0 Comment
  • Java for Stand-Alone Applications

    November 26, 2005 - 0 Comment
  • How Code Reviews and PMD Can Crush Bugs In Your Code

    July 3, 2006 - 0 Comment
  • Java Virtual Machine

    July 13, 2006 - 0 Comment
  • Why It is Important To Focus On Java Exceptions For Your Programs

    July 27, 2006 - 0 Comment
  • Important Features of Java – Multithreading, AWT

    July 26, 2006 - 0 Comment
  • What You Can Do To Deal With Java’s Memory Retention Problems

    July 22, 2006 - 0 Comment
  • Java Overview

    July 17, 2006 - 0 Comment
  • How To Use Java DB as Your Client Mobile Database

    July 14, 2006 - 0 Comment
  • How To Run J2ME Programs on Palm Devices

    July 14, 2006 - 0 Comment
  • Java Virtual Machine

    July 13, 2006 - 0 Comment
  • Quickly Develop Java Programs With Tapestry

    July 12, 2006 - 0 Comment
  • A Java TOC2 Class Which Can Contact Aim

    July 12, 2006 - 0 Comment
  • How To Perform Class Loading With Java

    July 8, 2006 - 0 Comment

Exforsys e-Newsletter

ebook
 

Related Articles

  • Why It is Important To Focus On Java Exceptions For Your Programs
  • Important Features of Java – Multithreading, AWT
  • What You Can Do To Deal With Java’s Memory Retention Problems
  • Java Overview
  • How To Use Java DB as Your Client Mobile Database

Latest Articles

  • Project Management Techniques
  • Product Development Best Practices
  • Importance of Quality Data Management
  • How to Maximize Quality Assurance
  • Utilizing Effective Quality Assurance Strategies
  • Sitemap
  • Privacy Policy
  • DMCA
  • Trademark Information
  • Contact Us
© 2023. All Rights Reserved.IT Training and Consulting
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish.AcceptReject Read More
Privacy & Cookies Policy

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Non-necessary
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
SAVE & ACCEPT