-3

I'm facing an issue with my XML root tag using python.

Here is my code :

nsmap = {"xsi": "https://www.org/4001/XMLSchema-instance"} 
                root = etree.Element('data-set', nsmap=nsmap)

The output is:

<data-set xmlns:xsi="https://www.org/4001/XMLSchema-instance">
  <record>

Where url is in double quote.

But I want url to be in single quote like :

<data-set xmlns:xsi='https://www.org/4001/XMLSchema-instance'>
  <record>

I've tried with this :

nsmap = {"xsi": /'https://www.org/4001/XMLSchema-instance/'} 
                root = etree.Element('data-set', nsmap=nsmap)

But it is not working

Barmar
  • 741,623
  • 53
  • 500
  • 612
Fred
  • 1
  • 1
  • 4
    Single or double quotes does not matter. Why do you want this? See https://stackoverflow.com/q/6800467/407651 – mzjn Aug 21 '23 at 15:36
  • because the process that use the xml file requires to have single quote – Fred Aug 21 '23 at 15:45
  • 1
    Any process that differentiates between single and double quote delimiting attribute or namespace values is broken. Fix the broken process rather than perpetuate the problem by catering to it. – kjhughes Aug 21 '23 at 18:24

0 Answers0