com.sun.xml.xsom.XSComplexType Java Examples
The following examples show how to use
com.sun.xml.xsom.XSComplexType.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GroupInterfaceGenerator.java From jaxb2-rich-contract-plugin with MIT License | 6 votes |
private static Collection<? extends XSDeclaration> findModelGroups(final XSComplexType complexType) { XSContentType contentType = complexType.getExplicitContent(); if (contentType == null) { contentType = complexType.getContentType(); } final XSParticle particle = contentType.asParticle(); if (particle != null && !particle.isRepeated()) { final XSTerm term = particle.getTerm(); if (term instanceof XSModelGroupDecl) { return Collections.singletonList((XSModelGroupDecl)term); } else { final XSModelGroup modelGroup = term.asModelGroup(); return modelGroup != null ? findModelGroups(modelGroup) : Collections.<XSModelGroupDecl>emptyList(); } } else { return Collections.emptyList(); } }
Example #2
Source File: ComplexTypeImpl.java From jolie with GNU Lesser General Public License v2.1 | 6 votes |
public Iterator<XSAttributeUse> iterateAttributeUses() { XSComplexType baseType = getBaseType().asComplexType(); if( baseType==null ) return super.iterateAttributeUses(); return new Iterators.Union<XSAttributeUse>( new Iterators.Filter<XSAttributeUse>(baseType.iterateAttributeUses()) { protected boolean matches(XSAttributeUse value) { XSAttributeDecl u = value.getDecl(); UName n = new UName(u.getTargetNamespace(),u.getName()); return !prohibitedAtts.contains(n); } }, super.iterateAttributeUses() ); }
Example #3
Source File: Util.java From jolie with GNU Lesser General Public License v2.1 | 6 votes |
/** * Implements * <code>Validation Rule: Schema-Validity Assessment (Element) 1.2.1.2.4</code> */ private static boolean isSubstitutable( XSType _base, XSType derived ) { // too ugly to the point that it's almost unbearable. // I mean, it's not even transitive. Thus we end up calling this method // for each candidate if( _base.isComplexType() ) { XSComplexType base = _base.asComplexType(); for( ; base!=derived; derived=derived.getBaseType() ) { if( base.isSubstitutionProhibited( derived.getDerivationMethod() ) ) return false; // Type Derivation OK (Complex)-1 } return true; } else { // simple type don't have any @block return true; } }
Example #4
Source File: XmlUtils.java From jolie with GNU Lesser General Public License v2.1 | 5 votes |
private static void _valueToDocument( Value value, Element element, Document doc, XSType type ) { addForcedAttribute( value, element ); if( type.isSimpleType() ) { element.appendChild( doc.createTextNode( value.strValue() ) ); } else if( type.isComplexType() ) { String name; Value currValue; XSComplexType complexType = type.asComplexType(); // Iterate over attributes Collection< ? extends XSAttributeUse > attributeUses = complexType.getAttributeUses(); for( XSAttributeUse attrUse : attributeUses ) { name = attrUse.getDecl().getName(); if( (currValue = getAttributeOrNull( value, name )) != null ) { element.setAttribute( name, currValue.strValue() ); } } XSContentType contentType = complexType.getContentType(); XSParticle particle = contentType.asParticle(); if( contentType.asSimpleType() != null ) { element.appendChild( doc.createTextNode( value.strValue() ) ); } else if( particle != null ) { XSTerm term = particle.getTerm(); XSModelGroupDecl modelGroupDecl; XSModelGroup modelGroup = null; if( (modelGroupDecl = term.asModelGroupDecl()) != null ) { modelGroup = modelGroupDecl.getModelGroup(); } else if( term.isModelGroup() ) { modelGroup = term.asModelGroup(); } if( modelGroup != null ) { _valueToDocument( value, element, doc, modelGroup ); } } } }
Example #5
Source File: SchemaWriter.java From citygml4j with Apache License 2.0 | 5 votes |
private void dumpComplexTypeAttribute( XSComplexType type ) { Iterator<?> itr; itr = type.iterateAttGroups(); while(itr.hasNext()) dumpRef( (XSAttGroupDecl)itr.next() ); itr = type.iterateDeclaredAttributeUses(); while(itr.hasNext()) attributeUse( (XSAttributeUse)itr.next() ); XSWildcard awc = type.getAttributeWildcard(); if(awc!=null) wildcard("anyAttribute",awc,""); }
Example #6
Source File: SchemaWriter.java From citygml4j with Apache License 2.0 | 5 votes |
public void schema( XSSchema s ) { // QUICK HACK: don't print the built-in components if(s.getTargetNamespace().equals(Const.schemaNamespace)) return; println(MessageFormat.format("<schema targetNamespace=\"{0}\">", s.getTargetNamespace())); indent++; Iterator<?> itr; itr = s.iterateAttGroupDecls(); while(itr.hasNext()) attGroupDecl( (XSAttGroupDecl)itr.next() ); itr = s.iterateAttributeDecls(); while(itr.hasNext()) attributeDecl( (XSAttributeDecl)itr.next() ); itr = s.iterateComplexTypes(); while(itr.hasNext()) complexType( (XSComplexType)itr.next() ); itr = s.iterateElementDecls(); while(itr.hasNext()) elementDecl( (XSElementDecl)itr.next() ); itr = s.iterateModelGroupDecls(); while(itr.hasNext()) modelGroupDecl( (XSModelGroupDecl)itr.next() ); itr = s.iterateSimpleTypes(); while(itr.hasNext()) simpleType( (XSSimpleType)itr.next() ); indent--; println("</schema>"); }
Example #7
Source File: SchemaWalker.java From citygml4j with Apache License 2.0 | 5 votes |
public void complexType(XSComplexType type) { if (shouldWalk && visited.add(type.getContentType())) { type.getContentType().visit(this); for (XSAttributeUse u : type.getAttributeUses()) if (shouldWalk && visited.add(u)) attributeUse(u); } }
Example #8
Source File: MetaPlugin.java From jaxb2-rich-contract-plugin with MIT License | 5 votes |
@Override public QName complexType(final XSComplexType type) { if (type.getName() == null) { return new QName(type.getTargetNamespace(), "anonymousComplexType"); } else { return new QName(type.getTargetNamespace(), type.getName()); } }
Example #9
Source File: MetaPlugin.java From jaxb2-rich-contract-plugin with MIT License | 5 votes |
@Override public QName complexType(final XSComplexType type) { if (type.getName() == null) { return new QName(type.getTargetNamespace(), "anonymousComplexType"); } else { return new QName(type.getTargetNamespace(), type.getName()); } }
Example #10
Source File: GroupInterfaceGenerator.java From jaxb2-rich-contract-plugin with MIT License | 5 votes |
private static XSComplexType getTypeDefinition(final XSComponent xsTypeComponent) { if (xsTypeComponent instanceof XSAttContainer) { return (XSComplexType) xsTypeComponent; } else if (xsTypeComponent instanceof XSElementDecl) { return ((XSElementDecl) xsTypeComponent).getType().asComplexType(); } else { return null; } }
Example #11
Source File: JumbuneSchemaWriter.java From jumbune with GNU Lesser General Public License v3.0 | 5 votes |
private void dumpComplexTypeAttribute( XSComplexType type ) { Iterator<?> itr; itr = type.iterateAttGroups(); while(itr.hasNext()) dumpRef( (XSAttGroupDecl)itr.next() ); itr = type.iterateDeclaredAttributeUses(); while(itr.hasNext()) attributeUse( (XSAttributeUse)itr.next() ); XSWildcard awc = type.getAttributeWildcard(); if(awc!=null) wildcard("anyAttribute",awc,""); }
Example #12
Source File: Axis.java From jolie with GNU Lesser General Public License v2.1 | 5 votes |
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)); } }
Example #13
Source File: AbstractAxisImpl.java From jolie with GNU Lesser General Public License v2.1 | 5 votes |
public Iterator<T> complexType(XSComplexType type) { // compensate particle XSParticle p = type.getContentType().asParticle(); if(p!=null) return particle(p); else return empty(); }
Example #14
Source File: SchemaWriter.java From jolie with GNU Lesser General Public License v2.1 | 5 votes |
private void dumpComplexTypeAttribute( XSComplexType type ) { Iterator itr; itr = type.iterateAttGroups(); while(itr.hasNext()) dumpRef( (XSAttGroupDecl)itr.next() ); itr = type.iterateDeclaredAttributeUses(); while(itr.hasNext()) attributeUse( (XSAttributeUse)itr.next() ); }
Example #15
Source File: SchemaTreeTraverser.java From jolie with GNU Lesser General Public License v2.1 | 5 votes |
/** * Creates node for complex type. * * @param type Complex type. */ private void dumpComplexTypeAttribute(XSComplexType type) { Iterator itr; itr = type.iterateAttGroups(); while (itr.hasNext()) { dumpRef((XSAttGroupDecl) itr.next()); } itr = type.iterateDeclaredAttributeUses(); while (itr.hasNext()) { attributeUse((XSAttributeUse) itr.next()); } }
Example #16
Source File: SchemaTreeTraverser.java From jolie with GNU Lesser General Public License v2.1 | 5 votes |
public void schema(XSSchema s) { // QUICK HACK: don't print the built-in components if (s.getTargetNamespace().equals(Const.schemaNamespace)) { return; } SchemaTreeNode newNode = new SchemaTreeNode("Schema " + s.getLocator().getSystemId(), s.getLocator()); this.currNode = newNode; this.model.addSchemaNode(newNode); for (XSAttGroupDecl groupDecl : s.getAttGroupDecls().values()) { attGroupDecl(groupDecl); } for (XSAttributeDecl attrDecl : s.getAttributeDecls().values()) { attributeDecl(attrDecl); } for (XSComplexType complexType : s.getComplexTypes().values()) { complexType(complexType); } for (XSElementDecl elementDecl : s.getElementDecls().values()) { elementDecl(elementDecl); } for (XSModelGroupDecl modelGroupDecl : s.getModelGroupDecls().values()) { modelGroupDecl(modelGroupDecl); } for (XSSimpleType simpleType : s.getSimpleTypes().values()) { simpleType(simpleType); } }
Example #17
Source File: XsdToJolieConverterImpl.java From jolie with GNU Lesser General Public License v2.1 | 5 votes |
private TypeDefinition loadComplexType( XSComplexType complexType, boolean lazy, TypeDefinition lazyType ) throws ConversionException { XSParticle particle; XSContentType contentType; contentType = complexType.getContentType(); if( (particle = contentType.asParticle()) == null ) { return null;// createAnyOrUndefined( complexType.getName(), complexType ); } TypeInlineDefinition jolieType; if( lazy ) { jolieType = (TypeInlineDefinition) lazyType; } else { jolieType = createComplexType( complexType, complexType.getName().replace( "-", "_" ) + TYPE_SUFFIX, particle ); } if( contentType.asSimpleType() != null ) { checkStrictModeForSimpleType( contentType ); } else if( (particle = contentType.asParticle()) != null ) { XSTerm term = particle.getTerm(); XSModelGroup modelGroup = getModelGroup( term ); if( modelGroup != null ) { groupProcessing( modelGroup, particle, jolieType ); } } return jolieType; }
Example #18
Source File: XsdToJolieConverterImpl.java From jolie with GNU Lesser General Public License v2.1 | 5 votes |
private TypeInlineDefinition createAnyOrUndefined( String typeName, XSComplexType complexType ) { TypeInlineDefinition jolieType = new TypeInlineDefinition( PARSING_CONTEXT, typeName, NativeType.ANY, Constants.RANGE_ONE_TO_ONE ); if( !complexType.isMixed() ) { jolieType.setUntypedSubTypes( true ); } return jolieType; }
Example #19
Source File: XsdToJolieConverterImpl.java From jolie with GNU Lesser General Public License v2.1 | 5 votes |
private TypeInlineDefinition createComplexType( XSComplexType complexType, String typeName, XSParticle particle ) { if( complexType.isMixed() ) { return new TypeInlineDefinition( PARSING_CONTEXT, typeName, NativeType.ANY, getRange( particle ) ); } else { return new TypeInlineDefinition( PARSING_CONTEXT, typeName, NativeType.VOID, getRange( particle ) ); } }
Example #20
Source File: SchemaSetImpl.java From jolie with GNU Lesser General Public License v2.1 | 5 votes |
public Iterator<XSComplexType> iterateComplexTypes() { return new Iterators.Map<XSComplexType,XSSchema>(iterateSchema()) { protected Iterator<XSComplexType> apply(XSSchema u) { return u.iterateComplexTypes(); } }; }
Example #21
Source File: GroupInterfaceGenerator.java From jaxb2-rich-contract-plugin with MIT License | 4 votes |
private static Collection<? extends XSDeclaration> findAttributeGroups(final XSComplexType complexType) { return complexType.getAttGroups(); }
Example #22
Source File: ComplexTypeImpl.java From jolie with GNU Lesser General Public License v2.1 | 4 votes |
public XSComplexType getRedefinedBy() { return redefinedBy; }
Example #23
Source File: DefaultFunctionImpl.java From jaxb2-basics with BSD 2-Clause "Simplified" License | 4 votes |
@Override public T complexType(XSComplexType type) { return defaultValue(type); }
Example #24
Source File: FindXSElementDeclVisitor.java From jaxb2-basics with BSD 2-Clause "Simplified" License | 4 votes |
public void complexType(XSComplexType type) { }
Example #25
Source File: SimpleTypeVisitor.java From hyperjaxb3 with BSD 2-Clause "Simplified" License | 4 votes |
public void complexType(XSComplexType type) { // todo("Complex type [" + type.getName() + "]."); }
Example #26
Source File: SimpleTypeAnalyzer.java From hyperjaxb3 with BSD 2-Clause "Simplified" License | 4 votes |
public T complexType(XSComplexType arg0) { return null; }
Example #27
Source File: XsdParser.java From jumbune with GNU Lesser General Public License v3.0 | 4 votes |
private void traverseChilds(XSTerm rfTerm) { if (rfTerm.isModelGroupDecl()) { XSModelGroupDecl rfmodelGD = rfTerm.asModelGroupDecl(); XSModelGroup rfmodelG = rfmodelGD.getModelGroup(); XSParticle[] rfparrs = rfmodelG.getChildren(); for (XSParticle rfpar : rfparrs) { XSTerm rfsterm = rfpar.getTerm(); if (rfsterm.isElementDecl()) { XSComplexType rfcomp = rfsterm.asElementDecl().getType() .asComplexType(); if (rfcomp != null) { traverseChilds(rfsterm); } } else { traverseChilds(rfsterm); } } } else if (rfTerm.isModelGroup()) { XSModelGroup rmodel = rfTerm.asModelGroup(); XSParticle[] rparrs = rmodel.getChildren(); for (XSParticle rpar : rparrs) { if (rpar != null) { XSTerm rterm = rpar.getTerm(); if (rterm.isElementDecl()) { childelements.add(rterm.asElementDecl()); XSComplexType rcomp = rterm.asElementDecl().getType() .asComplexType(); if (rcomp != null) { traverseChilds(rterm); } } else { traverseChilds(rterm); } } } } else { XSComplexType rtcomp = rfTerm.asElementDecl().getType() .asComplexType(); XSContentType rfxscont = rtcomp.getContentType(); XSParticle rfparticle = rfxscont.asParticle(); if (rfparticle != null) { XSTerm rsterm = rfparticle.getTerm(); traverseChilds(rsterm); } else { childelements.add(rfTerm.asElementDecl()); } } }
Example #28
Source File: JumbuneSchemaWriter.java From jumbune with GNU Lesser General Public License v3.0 | 4 votes |
public void schema( XSSchema s) { if(this.elementsMap.size() != 0){ StringBuffer sb = new StringBuffer(); for(String prefix : uriMapping.keySet()){ String uri = uriMapping.get(prefix); if(Const.schemaNamespace.equalsIgnoreCase(uri)) rootPrefix = prefix+":"; sb.append("xmlns:"+prefix+"=\""+uri+"\" " ); } if(!s.getTargetNamespace().isEmpty()){ println(MessageFormat.format("<schema {0} targetNamespace=\"{1}\">",sb.toString(),s.getTargetNamespace())); }else{ println(MessageFormat.format("<schema {0} >",sb.toString())); } indent++; Iterator<XSAttGroupDecl> itrAGD = s.iterateAttGroupDecls(); while (itrAGD.hasNext()) { attGroupDecl(itrAGD.next()); } Iterator<XSAttributeDecl> itrAD = s.iterateAttributeDecls(); while(itrAD.hasNext()) { attributeDecl(itrAD.next()); } Iterator<XSComplexType> itrCT = s.iterateComplexTypes(); while(itrCT.hasNext()) { complexType(itrCT.next()); } Iterator<XSElementDecl> itrED = s.iterateElementDecls(); while(itrED.hasNext()) { elementDecl(itrED.next()); } Iterator<XSModelGroupDecl> itrMGD = s.iterateModelGroupDecls(); while(itrMGD.hasNext()) { modelGroupDecl(itrMGD.next()); } Iterator<XSSimpleType> itrST = s.iterateSimpleTypes(); while(itrST.hasNext()) { simpleType(itrST.next()); } indent--; println("</schema>"); } //} }
Example #29
Source File: XSFunctionFilter.java From jolie with GNU Lesser General Public License v2.1 | 4 votes |
public T complexType(XSComplexType type) { return core.complexType(type); }
Example #30
Source File: XSFinder.java From jolie with GNU Lesser General Public License v2.1 | 4 votes |
/** * @see com.sun.xml.xsom.visitor.XSFunction#complexType(com.sun.xml.xsom.XSComplexType) */ public Boolean complexType(XSComplexType type) { return Boolean.FALSE; }