Hi, I am currently using dom4j to parse an xml document. The problem is - in my xml schema (.xsd) file I am specifying a default value for an attribute i.e.: <xs:attribute name="attr01" type="xs:string" default="some value"/> Then in my .xml which is based on the .xsd i.e.: <foo attr01="why does the one below not default to 'some value'"> <bar>This foo has an attr01 set</bar> </foo> <foo> <bar>This foo has no attr01, why doesn't it get the default?</bar> </foo> When I parse this .xml in dom4j iterating thru the attributes of the foo elements - it doesn't give me the default value in the second foo element. I think I can understand this as dom4j doesn't seem to be tied to the schema really. So the question is how can I parse an .xml doc and retain default values that were specified in schemas for certain attributes? I would like to use dom4j to do this, but I would be open to others. (BTW, I have already successfully done it with jaxb - but I don't think I want to use that method due to other constraints of my application). Many Thanks!
I am going down to the lab. Do NOT let anyone in. Not even this tiny ad: