Jackson XmlMapper如何使用动态标签名称序列化列表

时间:2020-11-10 04:11:25

标签: java jaxb xml-serialization jackson-dataformat-xml

因此,我试图将带有列表的Java对象序列化为xml文件,但是我尝试执行的格式问题是它要求列表具有动态元素名称。

我正在尝试做这样的事情,

Process:               MobileSlideShow [33173]
Path:                  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/Applications/MobileSlideShow.app/MobileSlideShow
Identifier:            MobileSlideShow
Version:               1.0 (302.0.220)
Code Type:             X86-64 (Native)
Parent Process:        launchd_sim [7401]
Responsible:           SimulatorTrampoline [3483]
User ID:               501

Date/Time:             2020-11-10 09:31:13.403 +0530
OS Version:            Mac OS X 10.15.4 (19E266)
Report Version:        12
Anonymous UUID:        65D0CDE9-1CF4-A219-F420-B828D8CD20EC


Time Awake Since Boot: 9900 seconds

System Integrity Protection: disabled

Crashed Thread:        5  Dispatch queue: com.apple.root.utility-qos

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       EXC_I386_GPFLT
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [33173]

Application Specific Information:
CoreSimulator 732.17 - Device: iPhone 8 (850E409C-07CC-4E72-BC23-C85B389F14BE) - Runtime: iOS 14.0 (18A372) - DeviceType: iPhone 8
......
......
......
Model: MacBookAir7,2, BootROM 193.0.0.0.0, 2 processors, Dual-Core 
Intel Core i5, 1.8 GHz, 8 GB, SMC 2.27f2
Graphics: kHW_IntelHDGraphics6000Item, Intel HD Graphics 6000, 
spdisplays_builtin
Memory Module: BANK 0/DIMM0, 4 GB, DDR3, 1600 MHz, 0x80AD, 0x483943434E4E4E424C54424C41522D4E5444
Memory Module: BANK 1/DIMM0, 4 GB, DDR3, 1600 MHz, 0x80AD, 0x483943434E4E4E424C54424C41522D4E5444
AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0x117), Broadcom BCM43xx 1.0 (7.77.111.1 AirPortDriverBrcmNIC-1600.4)
Bluetooth: Version 7.0.4f6, 3 services, 18 devices, 1 incoming serial ports
Network Service: Wi-Fi, AirPort, en0
Serial ATA Device: APPLE SSD SM0128G, 121.33 GB
USB Device: USB 3.0 Bus
USB Device: BRCM20702 Hub
USB Device: Bluetooth USB Host Controller
USB Device: iPhone
Thunderbolt Bus: MacBook Air, Apple Inc., 27.2

其中child-element-1和child-element-2是交替的,并且可以重复n次。 还请注意,我可能会添加更多可以包含在此列表中的元素,例如<element> <child-element-1 attr1="testing1"> <child-element-2 attr2="testing2"> <child-element-1 attr1="testing1"> <child-element-2 attr2="testing2"> . . . </element> 之类的。

有什么想法吗?

0 个答案:

没有答案
相关问题