Refine search
public void elementDecl(XSElementDecl decl) { if(check(decl)) { decl.getType().visit(this); for( XSIdentityConstraint id : decl.getIdentityConstraints() ) id.visit(this); } }
public void elementDecl(XSElementDecl decl) { if (decl.isLocal()) { SchemaTreeTraverser.this.elementDecl(decl, extraAtts); } else { // reference SchemaTreeNode newNode = new SchemaTreeNode(MessageFormat .format("Element ref=\"'{'{0}'}'{1}\"{2}", new Object[]{decl.getTargetNamespace(), decl.getName(), extraAtts}), decl.getLocator()); currNode.add(newNode); } }
private QName getSubstitutionHead(XSElementDecl element) { XSElementDecl head = element.getSubstAffiliation(); if (head == null) { return null; } else { return new QName(head.getTargetNamespace(), head.getName()); } }
public void elementDecl( XSElementDecl decl ) { if(decl.isLocal()) SchemaWriter.this.elementDecl(decl,extraAtts); else { // reference println(MessageFormat.format("<element ref=\"'{'{0}'}'{1}\"{2}/>", decl.getTargetNamespace(), decl.getName(), extraAtts)); } } public void modelGroupDecl( XSModelGroupDecl decl ) {
/** * ignore case where xsd:nillable is recognized as false by xsom (we don't know if it's not specified and we want to * preserve a default value to true. Therefore, we provide a custom attribute nxs:nillable to force nillable as * false) NB: if xsd:nillable is present and sets to true, deducted value will be true even if nxs:nillable is false * * @since 7.1 */ protected static boolean isNillable(XSElementDecl element) { String value = element.getForeignAttribute(NAMESPACE_CORE_VALIDATION, "nillable"); return element.isNillable() || value == null || Boolean.parseBoolean(value); }
XSTerm t = p.getTerm(); if(t.isElementDecl()) return makeJavaName(p,t.asElementDecl().getName()); if(t.isModelGroupDecl()) return makeJavaName(p,t.asModelGroupDecl().getName()); if(t.isModelGroup()) { try { return getSpecDefaultName(t.asModelGroup(),p.isRepeated()); } catch( ParseException e ) {
/** * Creates node for element declaration with additional attributes. * * @param decl Element declaration. * @param extraAtts Additional attributes. */ private void elementDecl(XSElementDecl decl, String extraAtts) { XSType type = decl.getType(); // TODO: various other attributes String str = MessageFormat.format("Element name=\"{0}\"{1}{2}", new Object[]{ decl.getName(), type.isLocal() ? "" : " type=\"{" + type.getTargetNamespace() + "}" + type.getName() + "\"", extraAtts}); SchemaTreeNode newNode = new SchemaTreeNode(str, decl.getLocator()); this.currNode.add(newNode); this.currNode = newNode; if (type.isLocal()) { if (type.isLocal()) { type.visit(this); } } this.currNode = (SchemaTreeNode) this.currNode.getParent(); }
XSParticle p; if (term != null && term.isModelGroup()) { modelGroup = term.asModelGroup(); if (XSModelGroup.CHOICE.equals(modelGroup.getCompositor())) { goingup = false; if (term.asElementDecl().getType().getName() == null) { final String typeName = processType(term .asElementDecl().getType(), term .asElementDecl().getName(), xss); String ns = null; if (map.containsKey(typeName)) { ns = map.get(typeName).getNamespace(); st.addField(term.asElementDecl().getName(), ns, typeName, (goingup && p.getMinOccurs() .intValue() != 0), p.getMaxOccurs() .intValue() != 1, term.asElementDecl() .getFixedValue(), xsdMapping); } else { st.addField(term.asElementDecl().getName(), term.asElementDecl().getType() .getTargetNamespace(), term .asElementDecl().getType().getName(), .asElementDecl().getFixedValue(), xsdMapping);
/** * Gets the {@link BIDom} object that applies to the given particle. */ protected final BIDom getLocalDomCustomization( XSParticle p ) { if (p == null) { return null; } BIDom dom = getBindInfo(p).get(BIDom.class); if(dom!=null) return dom; // if not, the term might have one. dom = getBindInfo(p.getTerm()).get(BIDom.class); if(dom!=null) return dom; XSTerm t = p.getTerm(); // type could also have one, in case of the dom customization if(t.isElementDecl()) return getBindInfo(t.asElementDecl().getType()).get(BIDom.class); // similarly the model group in a model group definition may have one. if(t.isModelGroupDecl()) return getBindInfo(t.asModelGroupDecl().getModelGroup()).get(BIDom.class); return null; }
private void getElementsRecursively(String path, Map<XsdNode, Object> hm, XSParticle xsParticle) { if (xsParticle != null) { XSTerm term = xsParticle.getTerm(); if (term.isElementDecl()) { final XSElementDecl xsElementDecl = term.asElementDecl(); final String xsElementDeclName = xsElementDecl.getName(); path = path + "/" + xsElementDeclName; XSComplexType xsComplexType = xsElementDecl.getType().asComplexType(); if (xsElementDecl.getType().isSimpleType()) { final Map<XsdNode, Object> subMap = new LinkedHashMap<XsdNode, Object>(1); subMap.put(new XsdNode(path, XsdNodeType.TEXT, XsdNodeCardinality.ONCE_EXACTLY), null); if (((ComplexTypeImpl) xsComplexType).getType().getBaseType().getName().equalsIgnoreCase("string")) { newHm.put(new XsdNode(path, XsdNodeType.TEXT, XsdNodeCardinality.ONCE_EXACTLY), null); } else if (term.isModelGroup()) { XSModelGroup model = term.asModelGroup(); XSParticle[] parr = model.getChildren();
public CElement elementDecl(XSElementDecl decl) { CElement r = allow(decl,decl.getName()); CCustomizations custs = builder.getBindInfo(decl).toCustomizationList(); if(decl.isGlobal()) { if(isCollapsable(decl)) { return selector.bindToType(decl.getType().asComplexType(),decl,true); } else { String className = null; model, tagName, selector.getClassScope(), className, custs, decl.getLocator()); selector.boundElements.put(decl,cei); cei.initContentType( selector.bindToType(decl.getType(),decl), decl, decl.getDefaultValue() ); stb.refererStack.pop(); r = cei; XSElementDecl top = decl.getSubstAffiliation(); if(top!=null) { CElement topci = selector.bindToType(top,decl);
protected ListType createListType(Schema schema, String name, XSParticle particle) throws TypeBindingException { XSElementDecl element = particle.getTerm().asElementDecl(); if (element == null) { log.warn("Ignoring " + name + " unsupported list type"); Type type = loadType(schema, element.getType(), name + '#' + element.getName()); if (type == null) { log.warn("Unable to find type for " + element.getName()); return null; XmlString dv = element.getDefaultValue(); String defValue = null; if (dv != null) { dv = element.getFixedValue(); if (dv != null) { defValue = dv.value; return new ListTypeImpl(schema.getName(), name, type, element.getName(), defValue, flags, constraints, particle.getMinOccurs().intValue(), particle.getMaxOccurs().intValue());
public boolean isOptional(final String elementName) { for (final Entry<String, XSComplexType> entry : getComplexTypes().entrySet()) { final XSContentType content = entry.getValue().getContentType(); final XSParticle particle = content.asParticle(); if (null != particle) { final XSTerm term = particle.getTerm(); if (term.isModelGroup()) { final XSParticle[] particles = term.asModelGroup().getChildren(); for (final XSParticle p : particles) { final XSTerm pterm = p.getTerm(); if (pterm.isElementDecl()) { final XSElementDecl e = pterm.asElementDecl(); if (0 == e.getName().compareToIgnoreCase(elementName)) { return p.getMinOccurs() == 0; } } } } } } return true; }
XSType type = decl.getType(); if(!type.isComplexType()) return false; // not a complex type if(decl.getSubstitutables().size()>1 || decl.getSubstAffiliation()!=null) if(decl.isNillable()) if( getGlobalBinding().isSimpleMode() && decl.isGlobal()) { XSElementDecl referer = getSoleElementReferer(decl.getType()); if(referer!=null) { assert referer==decl; // I must be the sole referer if(!type.isLocal() || !type.isComplexType()) return false;
private void processTermElement(JFieldVar fieldVar, XSElementDecl element, List<FacetCustomization> customizations) { XSType elementType = element.getType(); if (elementType.isComplexType()) { validAnnotate(fieldVar); if (!element.isNillable()) notNullAnnotate(fieldVar); if (elementType.getBaseType().isSimpleType()) processSimpleType(elementType.getBaseType().asSimpleType(), fieldVar, customizations); } else processSimpleType(elementType.asSimpleType(), fieldVar, customizations); }
private void convertElement(String mainURI, XSElementDecl element, OntClass parent) { XSType elementType = element.getType(); String URI = getURI(mainURI, element); OntClass elementClass = null; if (element.isGlobal()) { if (elementType.isSimpleType()) { elementClass = convertSimpleType(mainURI, elementType.asSimpleType(), URI); } else if (elementType.isComplexType()) { elementClass = convertComplexType(mainURI, elementType.asComplexType(), URI); } } XSElementDecl subs = element.getSubstAffiliation(); if (subs != null && elementClass != null) { OntClass subsClass = ontology.createClass(getURI(mainURI, subs)); LOGGER.debug("Adding superclass: {}", subsClass); subsClass.addSubClass(elementClass); } } // mainURI is schema-specific
@Override public void elementDecl(XSElementDecl decl) { if (localName.equals(decl.getName()) && schema.getTargetNamespace().equals(decl.getTargetNamespace())) elements.add(new ElementDecl(decl, Schema.this)); if (decl.getType().isLocal() && shouldWalk() && addToVisited(decl.getType())) decl.getType().visit(this); }
/** * Determines if the given component needs to have a value * constructor (a constructor that takes a parmater.) on ObjectFactory. */ private boolean needValueConstructor( XSComponent sc ) { if(!(sc instanceof XSElementDecl)) return false; XSElementDecl decl = (XSElementDecl)sc; if(!decl.getType().isSimpleType()) return false; return true; }
/** * The whole type set can be later bound to a reference property, * in which case we need to generate additional code to wrap this * type reference into an element class. * * This method generates such an element class and returns it. */ protected void toElementRef(CReferencePropertyInfo prop) { CClassInfo scope = Ring.get(ClassSelector.class).getCurrentBean(); Model model = Ring.get(Model.class); CCustomizations custs = Ring.get(BGMBuilder.class).getBindInfo(decl).toCustomizationList(); if(target instanceof CClassInfo && Ring.get(BIGlobalBinding.class).isSimpleMode()) { CClassInfo bean = new CClassInfo(model,scope, model.getNameConverter().toClassName(decl.getName()), decl.getLocator(), null, BGMBuilder.getName(decl), decl, custs); bean.setBaseClass((CClassInfo)target); prop.getElements().add(bean); } else { CElementInfo e = new CElementInfo(model,BGMBuilder.getName(decl),scope,target, decl.getDefaultValue(), decl, custs, decl.getLocator()); prop.getElements().add(e); } }
public Iterator<XSComponent> elementDecl(XSElementDecl decl) { XSComplexType ct = decl.getType().asComplexType(); if(ct==null) return empty(); else { // also pick up model groups inside this complex type return new Iterators.Union<XSComponent>(singleton(ct),complexType(ct)); } }