Thank you!!Your explanation is very helpful! I will modify the code ASAP. BTW, I didn't handle the type parser very well. Currently I can only handle string and integer type. I am thinking maybe we can use the types defined in "FieldValue" to create a map and register the corresponding type handler to it. How do you think about that?
Chenta On Mon, Mar 23, 2009 at 10:51 PM, Jonathan Robie <[email protected]>wrote: > chenta lee wrote: > >> I already add an option to let user decide whether parse the content or >> not. >> setting.arguments.setInt("qpid.selector_parse_content", 1); >> >> set qpid.selector_parse_content to 1 will enable broker to parse the >> message >> content, vice versa. >> >> > Does your code require the user to specify whether to parse the content? > I'd rather do this automatically so it is always consistent. Parse the > message if and only if the query requires it. > > After you prepare the query, you can ask XQilla if it needs to access the > context item. If it does not, then it does not need to query the content. > Look at the code for XmlExchange::bind, where I do this. This code is a bit > dense, so let me spell out a few steps: > > Parse the query: > > Query query(xqilla.parse(X(queryText.c_str()))); > > Then ask if the main body of the query uses the context (which is > equivalent to the message body in this environmetn): > > if (query->getQueryBody()->getStaticAnalysis().areContextFlagsUsed()) { > binding->parse_message_content = true; > } > > If the main body of the query does not use the context, it's still possible > that a global variable does, so let's check that too: > > GlobalVariables &vars = > const_cast<GlobalVariables&>(query->getVariables()); > for(GlobalVariables::iterator it = vars.begin(); it != vars.end(); ++it) { > if ((*it)->getStaticAnalysis().areContextFlagsUsed()) { > binding->parse_message_content = true; > break; > } > } > > In the XML Exchange, a query has only one module, it can't import > libraries. If it could, I would have to check each module this way. > > Hope this is helpful! > > Jonathan > > > --------------------------------------------------------------------- > Apache Qpid - AMQP Messaging Implementation > Project: http://qpid.apache.org > Use/Interact: mailto:[email protected] > >
