lib/ruby_nsx_cli/nsx_objects/nsxobject.rb
# Removes the <?xml version="1.0" encoding="UTF-8"?> processing instruction from the start of an XML string
# The new line character left in place is also removed to prevent issues when sending a payload to the NSX API
# which includes this string
#
# @param xml [String] an XML string that includes the processing instruction '<?xml version="1.0" encoding="UTF-8"?>'
# @return [String] the XML string without the processing instruction
Removes the  processing instruction from the start of an XML string
The new line character left in place is also removed to prevent issues when sending a payload to the NSX API
which includes this string
Removes the processing instruction from the start of an XML string The new line character left in place is also removed to prevent issues when sending a payload to the NSX API which includes this string
def strip_xml_root_pi(xml)
      frag = Nokogiri::XML::DocumentFragment.parse(xml)
      frag.xpath('processing-instruction()').remove
      return frag.to_s.sub("\n", '') 
    end
def strip_xml_root_pi ( xml ) frag = Nokogiri :: XML :: DocumentFragment . parse ( xml ) frag . xpath ( 'processing-instruction()' ) . remove return frag . to_s . sub ( "\n" , '' ) end
Removes the <?xml version="1.0" encoding="UTF-8"?> processing instruction from the start of an XML string
The new line character left in place is also removed to prevent issues when sending a payload to the NSX API
which includes this string
Removes the <?xml version = " 1 . 0 " encoding = " UTF - 8 " ? > processing instruction from the start of an XML string The new line character left in place is also removed to prevent issues when sending a payload to the NSX API which includes this string
# remove new line generated from removing root pi
the XML string without the processing instruction
the XML string without the processing instruction
String
xml
an XML string that includes the processing instruction ''
an XML string that includes the processing instruction ' '