# HG changeset patch # User laurent # Date 1323872016 -3600 # Node ID 25c92309cdae2c7ee2433528dd8df47074008db8 # Parent 7cadf0e2ae054c09f8db9be0821df955b228ade3 Fixing bug in xmlclass with simple type elements containing #text node instead of cdata diff -r 7cadf0e2ae05 -r 25c92309cdae xmlclass/xmlclass.py --- a/xmlclass/xmlclass.py Mon Dec 12 00:38:24 2011 +0100 +++ b/xmlclass/xmlclass.py Wed Dec 14 15:13:36 2011 +0100 @@ -1366,7 +1366,7 @@ choices.append(ComputeMultiplicity(structure, infos)) elements.append(ComputeMultiplicity("|".join(choices), element)) elif element["name"] == "content" and element["elmt_type"]["type"] == SIMPLETYPE: - elements.append("(?:#cdata-section )?") + elements.append("(?:#text |#cdata-section )?") else: elements.append(ComputeMultiplicity("%s " % element["name"], element)) if classinfos.get("order", True) or len(elements) == 0: @@ -1402,6 +1402,7 @@ structure_model = re.compile("(%s)$" % structure_pattern) result = structure_model.match(children_structure) if not result: + print children_structure, structure_model.pattern raise ValueError("Invalid structure for \"%s\" children!." % tree.nodeName) required_attributes = dict([(attr["name"], True) for attr in classinfos["attributes"] if attr["use"] == "required"]) if classinfos.has_key("base"):