I am getting output like this from SOAP response. I need to convert output like this "<CLIOutput>"
to <CLIOutput>
Please suggest how to convert it into XML. Can this be done anyway with the help of XPath, XSLT or XML.
<output>
<line index="1"><CLIOutput></line>
<line index="2"> <Results></line>
<line index="3"> <ReturnCode>0</ReturnCode></line>
<line index="4"> <EventCode>23000</EventCode></line>
<line index="5"> <EventSummary>CLI command completed successfully.</EventSummary></line>
<line index="6"> </Results></line>
<line index="7"> <Data></line>
<line index="8"> <Row></line>
<line index="9"> <Tag>cp.20191028151231</Tag></line>
<line index="10"> <Time>2019-10-28 11:12:31 EDT</Time></line>
<line index="11"> <Validated>Validated</Validated></line>
<line index="12"> <Deletable>No</Deletable></line>
<line index="13"> </Row></line>
<line index="14"> <Row></line>
</output>
You can use disable-output-escaping="yes"
to convert the code like below:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="#all"
version="1.0">
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>
<xsl:template match="line">
<xsl:value-of select="." disable-output-escaping="yes"/>
</xsl:template>
</xsl:stylesheet>
See link: https://xsltfiddle.liberty-development.net/bFWR5E6