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 7807037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T02:43:34+00:00 2026-06-02T02:43:34+00:00

I exported a mysql database to xml with phpmyadmin and now I would like

  • 0

I exported a mysql database to xml with phpmyadmin and now I would like to parse it with minidom but I’m having trouble getting the content in the form that I need it.

Summary: I need to assign the variable title to the text contained within <column name="news_title">This is the title</column>

The extracted db looks like this:

<pma_xml_export version="1.0" >
    <database name="dbname">
        <!-- Table newsbox -->
        <table name="newsbox">
            <column name="news_id">1</column>
            <column name="news_title">This is the title</column>
            <column name="news_text">This is the news text</column>
            <column name="date">Thu, 28 Feb 2008 20:10:30 -0500</column>
            <column name="author">author</column>
            <column name="category">site_announcement</column>
        </table>
    </database>
</pma_xml_export>

I am able to extract the text with the following script but it’s not in the form that I need:

doc = parseString(document)

pmaexport = doc.getElementsByTagName("pma_xml_export")[0]
columns = pmaexport.getElementsByTagName("column")


for item in columns:
    name = item.getAttribute("name")
    text = item.firstChild.data.strip()
    print name, text

What I need is something where I can assign the text contents of these elements to variables which can be passed on e.g.,

for item in columns:
    title = ???
    text = ???
    date = ???
    author = ???

If the db output was in the form of <title>Here's the Title</title> I would have plenty of examples to go off, but I just can’t find any reference to something like <column name="news_title">This is the title</column>

  • 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-02T02:43:35+00:00Added an answer on June 2, 2026 at 2:43 am

    It’s been a while since I’ve used xml.dom.minidom but this should work…

    columns = [c.firstChild.data for c in pmaexport.getElementsByTagName('column') if c.getAttribute('name') == 'news_title']
    

    Plus, like, list comprehension!

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

Sidebar

Related Questions

I exported a live MySQL database (running mysql 5.0.45) to a local copy (running
I have a XAML file that I exported from Expression Design. I would like
I want to transfer a 3.23.49 MySQL database to a 5.0.51 MySQL database. Now
I'm converting a SQLite database to MySQL so I can import it to PHPMyAdmin.
I made my database in mySQL and I exported it in a file using
Hi I am trying to parse data out of an XML file I exported
I am using Python's elementtree library to parse an .XML file that I exported
I have two servers, both running phpmyadmin, and I exported a mysql dump on
I've exported my MySQL database to a .txt/.sql file (link) and want to use
I'm using php and mysql. When i try to export the database using phpMyAdmin.

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.