XSObjectList facetList = xsSimpleType.getMultiValueFacets(); System.out.println("myDefinedType's facets: "); for(int i = 0; i < facetList.getLength(); i++) { XSMultiValueFacet facet = (XSMultiValueFacet ) facetList.item(i); System.out.println(" "+facetKindToString(facet.getFacetKind())); StringList strList = facet.getLexicalFacetValues(); System.out.println(" " + strList.item(0)); }
public void addObjects(XSObjectList lst) { if(lst instanceof JBossXSObjectList) list.addAll(((JBossXSObjectList)lst).toList()); else { int len = lst != null ? lst.getLength() : 0 ; for(int i=0; i < len; i++) { list.add(lst.item(i)); } } }
private List<Mapping> generateMapping( XSModelGroup modelGroup, int occurrence, MappingContext mc, List<XSElementDeclaration> parentEls, List<XSComplexTypeDefinition> parentCTs ) { List<Mapping> mappings = new ArrayList<Mapping>(); XSObjectList particles = modelGroup.getParticles(); for ( int i = 0; i < particles.getLength(); i++ ) { XSParticle particle = (XSParticle) particles.item( i ); mappings.addAll( generateMapping( particle, occurrence, mc, new ArrayList<XSElementDeclaration>( parentEls ), new ArrayList<XSComplexTypeDefinition>( parentCTs ) ) ); } return mappings; }
public List<SimpleTypeDefinition> getMemberTypes() { XSObjectList xsMemberTypes = simpleTypeDefinition.getMemberTypes(); List<SimpleTypeDefinition> memberTypes = new LinkedList<SimpleTypeDefinition>(); for (int i = 0; i < xsMemberTypes.getLength(); i++) { memberTypes.add(createTypeDefinition((XSSimpleTypeDefinition) xsMemberTypes.item(i))); } return memberTypes; }
private boolean marshalModelGroupAll(XSObjectList particles, boolean declareNs) { boolean marshalled = false; for(int i = 0; i < particles.getLength(); ++i) { XSParticle particle = (XSParticle)particles.item(i); marshalled |= marshalParticle(particle, declareNs); } return marshalled; }
private XSAssertImpl getFirstAssertFromUnionMemberTypes(XSObjectList unionMemberTypes) { XSAssertImpl assertImpl = null; for (int memberTypeIdx = 0; memberTypeIdx < unionMemberTypes.getLength(); memberTypeIdx++) { XSSimpleTypeDefinition unionMemberType = (XSSimpleTypeDefinition) unionMemberTypes.item(memberTypeIdx); if (!SchemaSymbols.URI_SCHEMAFORSCHEMA.equals(unionMemberType.getNamespace())) { Vector memberTypeAsserts = XS11TypeHelper.getAssertsFromSimpleType(unionMemberType); if (!memberTypeAsserts.isEmpty()) { assertImpl = (XSAssertImpl) memberTypeAsserts.get(0); break; } } } return assertImpl; } // getFirstAssertFromUnionMemberTypes
private boolean marshalModelGroupSequence(XSObjectList particles, boolean declareNs) { boolean marshalled = true; for(int i = 0; i < particles.getLength(); ++i) { XSParticle particle = (XSParticle)particles.item(i); marshalled &= marshalParticle(particle, declareNs); } return marshalled; }
private XSSimpleTypeDefinition getActualXDMItemTypeForSTVarietyUnion(XSObjectList memberTypes, String xdmItemStrValue) { XSSimpleTypeDefinition xdmItemType = null; // iterate the member types of union in order, to find that which schema type can successfully validate an atomic value first final int memberTypesLength = memberTypes.getLength(); for (int memTypeIdx = 0; memTypeIdx < memberTypesLength; memTypeIdx++) { XSSimpleType memSimpleType = (XSSimpleType) memberTypes.item(memTypeIdx); if (XS11TypeHelper.isStrValueValidForASimpleType(xdmItemStrValue, memSimpleType, Constants.SCHEMA_VERSION_1_1)) { // no more memberTypes need to be checked xdmItemType = memSimpleType; break; } } return xdmItemType; } // getActualXDMItemTypeForSTVarietyUnion
private void getPropertyDecls( XSParticle particle, List<XSElementDeclaration> propertyDecls ) { if ( particle != null ) { XSTerm term = particle.getTerm(); if ( term instanceof XSElementDeclaration ) { propertyDecls.add( (XSElementDeclaration) term ); } else if ( term instanceof XSModelGroup ) { XSObjectList particles = ( (XSModelGroup) term ).getParticles(); for ( int i = 0; i < particles.getLength(); i++ ) { getPropertyDecls( (XSParticle) particles.item( i ), propertyDecls ); } } else { LOG.warn( "Unhandled term type: " + term.getClass() ); } } }
private void addChildElementDecls( final XSParticle particle, final List<XSTerm> propDecls ) { if ( particle != null ) { final XSTerm term = particle.getTerm(); if ( term instanceof XSModelGroup ) { final XSObjectList particles = ( (XSModelGroup) term ).getParticles(); for ( int i = 0; i < particles.getLength(); i++ ) { addChildElementDecls( (XSParticle) particles.item( i ), propDecls ); } } else if ( term instanceof XSWildcard || term instanceof XSElementDeclaration ) { propDecls.add( term ); } else { throw new RuntimeException( "Unhandled term type: " + term.getClass() ); } } }
public static boolean isAtomicStrValueValidForSTUnion(XSObjectList memberTypes, String content, ValidatedInfo validatedInfo, short schemaVersion) { boolean isValueValid = false; // check the union member types in order to find validity of an atomic value. the validity of atomic value wrt // to the 1st available type in union's member type collection, is sufficient to achieve the objective of this method. for (int memTypeIdx = 0; memTypeIdx < memberTypes.getLength(); memTypeIdx++) { XSSimpleType simpleTypeDv = (XSSimpleType) memberTypes.item(memTypeIdx); if (SchemaSymbols.URI_SCHEMAFORSCHEMA.equals(simpleTypeDv.getNamespace()) && XS11TypeHelper.isStrValueValidForASimpleType(content, simpleTypeDv, schemaVersion)) { isValueValid = true; validatedInfo.memberType = simpleTypeDv; break; } } return isValueValid; } // isAtomicStrValueValidForSTUnion
private void bindModelGroupParticles(XSModelGroup modelGroup) { XSObjectList particles = modelGroup.getParticles(); for(int i = 0; i < particles.getLength(); ++i) { XSParticle particle = (XSParticle)particles.item(i); bindParticle(particle); } }
private static XSFacet getFacet(XSSimpleTypeDefinition simpleType, int kind) { XSObjectList facets = simpleType.getFacets(); for (int i = 0; i < facets.getLength(); i++) { XSFacet facet = (XSFacet) facets.item(i); if (facet.getFacetKind() == kind) { return facet; } } return null; }
private boolean allowsXLink( XSComplexTypeDefinition typeDef ) { XSObjectList xsObjectList = typeDef.getAttributeUses(); for ( int i = 0; i < xsObjectList.getLength(); i++ ) { XSAttributeDeclaration attr = ( (XSAttributeUse) xsObjectList.item( i ) ).getAttrDeclaration(); if ( "href".equals( attr.getName() ) && XLNNS.equals( attr.getNamespace() ) ) { return true; } } return false; }
private void expandRelatedModelGroupComponents(XSModelGroup modelGroup, Vector componentList, String namespace, Hashtable dependencies) { XSObjectList particles = modelGroup.getParticles(); final int length = (particles == null) ? 0 : particles.getLength(); for (int i=0; i<length; i++) { expandRelatedParticleComponents((XSParticle)particles.item(i), componentList, namespace, dependencies); } }
public static boolean simpleTypeHasAsserts(XSSimpleTypeDefinition simpleType) { boolean simpleTypehasAsserts = false; XSObjectList simpleTypeFacets = simpleType.getMultiValueFacets(); final int simpleTypeFacetsLength = simpleTypeFacets.getLength(); for (int facetIdx = 0; facetIdx < simpleTypeFacetsLength; facetIdx++) { XSMultiValueFacet facet = (XSMultiValueFacet) simpleTypeFacets.item(facetIdx); if (facet.getFacetKind() == XSSimpleTypeDefinition.FACET_ASSERT && facet.getAsserts().size() > 0) { simpleTypehasAsserts = true; break; } } return simpleTypehasAsserts; } // simpleTypeHasAsserts
private void setProperties(List properties, XSParticle particle) { XSTerm term = particle.getTerm(); if ((term instanceof XSElementDeclaration)) { properties .add(new XPsviGmlPropertyDefinition(this.model, particle)); } else if ((term instanceof XSModelGroup)) { XSModelGroup modelGroup = (XSModelGroup) term; XSObjectList particles = modelGroup.getParticles(); for (int i = 0; i < particles.getLength(); i++) setProperties(properties, (XSParticle) particles.item(i)); } }
private static List<String> getEnumeratedValues(XSSimpleTypeDefinition simpleType) { ArrayList<String> enums = new ArrayList<>(); XSObjectList facets = simpleType.getMultiValueFacets(); if (facets != null) { for (int i = 0; i < facets.getLength(); i++) { XSMultiValueFacet facet = (XSMultiValueFacet) facets.item(i); if (facet.getFacetKind() == XSSimpleTypeDefinition.FACET_ENUMERATION) { StringList values = facet.getLexicalFacetValues(); for (int j = 0; j < values.getLength(); j++) { enums.add(values.item(j)); } } } } return enums; }
private static boolean checkBooleanType(XSTypeDefinition td) { if (td.getTypeCategory() != XSTypeDefinition.SIMPLE_TYPE) { return false; } final XSSimpleTypeDefinition st = ((XSSimpleTypeDefinition) td); final XSObjectList facets = st.getFacets(); for (int i = 0; i < facets.getLength(); i++) { final XSFacet facet = (XSFacet) facets.item(i); if (facet.getFacetKind() == XSSimpleTypeDefinition.FACET_LENGTH) { if ("0".equals(facet.getLexicalFacetValue())) { return true; } } } return false; }
private void setPropertyNames(List properties, XSElementDeclaration element, XSParticle particle) { XSTerm term = particle.getTerm(); if ((term instanceof XSElementDeclaration)) { XSElementDeclaration propertyElement = (XSElementDeclaration) term; String namespaceUri = propertyElement.getNamespace(); String localName = propertyElement.getName(); properties.add(new QName(namespaceUri, localName)); } else if ((term instanceof XSModelGroup)) { XSModelGroup modelGroup = (XSModelGroup) term; XSObjectList particles = modelGroup.getParticles(); for (int i = 0; i < particles.getLength(); i++) setPropertyNames(properties, element, (XSParticle) particles.item(i)); } }