Skip to content

Commit

Permalink
fixed missing "t" namespace definition for connector schema
Browse files Browse the repository at this point in the history
  • Loading branch information
1azyman committed Dec 1, 2023
1 parent fd83077 commit 14a9a0d
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ private XmlFile buildIcfSchema(MidPointObject object) {

Document doc = DOMUtil.getDocument(DOMUtil.XSD_SCHEMA_ELEMENT);
Element schema = doc.getDocumentElement();
schema.setAttribute("xmlns:t", SchemaConstantsGenerated.NS_TYPES);
schema.setAttribute("xmlns:a", SchemaConstantsGenerated.NS_ANNOTATION);
schema.setAttribute("xmlns:icfc", SchemaConstantsGenerated.NS_ICF_CONFIGURATION);
schema.setAttribute("xmlns:con", importNamespace);
Expand Down Expand Up @@ -167,6 +168,10 @@ private XmlFile buildConnectorSchema(MidPointObject object) {
String connector = object.getContent();
Element xsdSchema = getXsdSchema(connector);

if (StringUtils.isBlank(xsdSchema.getAttribute("xmlns:t"))) {
xsdSchema.setAttribute("xmlns:t", SchemaConstantsGenerated.NS_TYPES);
}

List<Element> elements = DOMUtil.getChildElements(xsdSchema, new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "element"));
Optional<Element> connectorConfiguration = elements.stream().filter(e -> "connectorConfiguration".equals(DOMUtil.getAttribute(e, "name"))).findFirst();
connectorConfiguration.ifPresent(e -> xsdSchema.removeChild(e));
Expand Down

0 comments on commit 14a9a0d

Please sign in to comment.