我在VB.Net工作流程中使用以下格式表示我的xpath表达式:
字符串(xpath)
它返回了我预期的字符串值,但也返回了一个新的行charac,这个值超出了我的逻辑。
如何摆脱这条新线?
任何指针?
根据要求提供更多信息:
normalize-space仍然返回新行。 xml太大了,所以将片段粘贴在其直接父级下面:
<Characteristic_Value_Population_Rule_SpecChar_Value_Population_Rule ID="f0baf095-5e84-4146-9c72-7691205df16b" xsi:type="SpecChar_Value_Population_Rule" Pattern="T_RelatedEntityRule">
<Entity_T_RelatedEntityGroup_AND ID="a9adc94f-615b-477b-8841-94887429a83e" xsi:type="T_RelatedEntityGroup_AND" Pattern="TRelated_EntityGroup">
<Entities_TRule_Value_EntityRef ID="f521569f-41a3-42ad-9974-3aea9557460b" xsi:type="TRule_Value_EntityRef" Pattern="TRule_Complex_Value">
<Name>Modem ADSL/VDSL/TV/PSTN b-box 3 0</Name>
<Entity>000006,000069,000078</Entity>
</Entities_TRule_Value_EntityRef>
<Entities_TRule_Value_EntityRef ID="9025dfc0-bd7d-4252-8dad-f95a818b8688" xsi:type="TRule_Value_EntityRef" Pattern="TRule_Complex_Value">
<Name>Modem ADSL/VDSL2/TV/Italk/off b-box 2 039</Name>
<Entity>000006,000069,000077</Entity>
</Entities_TRule_Value_EntityRef>
<Name>Acquisition Type is Rent in the context of Belgacom Internet</Name>
</Entity_T_RelatedEntityGroup_AND>
<Name>Acquisition Type is Rent in the context of Belgacom Internet</Name>
<Characteristic ID="ae3f9304-31a7-4c0b-8723-c553b136410e" Pattern="TSpecChar" OrigType="SpecCharItem">
<Specification_Characteristic ID="c5dec18e-806c-46d1-8294-e83117650b5b" Pattern="TSpecCharValue" OrigType="SpecCharValueItem">
<Value>Rent</Value>
<IsUserDefinedValue>false</IsUserDefinedValue>
</Specification_Characteristic>
<Name>Acquisition Type</Name>
</Characteristic>
</Characteristic_Value_Population_Rule_SpecChar_Value_Population_Rule>
</Package>
我正在尝试获取xpath表达式返回的值 c5dec18e-806c-46d1-8294-e83117650b5b ,但是使用新行。
我现在正在使用xpath: 串(正常化空间(//封装/ Characteristic_Value_Population_Rule_SpecChar_Value_Population_Rule /特征/ Specification_Characteristic / @ ID))
答案 0 :(得分:0)
试试String(normalize-space(xpath))
。如果这没有帮助,那么向我们展示更多背景。