Based on the research of unordered tree-inclusion matching, a matching algorithm for XML-based component query is proposed. This algorithm can greatly improve the recall and provide support for Boolean query while maintaining a high level precision. Moreover, by adding some constraints on the basis of features of software component and using dynamic programming, the computation of matching cost is resolved in polynomial time, so that a high efficiency for the component query is guaranteed. Furthermore, the feasibility and efficiency of the new matching algorithm in practical application to software component query are confirmed by the results of a series of experiments on a prototype system RCRS.