[英]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: 从HTML页面的源代码中,我可以用以下格式检索跟踪:
{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. 它看起来很像JSON格式,但是有些不同。 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. 就我在这种情况下无法获得的关于标准库的任何答复而言,我不得不将此数据转换为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一样
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.