Refine search
ApplicationSchemaConfiguration configuration; String namespaceURI = featureTypeName.getNamespaceURI(); String uri = schemaLocation.toExternalForm(); configuration = new ApplicationSchemaConfiguration(namespaceURI, uri); schemaIndex = Schemas.findSchemas(configuration); } catch (RuntimeException e) { throw new DataSourceException("Error parsing feature type for " + featureTypeName, e); elementDeclaration = schemaIndex.getElementDeclaration(featureTypeName); schemaIndex.destroy(); if (elementDeclaration == null) { throw new DataSourceException("No XSDElementDeclaration found for " + featureTypeName);
public static Configuration findGmlConfiguration(AppSchemaConfiguration configuration) { SchemaIndex index = null; try { index = Schemas.findSchemas(configuration); for (QName name : SUPPORTED_GML_KNOWN_TYPE_TO_CONFIGURATION_MAP.keySet()) { XSDTypeDefinition type = index.getTypeDefinition(name); if (type != null) { try { return SUPPORTED_GML_KNOWN_TYPE_TO_CONFIGURATION_MAP.get(name) .newInstance(); } catch (Exception e) { throw new RuntimeException(e); } } } throw new RuntimeException("Unsupported GML version for schema at " + configuration.getSchemaLocation()); } finally { if (index != null) { index.destroy(); } } }
schemas[i / 2] = Schemas.parse(location, locators, resolvers); } catch (Exception e) { String msg = "Error parsing: " + location; QName qualifiedName = new QName(uri, localName); XSDElementDeclaration element = index.getElementDeclaration(qualifiedName); List childParticles = index.getChildElementParticles(parentElement .getElementDeclaration()); XSDElementDeclaration child = (XSDElementDeclaration) particle.getContent(); if (child.isElementDeclarationReference()) { child = child.getResolvedElementDeclaration(); handler = handlerFactory.createElementHandler(new QName( child.getTargetNamespace(), child.getName()), parent, this); handler = (ElementHandler) parent.createChildHandler(new QName("*", qualifiedName.getLocalPart())); XSDTypeDefinition type = index.getTypeDefinition(XS.ANYTYPE); decl.setTypeDefinition(type); handler = new ElementHandlerImpl(decl, parent, this);
XSDElementDeclaration root = index.getElementDeclaration(name); XSDTypeDefinition type = index.getTypeDefinition(typeDefintion); root.setName(name.getLocalPart()); root.setTargetNamespace(name.getNamespaceURI()); root.setTypeDefinition(type); Binding binding = bindingLoader.loadBinding(new QName( e.getTargetNamespace(), e.getName()), context); List attributes = index.getAttributes(entry.element);
List children = encoder.getSchemaIndex().getChildElementParticles(element); XSDElementDeclaration child = (XSDElementDeclaration) particle.getContent(); if (child.isElementDeclarationReference()) { child = child.getResolvedElementDeclaration(); if (Encoder.COMMENT.equals(name)) { .createElement(Encoder.COMMENT.getLocalPart()); elementDecl.setTargetNamespace(Encoder.COMMENT.getNamespaceURI()); elementDecl.setName(Encoder.COMMENT.getLocalPart()); elementDecl.setElement(comment); .getElementDeclaration(name); for ( Iterator p = Schemas.getChildElementParticles(element.getType(), true).iterator(); p.hasNext(); ) { XSDParticle particle = (XSDParticle) p.next(); XSDElementDeclaration el = (XSDElementDeclaration) particle.getContent(); if ( Schemas.isBaseType(elementDecl, el) ) { reference = particle; break;
List children = encoder.getSchemaIndex().getChildElementParticles( element ); if ( child.isElementDeclarationReference() ) { child = child.getResolvedElementDeclaration(); encoder.getSchemaIndex().getElementDeclaration( name ); if ( elementDecl == null ) { encoder.getSchema().resolveElementDeclaration( name.getNamespaceURI(), name.getLocalPart() );
private Handler getChildHandlerInternal(QName qName) { SchemaIndex index = parser.getSchemaIndex(); XSDElementDeclaration element = index.getChildElement(content, qName); element = index.getElementDeclaration(qName); XSDElementDeclaration sub = element.getSubstitutionGroupAffiliation(); QName subQName = new QName(sub.getTargetNamespace(), sub.getName()); Handler handler = getChildHandlerInternal(subQName);
XSDElementDeclaration root = index.getElementDeclaration(name); encoded.add(new EncodingEntry(object,root)); if ( entry.element.isAbstract() ) { List sub = entry.element.getSubstitutionGroup(); if ( sub.size() > 0 ) { continue; if ( e.getName() == null ) continue; new QName( e.getTargetNamespace(), e.getName() ), context ); if ( binding == null ) { new QName( type.getTargetNamespace(), type.getName() ), context ); List attributes = index.getAttributes( entry.element ); for (Iterator itr = attributes.iterator(); itr.hasNext();) { XSDAttributeDeclaration attribute =
namespace = element.getTargetNamespace(); XSDTypeDefinition type = schemaIndex.getTypeDefinition(new QName(namespace, typeName)); XSDElementDeclaration e = schemaIndex.getElementDeclaration(new QName(namespace, typeName)); type = e.getTypeDefinition(); List particles = Schemas.getChildElementParticles(type, true); List properties = new ArrayList(); XSDElementDeclaration attribute = (XSDElementDeclaration) particle.getContent(); if (attribute.isElementDeclarationReference()) { attribute = attribute.getResolvedElementDeclaration();
XSDParticle particle(Attribute att) { XSDFactory factory = XSDFactory.eINSTANCE; AttributeType attType = att.getType(); XSDTypeDefinition xsdType = schemaIndex.getTypeDefinition( new QName(attType.getName().getNamespaceURI(), attType.getName().getLocalPart())); XSDElementDeclaration element = factory.createXSDElementDeclaration(); element.setName(att.getName().getLocalPart()); element.setTargetNamespace(att.getName().getNamespaceURI()); element.setTypeDefinition(xsdType); XSDParticle particle = factory.createXSDParticle(); particle.setContent(element); return particle; }
ftSchema = Schemas.parse(schemaFile.file().getAbsolutePath(), locators, null); } catch (IOException e) { LOGGER.log( element.setName(attribute.getLocalName()); element.setNillable(attribute.isNillable()); index.getTypeDefinition( new QName(typeName.getNamespaceURI(), typeName.getLocalPart())); if (type == null) { throw new IllegalStateException("Could not find type: " + typeName); element.setTypeDefinition(type);
@Override public ElementHandler createElementHandler(QName qName, Handler parent, ParserHandler parser) { String name = qName.getLocalPart(); if (schemaRegistry.get(name) != null) { // we found a custom schema element // let's treat it as if we've found a placemark SchemaIndex schemaIndex = parser.getSchemaIndex(); XSDElementDeclaration element = schemaIndex.getElementDeclaration(KML.Placemark); if (element != null) { return createElementHandler(element, parent, parser); } } return super.createElementHandler(qName, parent, parser); } }
if (elemDecl.isElementDeclarationReference()) { elemDecl = elemDecl.getResolvedElementDeclaration(); typeDefinition = elemDecl.getAnonymousTypeDefinition(); if (typeDefinition == null) { elemDecl.getName())); for (SchemaIndex schemaIndex : schemas) { elemDecl = schemaIndex.getElementDeclaration(qname); if (elemDecl != null) { break;
Schemas.getChildElementParticle(element.getType(), "Name", false), property.getName() }); (newTypeName != null) ? index.getTypeDefinition(newTypeName) : null; value.setName("Value"); value.setTypeDefinition(type); Schemas.getChildElementParticle(element.getType(), "Value", false), property.getValue() };
private XSDElementDeclaration getElementDeclaration(final Name descriptorName) { QName qname = Types.toQName(descriptorName); XSDElementDeclaration elemDecl = null; for (SchemaIndex schemaIndex : schemas) { elemDecl = schemaIndex.getElementDeclaration(qname); if (elemDecl != null) { break; } } if (elemDecl == null) { String msg = "No top level element found in schemas: " + qname; LOGGER.log(Level.WARNING, msg); throw new NoSuchElementException(msg); } return elemDecl; }
private XSDTypeDefinition getTypeDefinition(Name typeName) { QName qName = Types.toQName(typeName); XSDTypeDefinition typeDefinition = null; for (SchemaIndex schemaIndex : schemas) { typeDefinition = schemaIndex.getTypeDefinition(qName); if (typeDefinition != null) { break; } } if (typeDefinition == null) { throw new IllegalArgumentException( "XSD type definition not found in schemas: " + qName); } return typeDefinition; }
/** * Destroy all schema Indexes. VERY important to that this is called * to avoid memory leaks, because schema indexes are kept alive otherwise * by static schema's and in this way keep other schema's alive */ public void disposeSchemaIndexes(){ for (SchemaIndex schemaIndex : schemas) { schemaIndex.destroy(); } }
Schemas.validateImportsIncludes(location,locators,resolvers); List imports = Schemas.getImports(schemas[i]); QName qualifiedName = new QName(uri, localName); XSDElementDeclaration element = index.getElementDeclaration(qualifiedName); List childParticles = index.getChildElementParticles(parentElement .getElementDeclaration()); XSDElementDeclaration child = (XSDElementDeclaration) particle.getContent(); if (child.isElementDeclarationReference()) { child = child.getResolvedElementDeclaration(); handler = handlerFactory.createElementHandler(new QName( child.getTargetNamespace(), child.getName()), parent, this); context.unregisterComponent("http://geotools.org/typeDefinition"); XSDTypeDefinition type = index.getTypeDefinition(typeDefinition); } else { XSDTypeDefinition type = index.getTypeDefinition(XS.ANYTYPE); decl.setTypeDefinition(type);
List children = encoder.getSchemaIndex().getChildElementParticles(element); XSDElementDeclaration child = (XSDElementDeclaration) particle.getContent(); if (child.isElementDeclarationReference()) { child = child.getResolvedElementDeclaration(); .getElementDeclaration(name); .resolveElementDeclaration(name.getNamespaceURI(), name.getLocalPart());
private Handler getChildHandlerInternal(QName qName) { SchemaIndex index = parser.getSchemaIndex(); XSDElementDeclaration element = index.getChildElement( content, qName ); element = index.getElementDeclaration(qName); if (element != null) { XSDElementDeclaration sub = element.getSubstitutionGroupAffiliation(); QName subQName = new QName(sub.getTargetNamespace(), sub.getName()); Handler handler = getChildHandlerInternal(subQName);