我有这个 XML 格式的字符串
<?xml version="1.0" encoding="UTF-8"?>n
<objectA>n
<command>Existing</command>n
<status>OK</status>n
<values>a lot of values....</values>n
</objectA>
我想将其拆分为字符串数组,仅包含值和内容
[0] objectA = ""
[1] command = Existing
[2] status = ok
[3] values = a lot of values....
我试过了
result = result.replaceAll(">n<", "><"); //$NON-NLS-1$ //$NON-NLS-2$
Pattern pattern = Pattern.compile("<*?>*?</*?>"); //$NON-NLS-1$
但它不适合我