0

I am using the following format for my xpath expression in VB.Net workflow:

String(xpath)

which returns me the expected string value, but also a new line charac after the value which is breaking my logic.

How do I get rid of that new line?

Any pointers?

More Info as requested:

The normalize-space is still returning the new line. The xml is too big, so pasting the snippet under its immediate parent here:

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

I am trying to get the value c5dec18e-806c-46d1-8294-e83117650b5b which the xpath expression does return but with the new line.

i am now using the xpath: string(normalize-space(//Package/Characteristic_Value_Population_Rule_SpecChar_Value_Population_Rule/Characteristic/Specification_Characteristic/@ID))

1
  • If the attribute value does not contain a new line then XPath will not add one. In the sample the ID="c5dec18e-806c-46d1-8294-e83117650b5b" does not show any new line and doing string(//Package/Characteristic_Value_Population_Rule_SpecChar_Value_Population_Rule/Characteristic/Specification_Characteristic/@ID) should give you the value c5dec18e-806c-46d1-8294-e83117650b5b. If you have a new line then the problem is elsewhere or the input is different. Which API do you use to evaluate the XPath expression in VB? Nov 22, 2013 at 11:28

1 Answer 1

0

Try String(normalize-space(xpath)). If that does not help then show us more context.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.