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

  • SEARCH
  • Home
  • 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 8805837
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T01:58:03+00:00 2026-06-14T01:58:03+00:00

I had XML files like this: <root> <key0>value</key0> <key1>value</key1> <key2>value</key2> </root> It’s easy to

  • 0

I had XML files like this:

<root>
    <key0>value</key0>
    <key1>value</key1>
    <key2>value</key2>
</root>

It’s easy to turn such file into key-value structure. Let’s showcase the result in Python dict, for example:

{'key0': 'value', 'key1': 'value', 'key2': 'value'}

Now they added nested elements:

<root>
    <key0>value</key0>
    <key1>value</key1>
    <key2>value</key2>
    <key3>
        <sth0>value</sth0>
        <sth1>value</sth1>
    </key3>
</root>

Still easy:

{'key0': 'value', 'key1': 'value', 'key2': 'value', 'key3/sth0': 'value', 'key3/sth1': 'value'}

I think you got the point. Now what about this?

<root>
    <key0>value</key0>
    <key1>value</key1>
    <key1>
         <inner>value</inner>
    </key1>
    <key2>value</key2>
    <key3>
        <sth0>value</sth0>
        <sth1>value</sth1>
    </key3>
    <key3>
        <sth0>different value</sth0>
        <sth1>different value</sth1>
    </key3>
    <key3>
        <sth0>blah blah</sth0>
        <sth1>blah blah</sth1>
    </key3>
</root>

Of course, I could come up with something after a while of thinking, but something tells me I would meet more and more difficulties. So the question is: Is there an complex algorithm to ‘serialize’ values in similarly simple XML file into key-value form? It has to be deterministically serializable and unserializable and no values can be lost. Order of elements doesn’t matter (Python dict in examples is not a random choice, it’s really what I’m trying to get).

I know XMLs can be very complex (namespaces, attributes, whatever), but this is not the case. The only problem I need to properly resolve is nested values as presented and related multiplicity of the same keys.

  • 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-14T01:58:04+00:00Added an answer on June 14, 2026 at 1:58 am

    Append something unique to the end of each name. Like becomes Key0_unique , where unique is a ascending number or guid.

    (Although if your ‘ecosystem’ is big now and growing, I would consider sorting this out now rather than later.)

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

Sidebar

Related Questions

Has anyone had this problem? My projects tend to have some long XML files
Has anyone had experience performing xml transform on resx files before? I would like
recently I had an error, which was caused by a corrupted AndroidManifest.xml file. Is
I just added this to my web.xml on my JBOSS server. But it had
I have 2 XML files that I would like to include into a project
I've got an application that reads in XAML files dynamically like this: StreamReader sr
I have to read xml file. I did it but i had a problem.
I have a make file that calls ant and maven build files. I've had
I have an xml document that goes like this: <Menu> <Category name=Comida Rapida> <Food
How do you load an HTML DOM document into Scala? The XML singleton had

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.