I am building an app that lets users interact with xml
files that they have uploaded. I need to make the xml
file interactive for the user.
const testXML: string = `
<testenv:header>
<title>Page Title</title>
</testenv:header>
<testenv:body>
<NumOne>one</NumOne>
<NumTen>10</NumTen>
<Finally>finally</Finally>
</testenv:body>`
I want to make turn the opening element tags and innerXML into links. Im not sure if regex is the best way to do this or if there are other options. The result would look like the following:
<testenv:header
>
<title
>Page Title
</title
>
</testenv:header
>
<testenv:body
>
<testtag
/>
<NumOne
>one
</NumOne
>
<NumTen
>10
</NumTen
>
<Finally
>finally
</Finally
>
</testenv:body
>
Of note here is that I am only turning the opening element tags and innerXML into links. I do not want to make the closing xml tags links unless it is an element with only one tag like <testtag
/>.