# HG changeset patch # User laurent # Date 1322148606 -3600 # Node ID 34c3569042db8550fe7ed38671963ab1e592775c # Parent 89ff2738ef20a763bb86ace971332257de3f9076 Fixing bug in xmlclass with empty CDATA. Empty CDATA aren't present in xml tree and prompt error when trying to load empty ANY tag using CDATA diff -r 89ff2738ef20 -r 34c3569042db xmlclass/xmlclass.py --- a/xmlclass/xmlclass.py Wed Nov 23 00:19:27 2011 +0100 +++ b/xmlclass/xmlclass.py Thu Nov 24 16:30:06 2011 +0100 @@ -1353,7 +1353,9 @@ elements = [] for element in classinfos["elements"]: if element["type"] == ANY: - elements.append(ComputeMultiplicity("#cdata-section |\w* ", element)) + infos = element.copy() + infos["minOccurs"] = 0 + elements.append(ComputeMultiplicity("#cdata-section |\w* ", infos)) elif element["type"] == CHOICE: choices = [] for infos in element["choices"]: @@ -1400,6 +1402,7 @@ structure_model = re.compile("(%s)$" % structure_pattern) result = structure_model.match(children_structure) if not result: + print structure_model.pattern, children_structure 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"):