Interestingly, roundtripping a file, IN:
Using xml Syntax Highlighting
<wp:docPr id="54" name="Diagramm 54"
descr="desc1"
title="title1"/>
Parsed in 0.000 seconds, using
GeSHi 1.0.8.4
becomes OUT:
Using xml Syntax Highlighting
<wp:docPr descr="desc1"
name="Diagramm 54" id="54"/>
Parsed in 0.000 seconds, using
GeSHi 1.0.8.4
so the element is correctly written to the correct namespace, but @title is lost. org.docx4j.dml.wordprocessingDrawing.Inline contains field org.docx4j.dml.CTNonVisualDrawingProps docPr, which doesn't contain a title field, which explains that.
But it is not clear to me how JAXB manages to get the namespace right? I though xsd:import kept the element in its original namespace (ie drawingml/2006/main) as opposed to moving it to wp:. If that's correct, how does JAXB know what to do when it encounters this element in the wp namespace? Looks like it is just happily assuming that namespace, since the reference is from there, and there is no field annotation which tells it to use a different namespace. (So, did xjc do the right thing in writing this element without a field annotation, or not?)