我有一个 XML 字符串。我想解析这个 XML 格式的字符串,并想存储在 java 对象中。这是我的 XML:
<XMLRequest>
<RequestAction>Modify</RequestAction>
<MerchantDetail>
<CloverID>10</CloverID>
<MerchantNumber>111111</MerchantNumber>
<Platform>N</Platform>
<DBAName>Sujata_306</DBAName>
<LegalName>Sujata_306</LegalName>
<Address1>Fountain road</Address1>
<City>Vista</City>
<State>Boulder</State>
<Zip>1518580</Zip>
<Country>US</Country>
<PhoneNumber>8467852314</PhoneNumber>
<Email>[email protected]</Email>
<Contact>Sujata_306</Contact>
<Reseller>DevelopersUS</Reseller>
<MCCCode>7394</MCCCode>
<Currency>USD</Currency>
<TAEncryptionType>0001</TAEncryptionType>
<GroupID>10001</GroupID>
<SupportPhone>8467852314</SupportPhone>
<ABAAccountNumber>000000000000000</ABAAccountNumber>
<DDAAccountNumber>***********3770</DDAAccountNumber>
</MerchantDetail>
<CardTypes>
<CardType CardName = "MASTER">
<SENUMBER />
<AlphaID>1234</AlphaID>
<ServiceType>F</ServiceType>
</CardType>
<CardType CardName = "VISA">
<SENUMBER />
<AlphaID />
<ServiceType />
</CardType>
</CardTypes>
</XMLRequest>
检查 Jackson 库的 XML 和 JSON 解析,
s become quite standard in the industry. Here
是他们的 XMlParser 文档的链接
https://github.com/FasterXML/jackson-dataformat-xml
此 iwl 允许您将对象序列化和反序列化为 Java POJO(普通旧 Java 对象)或哈希图。