J
J
Jake Taylor2021-05-17 01:07:23
Java
Jake Taylor, 2021-05-17 01:07:23

How to properly organize a SAX parser in Java?

There is an xml document:

Click to open

<tariffs xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://tarasiuk.by/task02"
         xsi:schemaLocation="https://tarasiuk.by/task02 Tariffs.xsd">
    <mobile-connection id="T01">
        <tariff-information>
            <tariff-name>Unlimited</tariff-name>
            <description>Unlimited internet and unlimited calls.</description>
            <date-creation>2021-05-08</date-creation>
            <time-creation>08:00:00</time-creation>
        </tariff-information>
        <operator country="BY">
            <simple-name>MTS</simple-name>
            <full-name>Mobile TeleSystems JLLC</full-name>
        </operator>
        <parameters>
            <count-favorite-numbers>3</count-favorite-numbers>
            <tariffication>twelve seconds</tariffication>
        </parameters>
        <default-price currency="BYN">
            <connection-to-tariff>00.00</connection-to-tariff>
            <payroll>15.78</payroll>
            <send-sms>1.0</send-sms>
        </default-price>
        <call-price currency="BYN">
            <on-mobile-phone>
                <inside-operator>0.05</inside-operator>
                <outside-operator>1.15</outside-operator>
            </on-mobile-phone>
            <on-landline-phone>2.00</on-landline-phone>
        </call-price>
    </mobile-connection>
    <mobile-internet id="T02">
        <tariff-information>
            <tariff-name>Unlimited</tariff-name>
            <description>Unlimited internet and unlimited calls.</description>
            <date-creation>2021-05-08</date-creation>
            <time-creation>08:00:00</time-creation>
        </tariff-information>
        <operator country="BY">
            <simple-name>MTS</simple-name>
            <full-name>Mobile TeleSystems JLLC</full-name>
        </operator>
        <parameters>
            <count-favorite-numbers>3</count-favorite-numbers>
            <tariffication>twelve seconds</tariffication>
        </parameters>
        <default-price currency="BYN">
            <connection-to-tariff>00.00</connection-to-tariff>
            <payroll>15.78</payroll>
            <send-sms>1.0</send-sms>
        </default-price>
        <call-price currency="BYN">
            <on-mobile-phone>
                <inside-operator>0.05</inside-operator>
                <outside-operator>1.15</outside-operator>
            </on-mobile-phone>
            <on-landline-phone>2.00</on-landline-phone>
        </call-price>
        <internet-price currency="BYN">
            <up-one-gb>1.00</up-one-gb>
            <over-one-gb>0.90</over-one-gb>
        </internet-price>
    </mobile-internet>
</tariffs>



The structure of this xml document has already been created in the form of classes:
Click to open

60a196c6298ee170915348.jpeg


I have been unable to compile this SAX parser for 5 days now.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Cheremisin, 2021-05-17
@leahch

Why do you need so many type classes? All *-price are stupid maps Strung, Float...
No need to wrap each tag in a class.
And if the file is healthy, then use Stax.
Personally, I don't see anything complicated.
Better yet combine with jaxb https://stackoverflow.com/questions/25643097/can-a...

B
BorLaze, 2021-05-17
@BorLaze

You open the manual and write.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question