Please log a bug in our issue tracker.
thanks,
dims
On 9/25/06, Dave MacLean <[EMAIL PROTECTED]> wrote:
Hello there,
We're using the XmlSchema library to "simplify" some of our XSDs so that
they appear in a nicer format when included in WSDL files for our
exposed web services. When writing a utility to manage the
simplification process, I ran into a minor bug in XmlSchema. If an
enumeration is present that contains id values, the id values are lost
when parsed:
<xs:simpleType name="RoleEnum">
<xs:restriction base="xs:string">
<xs:enumeration value="ADVANCED"
id="RoleEnum_0"/>
<xs:enumeration value="NO_ACCESS"
id="RoleEnum_1"/>
<xs:enumeration value="VIEW"
id="RoleEnum_2"/>
</xs:restriction>
</xs:simpleType>
Just as an example. When parsed, the "facet" objects representing the
enum values will have an empty "id" string.
To fix this, I added the following code to XmlSchemaFacet.java (new code
is in bold):
public static XmlSchemaFacet construct(Element el) {
String name = el.getLocalName();
boolean fixed = false;
if (el.getAttribute("fixed").equals("true")) {
fixed = true;
}
XmlSchemaFacet facet;
if (name.equals("enumeration")) {
facet = new XmlSchemaEnumerationFacet();
} else if (name.equals("fractionDigits")) {
facet = new XmlSchemaFractionDigitsFacet();
} else if (name.equals("length")) {
facet = new XmlSchemaLengthFacet();
} else if (name.equals("maxExclusive")) {
facet = new XmlSchemaMaxExclusiveFacet();
} else if (name.equals("maxInclusive")) {
facet = new XmlSchemaMaxInclusiveFacet();
} else if (name.equals("maxLength")) {
facet = new XmlSchemaMaxLengthFacet();
} else if (name.equals("minLength")) {
facet = new XmlSchemaMinLengthFacet();
} else if (name.equals("minExclusive")) {
facet = new XmlSchemaMinExclusiveFacet();
} else if (name.equals("minInclusive")) {
facet = new XmlSchemaMinInclusiveFacet();
} else if (name.equals("pattern")) {
facet = new XmlSchemaPatternFacet();
} else if (name.equals("totalDigits")) {
facet = new XmlSchemaTotalDigitsFacet();
} else if (name.equals("whiteSpace")) {
facet = new XmlSchemaWhiteSpaceFacet();
} else {
throw new XmlSchemaException("Incorrect facet with name \""
+ name + "\" found.");
}
if (el.hasAttribute("id"))
{
facet.setId(el.getAttribute("id"));
}
facet.setFixed(fixed);
facet.setValue(el.getAttribute("value"));
return facet;
}
This seems like the correct fix. Is it possible to get this fix added
for future XmlSchema releases?
The source I modified was the packaged XmlSchema-1.1 source.
Thanks in advance,
Dave
--
Davanum Srinivas : http://www.wso2.net (Oxygen for Web Service Developers)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]