Relational query optimizers are not always robust. They depend on statistics and cost models which are often inaccurate, and sometimes absent. They fail to detect correlations, and cannot efficiently handle the large search space of big queries. Those challenges and their impact on the quality of the chosen plan are aggravated in the context of XML. In fact, in XML, it is harder to collect and maintain representative statistics. Moreover, the search space of plans is usually larger than that of relational queries, due to the higher number of joins in a typical XQuery. ROX, our Run-time Optimizer for XQueries, is autonomous, not depending on statistics and cost models, is robust in always finding a good execution plan benefiting from the detected correlations, and is efficient in exploring the space of plans. ROX moves the optimization to run-time, and interleaves it with query execution, defining the plan incrementally. Sampling techniques are used to accurately estimate the cardinality and cost of operators. We introduce chain sampling, the first generic and robust method to deal with any type of correlated data. ROX can be used in both pipelined and materialized database systems.