By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,035 Members | 1,388 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,035 IT Pros & Developers. It's quick & easy.

XML dom question

P: n/a
How can I do the following in python:

compare the text in the element tags <li> with the elements
tags in filling and if they match replace the text within the elements
tags <li> with the text in the matching element tag of fillin.
For example Since the text Monday in form matches the Element tag
<Monday> in fillin put maandag in the element tag <li> of Monday.
Kind of a Pseudo Code

Fo information:
get element tags for li
get text for li
Fi information:
get childtags for dutchdays
if(text for li=child tags for dutchdays):
replace child tags for dutchdays text with text for li

Some pieces of code that I tried out but cannot put together to get the

import xml.dom.minidom
from xml.dom.minidom import parseString
import xml.xpath

<head> <title> My Sample Web Page </title> </head>
<body bgcolor="white">
What are the weekdays?


for li in xml.xpath.Evaluate("//li", form_doc):
day_text = li.childNodes[0]
day_str = day_text.nodeValue
Thanks for the help!!

Oct 15 '05 #1
Share this Question
Share on Google+
2 Replies

P: n/a
"George" <bu*******> wrote:
How can I do the following in python:


In exactly the same way you could do it if you actually read the replies to the thread with the same
topic you posted yesterday. Duh!

Oct 15 '05 #2

P: n/a
Yes but I cannot get the if statement to work to compare the two or the
replaceChild portion to work. Could someone help me with that.

Oct 15 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.