簡體   English   中英

有人知道XML序列化Key = Value的這種格式嗎?

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

從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}

它看起來很像JSON格式,但是有些不同。 我需要解析該值並在其中搜索所需的值。 有誰知道在這種情況下是否需要編寫標准結構或特定的語法分析?

就我在這種情況下無法獲得的關於標准庫的任何答復而言,我不得不將此數據轉換為JSON。
我使用了下一個替換:

// 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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM