in reply to Getting start and end xml tags

Similar to your previous questions (e.g. Match text from txt to html), have you considered using a proper parser? What is the source/generator of this XML?

Replies are listed 'Best First'.
Re^2: Getting start and end xml tags
by corfuitl (Sexton) on May 28, 2020 at 12:58 UTC

    Hi

    Thank you for your reply. It's not similar to my previous question.

      Your previous questions about working with HTML/XML have had solutions provided using proper parsing modules. The post I linked to was about working with sentences split up by HTML tags, here you have XML. How is this not similar?

      Unless you are dealing with very trivial, very static (X|HT|SG)ML markup the answer to "How do I do X with my FOOML" is pretty much invariably going to entail starting off "Use a FOOML parsing module, then . . .". See Why a regex *really* isn't good enough for HTML and XML, even for "simple" tasks for a recent, good pathological example why.

      Even if you think you've really got something trivial you're then betting against yourself that that format will never change and have baked an unspoken brittleness into your code.

      The cake is a lie.
      The cake is a lie.
      The cake is a lie.