Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8049801
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T06:53:13+00:00 2026-06-05T06:53:13+00:00

I am trying to map one xml file to another, based on a configuration

  • 0

I am trying to map one xml file to another, based on a configuration file (that too can be an xml file).

Input

<ia>
    <ib>...</ib>
    <ic>...</ic>
</ia>

Output

<oa>
    <ob>...</ob>
    <oc>...</oc>
</oa>

Config

<config>
    <conf>
        <input>ia</input>
        <output>oa</output>
    </conf>
    <conf>
        <input>ib</input>
        <output>ob</output>
    </conf>
    .....
</config>

So, the intention is to parse an xml file and retrieve the information interesting to me, and write into another xml file where the mapping information is specified in the config file.

Due to the scripting nature (and extending with plugins lateron), and the support for xml processing I was considering python. I just learned the syntax and basics of language, and came to know about lxml

One way of doing this

  1. parse the config file (where , tag can have xpath to the node I am interested in)
  2. read the input file
  3. write into output, using etbuilder based on the config file

Being new to python, and not seeing xpath support for etbuilder I wonder is this the best approach. Also not sure all the exceptional cases. Is there an easier way, or native support in any other libraries. If possible, I do not want to spend too much time on this task as I could focus on the core task.

thanks ins advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T06:53:14+00:00Added an answer on June 5, 2026 at 6:53 am

    If you wish to transform an XML file into another XML file then XSLT was made for this purpose. You have to define a .xslt file that describes the transformation of XML content and what the eventual output should look like. That’s one way to do it.

    You can also read the XML file using lxml and generate the output XML with lxml.etree.ElementTree. I’m not familiar with etbuilder but I don’t think generating the desired output is that difficult. Once you have parsed the input files, you can build the config XML and write it to a file.

    XPath is primarily for reading XML content, you don’t need it for constructing XML files. In fact, if you use a proper XML parser then you don’t need XPath either to read the file contents, although XPath could make life a bit easier.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to insert the contents of one map to another. Here is the
I'm trying to animate a dot from one point to another on a map.
Hi I'm trying to map a one-many parent-child relationship in NHibernate using XML mapping.
I'm trying to map one object to another but the object is quite complex.
I'm currently trying to read the contents of an XML file into a Map
I'm trying to map a table, where one of the column is a binary
I am trying to implement google map api into one of my web page
I am trying to dynamically move a google map (v3) from one div to
Trying to map the following schema using the Entity Framework. A Customer can have
Im trying to map urls to numbers in a range [0,50] for porting, that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.