<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic put a tag in metadata in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/put-a-tag-in-metadata/m-p/1136879#M63575</link>
    <description>&lt;P&gt;hi!&lt;/P&gt;&lt;P&gt;i would like to add a subelement in a metadata so i use this script&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import os
import sys
import xml.etree.ElementTree as ET
from xml.etree.ElementTree import Element
import arcpy
from arcpy import metadata as md


# Script arguments...
Source_Metadata = [arcpy.GetParameterAsText(0)]

# Local variables
#    new purpose text

resTitle1 = "PMMCU"
jason = "PMMCU"

#####################################



def update_metadata(root):
    num_elements = 0
    for child in root:
        print(child.tag, child.attrib)

    dataIdInfoEls = root.findall("./eainfo")
    for element in dataIdInfoEls:
        if element.text is not None:
            newCreditEl = ET.SubElement(element, "detailed")
            newCreditEl1 = ET.SubElement(newCreditEl, "attr")
            newCreditEl2 = SubElement(newCreditEl1, "attrdefs")
            newCreditEl2.text = resTitle1
            num_elements += 1

    return num_elements&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but now my script don't work&lt;/P&gt;&lt;P&gt;do you know why that's don't work?&lt;/P&gt;</description>
    <pubDate>Tue, 25 Jan 2022 15:21:57 GMT</pubDate>
    <dc:creator>danielROUFFART1</dc:creator>
    <dc:date>2022-01-25T15:21:57Z</dc:date>
    <item>
      <title>put a tag in metadata</title>
      <link>https://community.esri.com/t5/python-questions/put-a-tag-in-metadata/m-p/1136879#M63575</link>
      <description>&lt;P&gt;hi!&lt;/P&gt;&lt;P&gt;i would like to add a subelement in a metadata so i use this script&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import os
import sys
import xml.etree.ElementTree as ET
from xml.etree.ElementTree import Element
import arcpy
from arcpy import metadata as md


# Script arguments...
Source_Metadata = [arcpy.GetParameterAsText(0)]

# Local variables
#    new purpose text

resTitle1 = "PMMCU"
jason = "PMMCU"

#####################################



def update_metadata(root):
    num_elements = 0
    for child in root:
        print(child.tag, child.attrib)

    dataIdInfoEls = root.findall("./eainfo")
    for element in dataIdInfoEls:
        if element.text is not None:
            newCreditEl = ET.SubElement(element, "detailed")
            newCreditEl1 = ET.SubElement(newCreditEl, "attr")
            newCreditEl2 = SubElement(newCreditEl1, "attrdefs")
            newCreditEl2.text = resTitle1
            num_elements += 1

    return num_elements&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but now my script don't work&lt;/P&gt;&lt;P&gt;do you know why that's don't work?&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jan 2022 15:21:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/put-a-tag-in-metadata/m-p/1136879#M63575</guid>
      <dc:creator>danielROUFFART1</dc:creator>
      <dc:date>2022-01-25T15:21:57Z</dc:date>
    </item>
  </channel>
</rss>

