Arzaroth / python_rapidxml

python bindings for RapidXml, a C++ XML parsing library
MIT License
6 stars 2 forks source link

value of the node could not be updated while using cdata features. #6

Open yanserah opened 6 years ago

yanserah commented 6 years ago

Hello all, I' m using the latest version 2.1.1

if I use this statement to parse my xml message l_xml_data = rapidxml.RapidXml(p_my_xml_message, from_file=False, cdata_key='#text', parse_cdata=True).first_node()

and then later one I do start_location = l_xml_data.first_node('rail:locationCode') start_location.value = "new value"

the value is not equals to "new value", but I still have the old value of that node.

instead while using l_xml_data = rapidxml.RapidXml(p_my_xml_message).first_node()

and then I try to apply to same instruction as previous the value is updated with "new value"

Arzaroth commented 6 years ago

Can you provide what your xml looks like (the content of the p_my_xml_message)? I'll take a look into it when I have some time.

In the meantime, I strongly discourage you using my library (or rapidxml at all for that matter). As I stated before, it is flawed by design since it does not perform sanity checks and allows data that does not conform to XML standards.

If you are confident you need this (for instance if you have attribute names containing brackets/parenthesis), then ignore my warning.

An alternative I recommend would be BeautifulSoup4 using the html parser in your case.