Parsing XML with namespaces in Python using xml.etree.ElementTree - parsing xml document

Поделиться
HTML-код
  • Опубликовано: 5 апр 2019
  • When you need to parseing xml file with namespace you can do it easy in python where you can parse namespace in xml document, you can use xml.etree.elementtree to do the job.
    in this python video tutorial will i learn you how to parsing xml document with namespace and how you work with namespace in xml document in python.
    you need to be sure you are running python3, this video will probly work in python2 but i have not testet it, and python2 will be outdated soon for updates.
    🔔🔔🔔 SUBSCRIBE to get more great videos from me 🔔🔔🔔
    ruclips.net/user/ParisNakita...
    🌟 Community 🌟
    Discord: / discord
    Instagram: / parisnakitakejser
    Facebook: / paris.n.kejser
    💝 Donate 💝: / parisnakitakejser
    Github:
    profile: github.com/parisnakitakejser

Комментарии • 19

  • @scottyd84
    @scottyd84 2 месяца назад

    Just what I was looking for, thank you.

  • @alexmak1586
    @alexmak1586 Год назад

    Thanks for this tutorial, it helped me great!

  • @masalli
    @masalli 6 месяцев назад

    I was using Copilot AI, but Copilot was totally on wrong tracks with this issue. This helped a lot! Thank you!👍

  • @prestonturner912
    @prestonturner912 5 лет назад +8

    This video is a lifesaver!

    • @pnk
      @pnk  5 лет назад

      Thanks for your feedback, and happy you like it :)

  • @maloman1989
    @maloman1989 4 года назад +2

    Great work, the most helpful video in lxml with namespaces! It´s cristal clear

    • @pnk
      @pnk  4 года назад

      Thanks a lot, happy you can use it, my point in all my video's is do it so clear as possibule :)

  • @carloszambrano8553
    @carloszambrano8553 Год назад

    Gracias de mucha utilidad tu video, saludos desde Colombia

  • @joemurawski3790
    @joemurawski3790 4 года назад

    Hi. I have a question though, as Namespaces have been causing me a massive pain
    Say I have an xml like this and I want to get the value at both sets tags...
    00:24:41:24
    00:06:54:07
    ... In this case I would need to use a more complex xpath such as './SOM/SmpteTimeCode' and './SmpteDuration/SmpteTimeCode' when I iterate through the file. This is fine if there is no namespace. However if there is a namespace present the only way I have found to work with this is to either remove the namespace from the file, and stick with the path type detailed about OR alternatively I need to add the namespace to every element within the xpath, like so:
    './{namespace}SOM/{namespace}SmpteTimeCode' and './{namespace}SmpteDuration/{namespace}SmpteTimeCode'
    Is there a more elegant way of doing this?
    I am aware that namespace can apparently be added as a 2nd argument to findall, however I cannot getting it working with xpaths like the above.
    Any help is massively appreciated here
    Cheers

  • @nk461
    @nk461 11 дней назад

    Someone teach these people how to make fonts bigger

  • @AnyFactor
    @AnyFactor 3 года назад +1

    Multiple namespaces....What is the use of programming if I am going copy-paste stuff from XML. It is dynamically scalable.

  • @KangoV
    @KangoV 4 года назад

    Nice video. Now try root.findAll('ns1:name1/ns2:name2', namespace). That I cannot get to work. Basically two namespaces in a single query.

  • @piotrbienkowski1095
    @piotrbienkowski1095 4 года назад +1

    Parsing xml with lxml in python is fun. But trying to create an xml with namespaces is a big pain in the .... you know where ;-)

    • @pnk
      @pnk  4 года назад

      Yes its not allways funny to create a xml with namespace, :)

  • @komalthecoolk
    @komalthecoolk 4 года назад +5

    This guy is just reading out and copying word to word from another example available on another website. I don't have a problem with that but I was looking for more examples

    • @pnk
      @pnk  4 года назад

      Thanks for your feedback, late me know what you need about more examples so i can create more videos to you.

  • @shivarajhj9484
    @shivarajhj9484 4 года назад +1

    Is it possible to remove namespaces apart from using xslt?

    • @pnk
      @pnk  4 года назад

      Thanks for you comment, i'm not 100% understand what you want, if you will try to descripe it more for me, i can see about i can try to help you.

  • @pawaniimeddies
    @pawaniimeddies 2 года назад

    need to zoom in