Extracting value given a name from a Document obj

Just wondering if anyone is aware of an out of the box service which can return a value from a Document object given a name.

Temporarily, I have created a service which does the following:

Document to XML str -> XML str to XML node -> query XML Node

One major reason I didn’t like this approach is because I had to hard code the XQL query for the name I am trying to get the value for.

You can use a variable name in your query like ‘/%element%/rawtext()’ Then pass it the name of the element you want.

Will, thanks for your response. I tried what you suggested but got the following error:

com.wm.app.b2b.server.ServiceException: com.wm.lang.flow.WattExpressionException: Character not valid in XQL: ‘%’ (ASCII 37)

Any other recommendations to extract a value given a name from a wM Doc object?

I actually verified that it works before I responded to your question. I was able to reproduce your problem by missing the ending ‘%’ …make sure you use ‘%element%’ (% on both sides of the variable).