How i can create element next to another element

Viewed 19
  <TraitDef>
    <defName>Nudist</defName>
    <commonality>0.7</commonality>
    <degreeDatas>
      <li>
        <label>nudist</label>
        <description>{PAWN_nameDef} enjoys the feeling of freedom that comes from being nude. {PAWN_pronoun} can handle clothing, but will be happier without it.</description>
      </li>
    </degreeDatas>
  </TraitDef>

i want to add <labelFemale>nudist<labelFemale> next to <label>nudist</label>

BUT, that <label> can have random parent. Not only degreeDatas/li/ So i'll find <label> as

    for label in TraitDef.iter('label'):

now i can copy and replace it's tag to BUT i can't paste it. By subelement or something. Because i can't find parent.

I think i can find parent as TraitDef.findall('.//label...')

but maybe there is a more rational way?

0 Answers
Related