https://linen.dev logo
#help
Title
# help
j

Jackie chen

06/22/2023, 2:39 AM
Hello, i would like to know if wiremock-jre8 2.33.2 supports xmlunit placeholder (RegEx) for e.g. <date>${xmlunit.matchesRegex(20230622.*)}</date> to check if the xml element value matches with a regex defined in the placeholder for request matching.
t

Tom

06/22/2023, 8:26 AM
I don’t think this is possible in any version, but you can achieve something similar by combining the XPath matcher with a regex value match e.g. (JSON form):
Copy code
"matchesXPath" : {
         "expression": "//date/text()",
         "matches": "20230622.*"
      }
j

Jackie chen

06/22/2023, 8:56 AM
@Tom i am using the wiremock recorder and the equalToXml is used after recording is stopped and it works perfectly with ${xmlunit.ignore} placeholder to ignore an element value for request matching. why isn’t it also possible for ${xmlunit.matchesRegex(20230622.*)}?
15 Views