In this paper we present an implementation of a constraint solving module, CLP(Flex), for dealing with unification in an equality theory for terms with flexible arity function symbols. Then we present an application of CLP(Flex) to XML-processing where XML documents racted by terms with flexible arity symbols. This gives a highly declarative model for XML processing yielding a substantial degree of flexibility in programming.