Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
456 views
in Technique[技术] by (71.8m points)

Parse XML TO JAVA POJO in efficient way

How to parse and create java pojo for below xml in an efficient way? Kindly suggest any efficient parser.

XML format is

<?xml version="1.0" encoding="utf-8"?>
<CCMainRootTag ID="12">
  <Header TableName="TableName"    TableVersion="12" TableID="12" CreatedDate="2013-02-09T15:35:33" CreatedByUserName="ABC" CreatedBySystem="ABC" />
  <ClassPrimary ID="12" Code="Y" DescriptionDK="DK language " DescriptionUK="" DefDK="" DefUK="" IFDGUID="">
    <ObjectClass ID="12" Code="YA" DescriptionDK="DK Language" DescriptionUK="" DefDK=""     DefUK="" IFDGUID="">
      <Synonym>
        <Concept Description="Description" Language="DK" />
        <Concept Description="" Language="UK" />
        <Concept Description="Description" Language="DK" />
        <Concept Description="" Language="UK" />
        <Concept Description="Description" Language="DK" />
        <Concept Description="" Language="UK" />
        <Concept Description="Description" Language="DK" />
        <Concept Description="" Language="UK" />
      </Synonym>
    </ObjectClass>
    <ObjectClass ID="12" Code="YB" DescriptionDK="DK Language" DescriptionUK="" DefDK="" DefUK="" IFDGUID=""> </ObjectClass>
    <ObjectClass ID="12" Code="YC" DescriptionDK="DK Language" DescriptionUK="" DefDK="" DefUK="" IFDGUID=""> </ObjectClass>
    <ObjectClass ID="12" Code="YD" DescriptionDK="DK language" DescriptionUK="" DefDK="" DefUK="" IFDGUID=""> </ObjectClass>
  </ClassPrimary>
</CCMainRootTag>

I already use thisLink but it have slow performance and having problem did't valid pojo.

I want to parser which provide me direct java pojo in a efficient way.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can use JAXB to convert XML into Java POJOs. But before you finalize the solution check this site for performance comparison.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...