To Overwrite ''false" Value

Hi Run below ruby code to overwrite false value in xml to true but still I am getting same false value ,overwrite of value is not happen…

 <n1:File>
    <n1:FileName>44979_008_V01_SIGNED.mxf</n1:FileName>
    <n1:CheckSum>57a055aa602e49d08e8bc3856b6b126c</n1:CheckSum>
    <n1:FileType>AV</n1:FileType>
    <n1:FileFormat>MXF</n1:FileFormat>
    <n1:Recording>
      <n1:RecDuration>00:47:25:00</n1:RecDuration>
      <n1:StartOfFileTC>09:59:55:00</n1:StartOfFileTC>
      <n1:RecSegment>
        <n1:SegmentType>Clock</n1:SegmentType>
        <n1:SegmentStartTC>09:59:55:00</n1:SegmentStartTC>
        <n1:SegmentDurationTC>00:00:02:00</n1:SegmentDurationTC>
      </n1:RecSegment>
      <n1:RecSegment>
        <n1:SegmentType>Content</n1:SegmentType>
        <n1:ContentPartNo>1</n1:ContentPartNo>
        <n1:SegmentStartTC>10:00:00:00</n1:SegmentStartTC>
        <n1:SegmentDurationTC>00:10:54:00</n1:SegmentDurationTC>
      </n1:RecSegment>
      <n1:RecSegment>
        <n1:SegmentType>Clock</n1:SegmentType>
        <n1:SegmentStartTC>10:12:55:00</n1:SegmentStartTC>
        <n1:SegmentDurationTC>00:00:02:00</n1:SegmentDurationTC>
      </n1:RecSegment>
      <n1:RecSegment>
        <n1:SegmentType>Content</n1:SegmentType>
        <n1:ContentPartNo>2</n1:ContentPartNo>
        <n1:SegmentStartTC>10:13:00:00</n1:SegmentStartTC>
        <n1:SegmentDurationTC>00:12:57:00</n1:SegmentDurationTC>
      </n1:RecSegment>
      <n1:RecSegment>
        <n1:SegmentType>Clock</n1:SegmentType>
        <n1:SegmentStartTC>10:27:55:00</n1:SegmentStartTC>
        <n1:SegmentDurationTC>00:00:02:00</n1:SegmentDurationTC>
      </n1:RecSegment>
      <n1:RecSegment>
        <n1:SegmentType>Content</n1:SegmentType>
        <n1:ContentPartNo>3</n1:ContentPartNo>
        <n1:SegmentStartTC>10:28:00:00</n1:SegmentStartTC>
        <n1:SegmentDurationTC>00:11:40:00</n1:SegmentDurationTC>
      </n1:RecSegment>
      <n1:RecSegment>
        <n1:SegmentType>Clock</n1:SegmentType>
        <n1:SegmentStartTC>10:40:55:00</n1:SegmentStartTC>
        <n1:SegmentDurationTC>00:00:02:00</n1:SegmentDurationTC>
      </n1:RecSegment>
      <n1:RecSegment>
        <n1:SegmentType>Content</n1:SegmentType>
        <n1:ContentPartNo>4</n1:ContentPartNo>
        <n1:SegmentStartTC>10:41:00:00</n1:SegmentStartTC>
        <n1:SegmentDurationTC>00:06:15:00</n1:SegmentDurationTC>
      </n1:RecSegment>
      <n1:Video>
        <n1:Encoding>
          <n1:Codec>AVC</n1:Codec>
          <n1:Profile>High 4:2:2 Intra</n1:Profile>
          <n1:kBitrate>113766</n1:kBitrate>
        </n1:Encoding>
        <n1:ScanType>MBAFF</n1:ScanType>
        <n1:FieldOrder>UpperFieldFirst</n1:FieldOrder>
        <n1:FrameRate>
          <n1:Nominator>25000</n1:Nominator>
          <n1:Denominator>1000</n1:Denominator>
        </n1:FrameRate>
        <n1:Resolution>
          <n1:FrameWidth>1920</n1:FrameWidth>
          <n1:FrameHeight>1080</n1:FrameHeight>
        </n1:Resolution>
        <n1:Anamorphic>false</n1:Anamorphic>
        <n1:PictureContent>
          <n1:ActivePictureAspectRatio>1.78</n1:ActivePictureAspectRatio>
          <n1:AFDCode>10</n1:AFDCode>
          <n1:VisualElements>
            <n1:VisualElement language="bfi_GB">Signer</n1:VisualElement>
          </n1:VisualElements>
        </n1:PictureContent>
      </n1:Video>
      <n1:Audio>
        <n1:SoundfieldGroup soundfieldGroupID="a">
          <n1:MultichannelType>Stereo</n1:MultichannelType>
          <n1:AudioContent>
            <n1:AudioContentKind>Primary</n1:AudioContentKind>
            <n1:PrimarySpokenlanguage>eng_XX</n1:PrimarySpokenlanguage>
          </n1:AudioContent>
        </n1:SoundfieldGroup>
        <n1:SoundfieldGroup soundfieldGroupID="b">
          <n1:MultichannelType>Stereo</n1:MultichannelType>
          <n1:AudioContent>
            <n1:AudioContentKind>Music and Effects</n1:AudioContentKind>
            <n1:PrimarySpokenlanguage>zxx_XX</n1:PrimarySpokenlanguage>
          </n1:AudioContent>
        </n1:SoundfieldGroup>
        <n1:AudioChannel audioChannelReference="1">
          <n1:SoundfieldGroupLinkID>a</n1:SoundfieldGroupLinkID>
          <n1:AudioChannelType>Left</n1:AudioChannelType>
        </n1:AudioChannel>
        <n1:AudioChannel audioChannelReference="2">
          <n1:SoundfieldGroupLinkID>a</n1:SoundfieldGroupLinkID>
          <n1:AudioChannelType>Right</n1:AudioChannelType>
        </n1:AudioChannel>
        <n1:AudioChannel audioChannelReference="3">
          <n1:SoundfieldGroupLinkID>b</n1:SoundfieldGroupLinkID>
          <n1:AudioChannelType>Left</n1:AudioChannelType>
        </n1:AudioChannel>
        <n1:AudioChannel audioChannelReference="4">
          <n1:SoundfieldGroupLinkID>b</n1:SoundfieldGroupLinkID>
          <n1:AudioChannelType>Right</n1:AudioChannelType>
        </n1:AudioChannel>
      </n1:Audio>
    </n1:Recording>
    <n1:QCReport lastModified="2022-07-01T13:41:33Z">
      <n1:QCReportID>535f9580db6f013a43b100505680f9f8</n1:QCReportID>
      <n1:QCProfileID>C4-SignerFastTrackReview</n1:QCProfileID>
      <n1:QCPerformerName>44979/008</n1:QCPerformerName>
      <n1:QCItemResult>
        <n1:QCItemID>C4-0001A</n1:QCItemID>
        <n1:QCItemName>General QC</n1:QCItemName>
        <n1:QCItemOutput>
          <n1:KeyWord>EngineersRecommendation</n1:KeyWord>
          <n1:TestValue>Technically Satisfactory</n1:TestValue>
        </n1:QCItemOutput>
        <n1:QCItemOutput>
          <n1:KeyWord>SpokenForeignLanguage</n1:KeyWord>
          <n1:TestValue></n1:TestValue>
        </n1:QCItemOutput>
        <n1:QCItemOutput>
          <n1:KeyWord>TechnicalNotes</n1:KeyWord>
          <n1:TestValue></n1:TestValue>
        </n1:QCItemOutput>
        <n1:QCItemOutput>
          <n1:KeyWord>PictureColour</n1:KeyWord>
          <n1:TestValue>Colour</n1:TestValue>
        </n1:QCItemOutput>
        <n1:QCItemOutput>
          <n1:KeyWord>GeneralNotes</n1:KeyWord>
          <n1:TestValue>MQC by SG</n1:TestValue>
        </n1:QCItemOutput>
        <n1:QCItemOutput>
          <n1:KeyWord>Exempted</n1:KeyWord>
          <n1:TestValue>false</n1:TestValue>
        </n1:QCItemOutput>
      </n1:QCItemResult>
      <n1:QCItemResult>
        <n1:QCItemID>C4-002A</n1:QCItemID>
        <n1:QCItemName>Overall QC Result</n1:QCItemName>
        <n1:QCItemOutput>
          <n1:KeyWord>GeneralQCResult</n1:KeyWord>
          <n1:TestValue>false</n1:TestValue>
        </n1:QCItemOutput>
        <n1:QCItemOutput>
          <n1:KeyWord>RecordingIsTXFormatCompliant</n1:KeyWord>
          <n1:TestValue>false</n1:TestValue>
        </n1:QCItemOutput>
        <n1:QCItemOutput>
          <n1:KeyWord>ContentIsTXCompliant</n1:KeyWord>
          <n1:TestValue>false</n1:TestValue>
        </n1:QCItemOutput>
      </n1:QCItemResult>
      <n1:QCItemResult>
        <n1:QCItemID>EBU-0087B</n1:QCItemID>
        <n1:QCItemName>General Image Quality</n1:QCItemName>
        <n1:QCItemOutput>
          <n1:KeyWord>Picture Quality General</n1:KeyWord>
          <n1:TestValue>4</n1:TestValue>
          <n1:Description>Fast Track Review Only.</n1:Description>
        </n1:QCItemOutput>
      </n1:QCItemResult>
      <n1:QCItemResult>
        <n1:QCItemID>EBU-0125B</n1:QCItemID>
        <n1:QCItemName>General Audio Quality</n1:QCItemName>
        <n1:QCItemOutput>
          <n1:KeyWord>Audio Quality General</n1:KeyWord>
          <n1:TestValue>4</n1:TestValue>
          <n1:Description>Fast Track Review Only.</n1:Description>
        </n1:QCItemOutput>
      </n1:QCItemResult>
      <n1:QCItemResult>
        <n1:QCItemID>EBU-0119B</n1:QCItemID>
        <n1:QCItemName>Slate Details</n1:QCItemName>
        <n1:QCItemOutput>
          <n1:KeyWord>Slate Details Valid</n1:KeyWord>
          <n1:TestValue></n1:TestValue>
        </n1:QCItemOutput>
      </n1:QCItemResult>
      <n1:QCItemResult>
        <n1:QCItemID>C4-0003A</n1:QCItemID>
        <n1:QCItemName>PSE and Loudness Compliance</n1:QCItemName>
        <n1:QCItemOutput>
          <n1:KeyWord>Overall PSE Test Result</n1:KeyWord>
          <n1:TestValue>Pass</n1:TestValue>
        </n1:QCItemOutput>
        <n1:QCItemOutput>
          <n1:KeyWord>EBU R128 Compliance Result</n1:KeyWord>
          <n1:TestValue></n1:TestValue>
        </n1:QCItemOutput>
      </n1:QCItemResult>
      <n1:QCItemResult>
        <n1:QCItemID>EBU-0143B</n1:QCItemID>
        <n1:QCItemName>Textless Elements</n1:QCItemName>
        <n1:QCItemOutput>
          <n1:KeyWord>TextlessElementsPresent</n1:KeyWord>
          <n1:TestValue>false</n1:TestValue>
        </n1:QCItemOutput>
      </n1:QCItemResult>
    </n1:QCReport>
  </n1:File>
  <n1:File>
    <n1:FileName>44979_008_V01_SIGNED_EYE.pdf</n1:FileName>
    <n1:CheckSum>2b6534dfd3d0922d7df773c8623b1594</n1:CheckSum>
    <n1:FileType>EYEBALL Check Report</n1:FileType>
    <n1:FileFormat>PDF</n1:FileFormat>
  </n1:File>
  <n1:File>
    <n1:FileName>44979_008_V01_SIGNED_AQC_PSE.pdf</n1:FileName>
    <n1:CheckSum>ae843de9d90ae71f7a0693bd33a738d6</n1:CheckSum>
    <n1:FileType>AQC+PSE Test Report</n1:FileType>
    <n1:FileFormat>PDF</n1:FileFormat>
  </n1:File>
  <n1:File>
    <n1:FileName>44979_008_V01_SIGNED_AQC_PSE.xml</n1:FileName>
    <n1:CheckSum>ae843de9d90ae71f7a0693bd33a738d6</n1:CheckSum>
    <n1:FileType>AQC+PSE Test Report</n1:FileType>
    <n1:FileFormat>XML</n1:FileFormat>
  </n1:File>
require 'builder'
require 'nokogiri'


# Inbound XML DOC
inbound_xml = '44979_008_V01_20220701132610.xml'
# inbound_xml_doc = Nokogiri.XML inbound_xml
inbound_xml_doc = File.open(inbound_xml) { |f| Nokogiri::XML(f) }
inbound_xml_doc.remove_namespaces!

# <n1:QCItemOutput>
  # <n1:KeyWord>ContentIsTXCompliant</n1:KeyWord>
  # <n1:TestValue>false</n1:TestValue>

  # /QCReport/QCItemResult[QCItemID='C4-0003A']/QCItemOutput[KeyWord='EBU R128 Compliance Result']/TestValue").text

# qc_item_result = inbound_xml_doc.xpath("*/File/QCReport/QCItemResult/QCItemOutput[KeyWord='ContentIsTXCompliant']/TestValue").text

# puts qc_item_result

# inbound_xml_doc.xpath("*/File/QCReport/QCItemResult/QCItemOutput[KeyWord='ContentIsTXCompliant']/TestValue") = "qwerty"

puts inbound_xml_doc.xpath("*/File/QCReport/QCItemResult/QCItemOutput[KeyWord='ContentIsTXCompliant']/TestValue").text

inbound_xml_doc.search("*/File/QCReport/QCItemResult/QCItemOutput[KeyWord='ContentIsTXCompliant']/TestValue").each do |node|
  puts node.content
  node.content = "true"
end
new_xml = inbound_xml_doc.to_xml

file = File.new("44979_008_V01_20220701132610_V2.xml", "w+")
file.write(new_xml)
file.close