nashwaan / xml-js

Converter utility between XML text and Javascript object / JSON text.
MIT License
1.28k stars 182 forks source link

xml2json Ignore HTML tags inside <descriptions> #140

Open Kenzo95 opened 4 years ago

Kenzo95 commented 4 years ago

XML files that I have to convert at json have certain description preformatted as HTML, I want Ignore conversions of all tags inside <description> tag or just ignore DIV and SPAN and others HTML tags and have a result like "description": "HTML CONTENT". Someone have suggestions?

<description>
        <description>
                <div class='pdbDescContainer'><div class='pdbDescSection'><span class='pdbDescSectionTitle'>Gender:</span><span class='pdbDescSectionText'>Woman</span></div><div class='pdbDescSection'><span class='pdbDescSectionTitle'>Type:</span><span class='pdbDescSectionText'>Sweatshirt</span></div><div class='pdbDescSection'><span class='pdbDescSectionTitle'>Sleeves:</span><span class='pdbDescSectionText'>long</span></div><div class='pdbDescSection'><span class='pdbDescSectionTitle'>Neckline:</span><span class='pdbDescSectionText'>round</span></div><div class='pdbDescSection'><span class='pdbDescSectionTitle'>Material:</span><span class='pdbDescSectionText'><span class='pdbDescSectionList'><span class='pdbDescSectionItem'>cotton 100%</span></span></span></div><div class='pdbDescSection'><span class='pdbDescSectionTitle'>Washing:</span><span class='pdbDescSectionText'><span class='pdbDescSectionList'><span class='pdbDescSectionItem'>wash at 40° C</span></span></span></div><div class='pdbDescSection'><span class='pdbDescSectionTitle'>Model height, cm:</span><span class='pdbDescSectionText'>180</span></div><div class='pdbDescSection'><span class='pdbDescSectionTitle'>Model wears a size:</span><span class='pdbDescSectionText'>S</span></div><div class='pdbDescSection'><span class='pdbDescSectionTitle'>Fit:</span><span class='pdbDescSectionText'>regular</span></div><div class='pdbDescSection'><span class='pdbDescSectionTitle'>Hems:</span><span class='pdbDescSectionText'>ribbed</span></div><div class='pdbDescSection'><span class='pdbDescSectionTitle'>Details:</span><span class='pdbDescSectionText'><span class='pdbDescSectionList'><span class='pdbDescSectionItem'>visible logo</span></span></span></div></div>
        </description>
                <localecode>en_US</localecode>
        </description>
</descriptions>
jimm101 commented 3 years ago

Hit the same issue today. Find anything?