Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

244
Visualizações
Java Reflection to handle the dynamic object mapping of object we got from parsing xml to pojo

I have a scenario where I need to handle xml data that will parsed into object. Requirement is to dynamically map those variables. For example suppose I have an xml :

<request>
         <member>
            <id>abc</id>
            <details>
               <ssn>19</ssn>
               <verification>
                  <indicator>Y</indicator>
                  <fedInd>N</fedInd>
                  <status>XY</status>
               </verification>
            </details>
            <taxStatus>
               <LastYrStatus>NFT</LastYrStatus>
               <ThisYrStatus>MFT</ThisYrStatus>
            </taxStatus>           
         </member>
    </request>

Now looking at the xml I want to map the field indicator whose exact path is : request|member|details|verification|indicator the dynamic mapping should give me the getter of these variables from respective java object like getRequest().getMember().getDetails().getVerification().getIndicator() so that if in future path of xml tag got change I don't have to make so many changes in the code it will be dynamically mapped with the new tag location. Can anyone reply how to handle this situation using java reflection or through any other way.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

XML are based on xsds, why don't you provide XSDs for parsing, so that whenever the XSD is changed the data accordingly provided.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda