private void expandRelatedAttributeComponents(XSAttributeDeclaration decl, Vector componentList, String namespace, Hashtable dependencies) { addRelatedType(decl.getTypeDefinition(), componentList, namespace, dependencies); /*final XSComplexTypeDefinition enclosingType = decl.getEnclosingCTDefinition(); if (enclosingType != null) { addRelatedType(enclosingType, componentList, namespace, dependencies); }*/ }
public TypeDefinition lookupAttributeDeclaration(String namespace, String attributeName) { XSAttributeDeclaration ad = _schema.getAttributeDeclaration(attributeName, namespace); return XercesTypeDefinition.createTypeDefinition(ad.getTypeDefinition()); }
private void addElidedComponents(XSObject sourceComponent) { // these are the components returned from the term() accessor whose component-kind() is equal to xscd:model-group // currentComponents.size() gets changed in each iteration for (int i = currentComponents.size() - 1; i < currentComponents.size(); ++i) { term((XSObject)currentComponents.get(i), XSConstants.MODEL_GROUP, SCDParser.WILDCARD, currentComponents); } switch (sourceComponent.getType()) { case XSConstants.ELEMENT_DECLARATION: { XSObject typeDef = ((XSElementDeclaration)sourceComponent).getTypeDefinition(); if (typeDef != null && !currentComponents.contains(typeDef)) { currentComponents.add(typeDef); } } break; case XSConstants.ATTRIBUTE_DECLARATION: { XSObject typeDef = ((XSAttributeDeclaration)sourceComponent).getTypeDefinition(); if (typeDef != null && !currentComponents.contains(typeDef)) { currentComponents.add(typeDef); } } break; } // TODO: we dont have type alternative for now. } // getElidedComponents()
private ATreeNode( XSAttributeDeclaration attrDeclaration ) throws OdaException { this(); this.attr = attrDeclaration; this.value = this.attr.getName( ); this.type = ATTRIBUTE_TYPE; this.dataType = getDataType( attrDeclaration.getTypeDefinition( ) .getName( ) ); }
public String write(XSAttributeDeclaration decl) XSTypeDefinition xst = decl.getTypeDefinition(); if (xst == null) throw MESSAGES.illegalNullArgument("Type xst");
private List<Schema.Field> createFields(XSComplexTypeDefinition type) { final Map<String, Schema.Field> fields = new LinkedHashMap<>(); XSObjectList attrUses = type.getAttributeUses(); for (int i = 0; i < attrUses.getLength(); i++) { XSAttributeUse attrUse = (XSAttributeUse) attrUses.item(i); XSAttributeDeclaration attrDecl = attrUse.getAttrDeclaration(); boolean optional = !attrUse.getRequired(); Schema.Field field = createField(fields.values(), attrDecl, attrDecl.getTypeDefinition(), optional, false); fields.put(field.getProp(Source.SOURCE), field); } XSParticle particle = type.getParticle(); if (particle == null) return new ArrayList<>(fields.values()); XSTerm term = particle.getTerm(); if (term.getType() != XSConstants.MODEL_GROUP) throw new ConverterException("Unsupported term type " + term.getType()); XSModelGroup group = (XSModelGroup) term; createGroupFields(group, fields, false); return new ArrayList<>(fields.values()); }
String value = xmlStream.getAttributeValue( i ); PrimitiveValue xmlValue = new PrimitiveValue( value, new PrimitiveType( attrDecl.getTypeDefinition() ) ); attrs.put( name, xmlValue );
private void processAttribute(Path parent, String path, XSAttributeUse xsAttribute) throws BagriException { path += "/@" + xsAttribute.getAttrDeclaration().getName(); XSSimpleTypeDefinition std = xsAttribute.getAttrDeclaration().getTypeDefinition(); Occurrence occurrence = Occurrence.getOccurrence( xsAttribute.getRequired() ? 1 : 0, std.getVariety() == XSSimpleTypeDefinition.VARIETY_LIST ? -1 : 1); Path xp = modelMgr.translatePath(parent.getRoot(), path, NodeKind.attribute, parent.getPathId(), getBaseType(std), occurrence); logger.trace("processAttribute; attribute: {}; type: {}; got XDMPath: {}", path, std, xp); }
xsAttrUse.getAttrDeclaration().getTypeDefinition(), types))
xsAttrUse.getAttrDeclaration().getTypeDefinition(), types))
public static boolean checkComplexType(XSTypeDefinition td) { if (td.getTypeCategory() != XSTypeDefinition.COMPLEX_TYPE) { return false; } XSComplexTypeDefinition ctd = (XSComplexTypeDefinition) td; if (ctd.getContentType() == XSComplexTypeDefinition.CONTENTTYPE_ELEMENT) { return true; } if ((td instanceof XSComplexTypeDecl) && ((XSComplexTypeDecl) td).getAbstract()) { return true; } if (TEXT_ELEMENTS_ARE_COMPLEX) { return true; } if (ctd.getAttributeUses() != null) { for (int i = 0; i < ctd.getAttributeUses().getLength(); i++) { XSSimpleTypeDefinition xsstd = ((XSAttributeUse) ctd.getAttributeUses().item(i)).getAttrDeclaration() .getTypeDefinition(); if ("ID".equals(xsstd.getName())) { continue; } return true; } } return false; }
ValueReference path = new ValueReference( "@" + getName( attrName ), nsContext ); DBField dbField = new DBField( attrMc.getTable(), attrMc.getColumn() ); PrimitiveType pt = new PrimitiveType( attrDecl.getTypeDefinition() ); particles.add( new PrimitiveMapping( path, !attrUse.getRequired(), dbField, pt, null, null ) );
new PrimitiveType( attrDecl.getTypeDefinition() ) ); attrs.put( name, xmlValue );
return new Pair<PrimitiveType, Boolean>( new PrimitiveType( attrUse.getAttrDeclaration().getTypeDefinition() ), !attrUse.getRequired() );
ValueReference path = new ValueReference( "@" + getName( attrName ), nsContext ); DBField dbField = new DBField( attrMc.getTable(), attrMc.getColumn() ); PrimitiveType pt = new PrimitiveType( attrDecl.getTypeDefinition() ); particles.add( new PrimitiveMapping( path, !attrUse.getRequired(), dbField, pt, null, null ) );
public static boolean checkEnumType(XSTypeDefinition td) { final XSSimpleTypeDefinition st; if (td.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) { XSComplexTypeDefinition ctd = (XSComplexTypeDefinition) td; if (ctd.getContentType() != XSComplexTypeDefinition.CONTENTTYPE_SIMPLE) { return false; } if (ctd.getAttributeUses() != null) { for (int i = 0; i < ctd.getAttributeUses().getLength(); i++) { XSSimpleTypeDefinition xsstd = ((XSAttributeUse) ctd.getAttributeUses() .item(i)).getAttrDeclaration() .getTypeDefinition(); if ("ID".equals(xsstd.getName())) { continue; } return false; } } st = ctd.getSimpleType(); } else if (td.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) { st = (XSSimpleTypeDefinition) td; } else { return false; } return st.getLexicalEnumeration() != null && st.getLexicalEnumeration().getLength() != 0; }
ctd.setName(o.getName() + Util.ANONYMOUS_ELEM_TYPE_SUFFIX); } else if (o instanceof XSAttributeDeclaration) { final XSSimpleTypeDecl ctd1 = (XSSimpleTypeDecl) ((XSAttributeDeclaration) o).getTypeDefinition(); final XSObjectListImpl annotations = ctd1.getAnnotations() instanceof XSObjectListImpl ? (XSObjectListImpl) ctd1.getAnnotations()
private void preProcessXSAttributeUse(XSAttributeUse attr) throws Exception { XSAttributeDeclaration decl = attr.getAttrDeclaration(); String sampleValue = null; switch (attr.getConstraintType()) { case XSConstants.VC_FIXED: if (RandomUtil.randomBoolean(config.generateFixedAttributes)) { sampleValue = attr.getValueConstraintValue().getNormalizedValue(); } break; case XSConstants.VC_DEFAULT: if (RandomUtil.randomBoolean(config.generateDefaultAttributes)) { sampleValue = attr.getValueConstraintValue().getNormalizedValue(); } break; default: if (attr.getRequired() || RandomUtil.randomBoolean(config.generateOptionalAttributes)) { if (sampleValue == null) { sampleValue = generateSampleValue(config, decl.getTypeDefinition(), decl.getName(), counters); } } } if (sampleValue != null) { doc.addAttribute(decl.getNamespace(), decl.getName(), sampleValue); } }
QName attrName = new QName(attr.getNamespace(), attr.getName()); XSSimpleTypeDefinition attrType = attr.getTypeDefinition(); TypeBinding typeBinding = bindSimpleType(attrType);
case XSConstants.ATTRIBUTE_DECLARATION: { if (NO_FILTER == filter || XSConstants.TYPE_DEFINITION == filter) { addComponent(((XSAttributeDeclaration)sourceComponent).getTypeDefinition(), nameTest, targetComponents);