XML字符串到Object

时间:2016-07-14 09:58:02

标签: java xml list collections xml-parsing

我有字符串

<GetTimetableEntriesResponse Result="Success">
    <Timetable>
        <TimetableEntryGroup TimetableEntryGroupId="1739" ChannelId="263" Name="Ablauf 1" Priority="10">
            <StartDateTime>07.07.2016 13:52:31</StartDateTime>
            <SortOrder>2</SortOrder>
        </TimetableEntryGroup>
        <TimetableEntryGroup TimetableEntryGroupId="1740" ChannelId="263" Name="Ablauf 2" Priority="10">
            <StartDateTime>07.07.2016 00:00:00</StartDateTime>
            <Recurrence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
                <pattern>Hourly</pattern>
                <interval>1</interval>
                <start>36000</start>
                <duration>600</duration>
            </Recurrence>
            <SortOrder>3</SortOrder>
        </TimetableEntryGroup>
    </Timetable>
</GetTimetableEntriesResponse>

我必须将其解析为List<TimetableEntryGroup>

我不知道该怎么做。

1 个答案:

答案 0 :(得分:0)

看看JAXB

你也可以在这里找到足够的例子。