gitlab #3
Change-Id: I1968b61f24a3227a3a3634580fa63e3123b2c2c0
-source.. = src/\r
-output.. = bin/\r
-bin.includes = META-INF/,\\r
- .,\\r
- adapters.xml\r
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ adapters.xml,\
+ scl/
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
- private boolean useElementNSforAttributes = true; // If true, attributes with undefined namespace are written to the same name space as teh element. If false. the attributes are written to the root namespace.
- private boolean ignoreAttributeNS = true; // Completely ignore attribute namespaces. When true, all attributes are written to the elements.
+ private boolean useElementNSforAttributes = true; // If true, attributes with undefined namespace are written to the same name space as the element. If false. the attributes are written to the root namespace.
+ private boolean ignoreAttributeNS = false; // Completely ignore attribute namespaces. When true, all attributes are written to the elements.
+ private String ignorePattern = "(\\w)*"; // Ignore attribute namespaces. When pattern exists, and local name of a attribute matches the regexp, the interpreted namespace is ignored.
+ private boolean nonStandardBooleans = false; // Accept non standard boolean values (True, False).
org.w3._2001.xmlschema.Attribute schemaAttribute = updateAttributeType(localAttribute, newType);
String attrNs = getNS(attribute, currentNS);
org.w3._2001.xmlschema.Attribute schemaAttribute = updateAttributeType(localAttribute, newType);
String attrNs = getNS(attribute, currentNS);
- if (!ignoreAttributeNS && attribute.getName().getNamespaceURI().length() > 0) {
+ if (!ignoreAttributeNs(attribute) && attribute.getName().getNamespaceURI().length() > 0) {
// Attribute has explicit ns definition.
if (localAttribute.getRef() != null) {
// current local attribute is reference, check that the namespaces match
// Attribute has explicit ns definition.
if (localAttribute.getRef() != null) {
// current local attribute is reference, check that the namespaces match
}
private String getNS(Attribute attribute, String currentNS) {
}
private String getNS(Attribute attribute, String currentNS) {
+ if (ignoreAttributeNs(attribute))
return currentNS;
String attrNs = attribute.getName().getNamespaceURI();
if (attrNs.length() == 0) {
return currentNS;
String attrNs = attribute.getName().getNamespaceURI();
if (attrNs.length() == 0) {
+
+ private boolean ignoreAttributeNs(Attribute attribute) {
+ if (ignoreAttributeNS)
+ return true;
+
+
+ if (ignorePattern != null) {
+ return attribute.getName().getLocalPart().matches(ignorePattern);
+ }
+ return false;
+ }
+
+
private org.w3._2001.xmlschema.Attribute addAttribute(Attribute attribute, ComplexType complexType, String currentNS) {
String attrNs = getNS(attribute, currentNS);
String attrName = attribute.getName().getLocalPart();
private org.w3._2001.xmlschema.Attribute addAttribute(Attribute attribute, ComplexType complexType, String currentNS) {
String attrNs = getNS(attribute, currentNS);
String attrName = attribute.getName().getLocalPart();
private QName getType(String value) {
private QName getType(String value) {
- if ("true".equals(value) || "false".equals(value)) // || "1".equals(value) || "0".equals(value))
- return new QName(SchemaConversionBase.SCHEMA_NS, "boolean");
+ if (!nonStandardBooleans) {
+ if ("true".equals(value) || "false".equals(value)) // || "1".equals(value) || "0".equals(value))
+ return new QName(SchemaConversionBase.SCHEMA_NS, "boolean");
+ } else {
+ if ("true".equalsIgnoreCase(value) || "false".equalsIgnoreCase(value)) {
+ return new QName(SchemaConversionBase.SCHEMA_NS, "boolean");
+ }
+ }
try {
Integer.parseInt(value);
return new QName(SchemaConversionBase.SCHEMA_NS, "integer");
try {
Integer.parseInt(value);
return new QName(SchemaConversionBase.SCHEMA_NS, "integer");
return obj.getLibShortName()+"."+getAttributeGroupPrefix()+rel+obj.getName();
case SIMPLE_TYPE:
return obj.getLibShortName()+"."+getSimpleTypePrefix()+rel+obj.getName();
return obj.getLibShortName()+"."+getAttributeGroupPrefix()+rel+obj.getName();
case SIMPLE_TYPE:
return obj.getLibShortName()+"."+getSimpleTypePrefix()+rel+obj.getName();
+ case ATTRIBUTE:
+ return obj.getLibShortName()+"."+rel+obj.getName();
}
} else {
SchemaObject o = obj;
}
} else {
SchemaObject o = obj;
return obj.getLibShortName()+"."+getAttributeGroupPrefix()+rel+name;
case SIMPLE_TYPE:
return obj.getLibShortName()+"."+getSimpleTypePrefix()+rel+name;
return obj.getLibShortName()+"."+getAttributeGroupPrefix()+rel+name;
case SIMPLE_TYPE:
return obj.getLibShortName()+"."+getSimpleTypePrefix()+rel+name;
+ case ATTRIBUTE:
+ return obj.getLibShortName()+"."+rel+obj.getName();
}
}
throw new RuntimeException();
}
}
throw new RuntimeException();
import org.w3._2001.xmlschema.Attribute;
import org.w3._2001.xmlschema.AttributeGroup;
import org.w3._2001.xmlschema.ComplexContent;
import org.w3._2001.xmlschema.Attribute;
import org.w3._2001.xmlschema.AttributeGroup;
import org.w3._2001.xmlschema.ComplexContent;
+import org.w3._2001.xmlschema.ComplexRestrictionType;
import org.w3._2001.xmlschema.ComplexType;
import org.w3._2001.xmlschema.Element;
import org.w3._2001.xmlschema.ExplicitGroup;
import org.w3._2001.xmlschema.ComplexType;
import org.w3._2001.xmlschema.Element;
import org.w3._2001.xmlschema.ExplicitGroup;
QName type = extensionType.getBase();
return type;
}
QName type = extensionType.getBase();
return type;
}
+ ComplexRestrictionType restriction = complexContent.getRestriction();
+ if (restriction != null)
+ return restriction.getBase();
+ }
+ if (complexType.isMixed()) {
+ // Handle characters data of mixed ComplexType as String.
+ return new QName(SCHEMA_NS, "string");