I would like to ask you a problem. I want to read data from xml using either sax/dom parser but I don't know how to implement code in java. Any helps are highly appreciated...
Below texts about the requirements:
1/ xml file:
<?xml version="1.0" encoding="UTF-8"?>
<rootElement>
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<queryString>
<![CDATA[SELECT * FROM ORDERS]]>
</queryString>
<field name="ORDERID" class="java.lang.Integer"/>
<field name="CUSTOMERID" class="java.lang.String"/>
<field name="EMPLOYEEID" class="java.lang.Integer"/>
<field name="ORDERDATE" class="java.sql.Timestamp"/>
<field name="REQUIREDDATE" class="java.sql.Timestamp"/>
<field name="SHIPPEDDATE" class="java.sql.Timestamp"/>
<field name="SHIPVIA" class="java.lang.Integer"/>
<field name="FREIGHT" class="java.math.BigDecimal"/>
<field name="SHIPNAME" class="java.lang.String"/>
<field name="SHIPADDRESS" class="java.lang.String"/>
<field name="SHIPCITY" class="java.lang.String"/>
<field name="SHIPREGION" class="java.lang.String"/>
<field name="SHIPPOSTALCODE" class="java.lang.String"/>
<field name="SHIPCOUNTRY" class="java.lang.String"/>
<background>
<band splitType="Stretch"/>
</background>
<columnHeader>
<band height="20" splitType="Stretch">
<staticText>
<reportElement uuid="da31a9d4-8ee7-481d-8b51-270539a2fdec" x="460" y="0" width="92" height="20"/>
<textElement>
<font isBold="true" isItalic="true" isUnderline="true"/>
</textElement>
<text><![CDATA[SHIPPEDDATE]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="20" splitType="Stretch">
<textField>
<reportElement uuid="60fb99da-64ef-4bf9-8a96-687c433be35a" x="460" y="0" width="92" height="20"/>
<textElement>
<font isBold="true" isItalic="true" isUnderline="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{SHIPPEDDATE}]]></textFieldExpression>
</textField>
</band>
</detail>
</rootElement>
2/ Expected Result:
element : property
elment value : null
attribute name : name
attribute value : ireport.zoom
attribute name : value
attribute value : 1.0
element : property
elment value : null
attribute name : name
attribute value : ireport.x
attribute name : value
attribute value : 0
element : property
elment value : null
attribute name : name
attribute value : ireport.y
attribute name : value
attribute value : 0
element : queryString
elment value : SELECT * FROM ORDERS
attribute name : null
attribute value : null
element : ORDERID
attribute name : class
attribute value : java.lang.Integer
Any idea regarding to sax/dom parser technology using java program? Thanks in advance.