想想我有几个 XPath 表达式,比如:
loan:_applicant/base:_entity/person:_locations/base:SmartRefOfLocationeJDvviUx[base:_entity/contact:_category/base:_underlyingValue='Personal' and base:_entity/contact:_confirmedByResident/common:_isConfirmed/base:_underlyingValue='true' and base:_entity/base:_process/base:_entity/base:_id/base:_underlyingValue = /loan:Application/base:_process/base:_entity/base:_id/base:_underlyingValue]/base:_entity/base:_id/base:_underlyingValue
我尝试使用/base:_entity
部分作为拆分器来拆分这些表达式,如下所示:
string[] stringSeparators = new string[] { "/base:_entity" };
string[] pathTokens = xPath.Split(stringSeparators, StringSplitOptions.None);
但我需要防止在和 字符/base:_entity
之间分裂。[
]
我必须为上面编写的示例表达式生成以下字符串数组作为输出:
"loan:_applicant"
"/person:_locations/base:SmartRefOfLocationeJDvviUx
[base:_entity/contact:_category/base:_underlyingValue='Personal' and base:_entity/contact:_confirmedByResident/common:_isConfirmed/base:_underlyingValue='true' and base:_entity/base:_process/base:_entity/base:_id/base:_underlyingValue = /loan:Application/base:_process/base:_entity/base:_id/base:_underlyingValue]"
"/base:_id/base:_underlyingValue"
你有什么建议吗?