Skip to content

How to match xml elements with namespace ? #91

Description

@yambati-tillster
<request xmlns:ns2="http://schemas.datacontract.org/2004/07/System">
    <Options>
        <CalculateItemPrice>true</CalculateItemPrice>
    </Options>
    <Order>
        <DestinationId>1</DestinationId>
        <Discounts/>
        <FutureOrder>
            <EmailAddress>testEmail@test.com</EmailAddress>
            <PhoneNumber>000(000)-0101</PhoneNumber>
            <PickupTime>
                <ns2:DateTime>2021-11-15T01:00:00-07:00</ns2:DateTime>
                <ns2:OffsetMinutes>0</ns2:OffsetMinutes>
            </PickupTime>
        </FutureOrder>
        <Items>
            <NewOrderItem>
                <Id>1</Id>
                <ItemId>649475714</ItemId>
                <Modifiers/>
                <Price>6.29</Price>
                <DestinationId>1</DestinationId>
            </NewOrderItem>
        </Items>
        <Name>Single Item</Name>
        <Payments>
            <NewOrderPayment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"NewExternalPayment">
                <Amount>6.80</Amount>
                <Id>2</Id>
                <TenderId>649481142</TenderId>
                <TipAmount>0</TipAmount>
            </NewOrderPayment>
        </Payments>
        <Surcharges/>
    </Order>
</request>

"matchingRules": { "body": { "$.request.Order.FutureOrder.PickupTime.{http://schemas.datacontract.org/2004/07/System}DateTime['#text']":{ "matchers": [ { "match": "regex", regex": "\\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[1-2]\\d|3[0-1])T(?:[0-1]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+|)(?:Z|(?:\\+|\\-)(?:\\d{2}):?(?:\\d{2}))" } ] } } }

This rule is currently not matching ,Is this the right way to specify the path in the case of elements with namespace.
"$.request.Order.FutureOrder.PickupTime.{http://schemas.datacontract.org/2004/07/System}DateTime['#text']"
could not find any examples or documentation. using pact-jvm, pactSpecification specification version: 3.0.0

Activity

  1. changed the title [-]Matchers for xml elements with namespace [/-] [+]How to match xml elements with namespace [/+] on Nov 18, 2021
  2. changed the title [-]How to match xml elements with namespace [/-] [+]How to match xml elements with namespace ?[/+] on Nov 18, 2021
  3. yambati-tillster commented on Nov 30, 2021

    @yambati-tillster
    Author

    I am currently blocked on this, Any updates or response for the issue is highly appreciated

  4. uglyog commented on Nov 30, 2021

    @uglyog
    Member

    Pact-JVM repository would be a better place to raise this.

    But I don't recall seeing matching rule paths with namespaces in them. It might be a bug.

  5. yambati-tillster commented on Dec 3, 2021

    @yambati-tillster
    Author

    Thank you! I would log the issue @ Pact-JVM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions