@Override protected String getKey(ComponentDefinition item) { return item.getTag(); }
protected boolean validateParent(BaseComponent parent) { return parent == null || componentDefinition.isParentTag(parent.componentDefinition.getTag()); }
private void addChildElement(Element seq, ComponentDefinition childDef, ComponentDefinition parentDef, Cardinality card) { if (childDef.getTag().startsWith("#")) { return; } if (childDef != null && !childDef.isParentTag(parentDef.getTag())) { return; } Element child = createElement("element", seq, "ref", childDef.getTag()); child.setAttribute("minOccurs", Integer.toString(card.getMinimum())); if (card.hasMaximum()) { child.setAttribute("maxOccurs", Integer.toString(card.getMaximum())); } else { child.setAttribute("maxOccurs", "unbounded"); } }
private void addChild(PageElement child) { if (children == null) { children = new ArrayList<>(); childCounts = new HashMap<>(); } if (getDefinition() == null) { children.add(child); return; } String childTag = child.getDefinition().getTag(); Integer count = childCounts.getOrDefault(childTag, 0); getDefinition().validateChild(child.getDefinition(), () -> count); children.add(child); childCounts.put(childTag, count + 1); }
throw new RuntimeException("Text content is not allowed for tag " + parentDef.getTag());