Wednesday, September 29, 2021

Convert an XML to RAML

Convert XML to YAML

If you want to convert XML to RAML there are lots of online tools available to do the task. One among them is https://codebeautify.org/xml-to-yaml. This tool accept XML with namespaces node and convert it in yaml format


Remove namespace from XML

There can be situations where someone requires to remove the namespace from a sample XML. This blog explains the steps 

  1. Go to any of the XML transformation sites online. As an eg. https://www.freeformatter.com/xsl-transformer.html
  2. Paste the XML with namespace in the "XML Input" text area
  3. Paste the following XSLT to  "XSL Input" text area
    1. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:output method="xml" indent="yes" />
      <xsl:template match="/|comment()|processing-instruction()">
      <xsl:copy>
      <xsl:apply-templates />
      </xsl:copy>
      </xsl:template>
      <xsl:template match="*">
      <xsl:element name="{local-name()}">
      <xsl:apply-templates select="@*|node()" />
      </xsl:element>
      </xsl:template>
      <xsl:template match="@*">
      <xsl:attribute name="{local-name()}">
      <xsl:value-of select="." />
      </xsl:attribute>
      </xsl:template>
      </xsl:stylesheet>
  4. Click on the "Transform XML" button to transform the XML 

No comments:

Post a Comment