Open yuviabhi opened 7 years ago
SOLVED myself ! GSON Parser unable to parse my source XML which is like following
<subject>
<subno>1</subno>
<subname>A</subname>
<ltp>1-1</ltp>
<crd>12</crd>
<sub_type>C</sub_type>
</subject>
So transformed the XML content from element to attributes using the following XSLT file
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="subject">
<subject>
<xsl:for-each select="*">
<xsl:attribute name="{name()}">
<xsl:value-of select="text()"/>
</xsl:attribute>
</xsl:for-each>
</subject>
</xsl:template>
</xsl:stylesheet>
TRANSFORMED XML
<subject subno="AE61002" subname="SATELLITE AND INERTIAL NAVIGATION SYSTEMS" ltp="3-1-0" crd="4" sub_type="ELECTIVE- I"/>
<subject subno="AE61038" subname="AEROELASTICITY" ltp="3-0-0" crd="3" sub_type="ELECTIVE- I"/>
<subject subno="AE61048" subname="COMPOSITE STRUCTURES" ltp="3-0-0" crd="3" sub_type="ELECTIVE- I"/>
<subject subno="CE60125" subname="NUMERICAL METHODS IN STRUCTURAL ENGINEERING" ltp="3-0-0" crd="3" sub_type="ELECTIVE- I"/>
<subject subno="MA60047" subname="OBJECT ORIENTED PROGRAMMING" ltp="3-1-0" crd="4" sub_type="ELECTIVE- I"/>
<subject subno="MA60057" subname="ENGINEERING MATHEMATICS" ltp="3-1-0" crd="4" sub_type="ELECTIVE- I"/>
<subject subno="MA60059" subname="ADVANCED NUMERICAL ANALYSIS" ltp="3-1-0" crd="4" sub_type="ELECTIVE- I"/>
<subject subno="MA60077" subname="COMPUTER PROGRAMMING" ltp="3-1-0" crd="4" sub_type="ELECTIVE- I"/>
<subject subno="AE61005" subname="UNSTEADY AERODYNAMICS" ltp="3-0-0" crd="3" sub_type="ELECTIVE- II-VI"/>
unable to parse? in my project all OK you just need write own class for your structure
Can't parse
<subject>
node data. Its giving following error,POJOs
XML DATA :-
See error details, POJOs and XML content here : https://drive.google.com/open?id=1Afj66c5ocjpd6E9lK3bJYg_R8XeQzPQlRRpkXJW7BMU