Hi,
It seems there is a bug in XmlSchemaSerializer from version 1.3.1 when
dealing with appInfo annotations which markup contains attributes and
sub-elements.
Instead of getting a serialized XML fragment like so:
<xs:annotation>
<xs:appinfo>
<jaxb:globalBindings generateIsSetMethod="true"/>
<jaxb:schemaBindings>
<jaxb:package name="com.legstar.test.coxb.lsfileal"/>
</jaxb:schemaBindings>
</xs:appinfo>
</xs:annotation>
I am getting this:
<xs:annotation>
<xs:appinfo>
<jaxb:globalBindings/>
<jaxb:schemaBindings/>
</xs:appinfo>
</xs:annotation>
As you can see, attributes and inner-elements are not processed.
I traced back the issue to appendElement method where the following code:
parent.appendChild(el);
NamedNodeMap attributes = el.getAttributes();
//check if child node has attribute
//create new element and append it if found
int attributeLength = attributes.getLength();
for (int i = 0; i < attributeLength; i++) {
Node n = attributes.item(i);
//assuming attributes got to throw exception if not later
el.setAttribute(n.getNodeName(),
n.getNodeValue());
}
//check any descendant of this node
//if there then append its child
NodeList decendants = el.getChildNodes();
int decendantLength = decendants.getLength();
should probably read like this:
parent.appendChild(el);
NamedNodeMap attributes = elTmp.getAttributes();
//check if child node has attribute
//create new element and append it if found
int attributeLength = attributes.getLength();
for (int i = 0; i < attributeLength; i++) {
Node n = attributes.item(i);
//assuming attributes got to throw exception if not later
el.setAttribute(n.getNodeName(),
n.getNodeValue());
}
//check any descendant of this node
//if there then append its child
NodeList decendants = elTmp.getChildNodes();
int decendantLength = decendants.getLength();
Can anyone confirm if this is a known issue and how to get it fixed?
Thanks.
Fady