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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:54:15+00:00 2026-05-23T16:54:15+00:00

I am using python 2.7.2. and dom parser to read the data on several

  • 0

I am using python 2.7.2. and dom parser to read the data on several xml files. And export .db file to use on sql server. I have learned how to export the files, but XML tags are also included on my data tables. Here is the basic code :

from xml.dom import minidom
import sqlite3
xmldoc = minidom.parse('c:\dd\l2con\l2connection.xml')
coId = xmldoc.getElementsByTagName('id')

and each element are like this :

>>> coId[0]
<DOM Element: id at 0x249cf30>
>>> print coId[0].toxml()
<id>45859</id>
>>> coId[1]
<DOM Element: id at 0x24ac328>
>>> print coId[1].toxml()
<id>46889</id>
>>> 

where they should look like this: without the xml tags

>coId[0].toxml()
45859
>coId[1].toxml()
46889

Deleting the tags from xml probably won’t work for this case.This way python can’t read the xml file. Is there any way you can advise me on this subject.Any help will be appreciated.

Thank You

Yusuf

  • 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-05-23T16:54:15+00:00Added an answer on May 23, 2026 at 4:54 pm

    coId[0] is a DOM Element with one child (a Text node). Use

    coId[0].firstChild.data
    

    to get the text content.

    This works too:

    coId[0].firstChild.nodeValue
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

when using Python's stock XML tools such as xml.dom.minidom for XML writing, a file
Im using Python's built in XML parser to load a 1.5 gig XML file
I'm using xml.dom.mindom in Python and have retrieved the book node in the below
I am using XML minidom (xml.dom.minidom) in Python, but any error in the XML
I'm currently using the toprettyxml() function of the xml.dom module in a Python script
I have a collection of nodes xml.dom.Node objects created using xml.dom.minidom. I store them
I have the following XML document that I have to parse using python's minidom:
I'm using Python's xml.dom.minidom to create an XML document. (Logical structure -> XML string,
I'm looking to parse a xml file using Python and I was wondering if
I'm looking to use Python and xml.dom.minidom to get a list of links within

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.