Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to match xml elements with namespace ? #91

Open
yambati-tillster opened this issue Nov 18, 2021 · 3 comments
Open

How to match xml elements with namespace ? #91

yambati-tillster opened this issue Nov 18, 2021 · 3 comments

Comments

@yambati-tillster
Copy link

yambati-tillster commented Nov 18, 2021

<request xmlns:ns2="http://schemas.datacontract.org/2004/07/System">
    <Options>
        <CalculateItemPrice>true</CalculateItemPrice>
    </Options>
    <Order>
        <DestinationId>1</DestinationId>
        <Discounts/>
        <FutureOrder>
            <EmailAddress>[email protected]</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

@yambati-tillster yambati-tillster changed the title Matchers for xml elements with namespace How to match xml elements with namespace Nov 18, 2021
@yambati-tillster yambati-tillster changed the title How to match xml elements with namespace How to match xml elements with namespace ? Nov 18, 2021
@yambati-tillster
Copy link
Author

yambati-tillster commented Nov 30, 2021

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

@uglyog
Copy link
Member

uglyog commented Nov 30, 2021

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.

@yambati-tillster
Copy link
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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants