简体   繁体   中英

Does anyone know this format of XML serialization Key=Value?

From the source of HTML page I'm able to retrieve traces in the next format:

{LIST_EXCLUDED=[],LIST_TEST={HIGHLIGHTING_COLOR=#000000,TEST_HIERARCHY=5,COLOR=#E7E7B5,TEST_NAME=TEST,SHORT_NAME=TEST,COLOR_NAME=CUSTOM},TEST_BOUND=[{LIST_TESTS=[{LSA_DEBUG_INFO={FIRST_TEST_NUMBER=3,RBD=T},TEST_ID=0,NUMBER_OF_LAST_ACTIONS=9}]}],TEST_REC_ID=171}

It looks pretty like JSON format but a bit different. I need to parse this value and to search it for the values that are needed. Does anyone know if it's a kind of standard structure or specific parses need to be written in this case?

As far as I didn't get any answer about standard libraries that can be used in this case I had to convert this data into JSON.
I've used next replaces:

// key=value
parsedDataMap = parsedDataMap.replaceAll("([,\\{\\[]{1})([^,\\{\\[=]+)=([^,\\{\\}\\[\\]]+)([,\\}\\]]{1})",
    "$1\"$2\":\"$3\"$4");
// key=value 2nd time because some of the values were missed 1st time because of intersection of ranges
parsedDataMap = parsedDataMap.replaceAll("([,\\{\\[]{1})([^\",\\{\\[=]+)=([^\",\\{\\}\\[\\]]+)([,\\}\\]]{1})",
    "$1\"$2\":\"$3\"$4");
// key=[ or key={
parsedDataMap = parsedDataMap.replaceAll("([,\\{\\[]{1})([^,\\{\\[=]+)=([\\[\\{])", "$1\"$2\":$3");
// key=[ or key={ 2nd time because some of the values were missed 1st time because of intersection of ranges
parsedDataMap = parsedDataMap.replaceAll("([,\\{\\[]{1})([^\",\\{\\[=]+)=([\\[\\{])", "$1\"$2\":$3");

如果字符串中没有'=',则将'='替换为':',然后像处理json一样

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM