本文整理了Java中org.eclipse.xsd.XSDParticle
类的一些代码示例,展示了XSDParticle
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XSDParticle
类的具体详情如下:
包路径:org.eclipse.xsd.XSDParticle
类名称:XSDParticle
[英]A representation of the model object 'Particle'.
The following features are supported:
代码示例来源:origin: geotools/geotools
/** Returns the name of the element represented by the particle as a QName. */
public static QName getParticleName(XSDParticle particle) {
XSDElementDeclaration content = (XSDElementDeclaration) particle.getContent();
if (content.isElementDeclarationReference()) {
content = content.getResolvedElementDeclaration();
}
return new QName(content.getTargetNamespace(), content.getName());
}
代码示例来源:origin: geotools/geotools
for (Iterator itr = children.iterator(); itr.hasNext(); ) {
XSDParticle particle = (XSDParticle) itr.next();
XSDElementDeclaration child = (XSDElementDeclaration) particle.getContent();
if (Encoder.COMMENT.equals(name)) {
particle.setContent(elementDecl);
particles.put(name, particle);
p.hasNext(); ) {
XSDParticle particle = (XSDParticle) p.next();
XSDElementDeclaration el = (XSDElementDeclaration) particle.getContent();
particle.setContent(wrapper);
particle.setMaxOccurs(reference.getMaxOccurs());
} else {
particle.setMaxOccurs(-1);
} else {
particle.setMaxOccurs(1);
XSDElementDeclaration child = (XSDElementDeclaration) particle.getContent();
Object[] prop = (Object[]) itr.next();
XSDParticle part = (XSDParticle) prop[0];
XSDElementDeclaration partContent = (XSDElementDeclaration) part.getContent();
代码示例来源:origin: geotools/geotools
for (Iterator itr = schema.getQNamePrefixToNamespaceMap().entrySet().iterator();
itr.hasNext(); ) {
Map.Entry entry = (Map.Entry) itr.next();
namespaces.declarePrefix("", schema.getTargetNamespace());
new QName(e.getTargetNamespace(), e.getName()),
context);
XSDParticle particle = (XSDParticle) tuple[0];
XSDElementDeclaration child =
(XSDElementDeclaration) particle.getContent();
if (particle.getMinOccurs() == 0) {
if (particle.isSetMaxOccurs()) {
maxOccurs = particle.getMaxOccurs();
} else {
if (particle.eContainer() instanceof XSDModelGroup) {
XSDModelGroup group = (XSDModelGroup) particle.eContainer();
(XSDParticle) group.eContainer();
if (cParticle.isSetMaxOccurs()) {
maxOccurs = cParticle.getMaxOccurs();
代码示例来源:origin: geoserver/geoserver
for (Iterator e = schema.getElementDeclarations().iterator(); e.hasNext(); ) {
XSDElementDeclaration element = (XSDElementDeclaration) e.next();
if (ft.getName().equals(element.getName())) {
type = element.getTypeDefinition();
break;
for (Iterator t = schema.getTypeDefinitions().iterator(); t.hasNext(); ) {
XSDTypeDefinition typedef = (XSDTypeDefinition) t.next();
if ((ft.getName() + "_Type").equals(typedef.getName())) {
for (Iterator c = children.iterator(); c.hasNext(); ) {
XSDElementDeclaration ce = (XSDElementDeclaration) c.next();
if (at.getName().equals(ce.getName())) {
found = true;
if (ce.getContainer() instanceof XSDParticle) {
XSDParticle part = (XSDParticle) ce.getContainer();
at.setMinOccurs(part.getMinOccurs());
at.setMaxOccurs(part.getMaxOccurs());
代码示例来源:origin: geotools/geotools
private XSDParticle buildParticle(XSDElementDeclaration declaration) {
XSDParticle particle = XSDFactory.eINSTANCE.createXSDParticle();
particle.setContent(declaration);
particle.setMinOccurs(0);
particle.setMaxOccurs(-1);
return particle;
}
代码示例来源:origin: geotools/geotools
public void visit(XSDParticle particle) {
XSDElementDeclaration decl = (XSDElementDeclaration) particle.getContent();
if (decl.isElementDeclarationReference()) {
decl = decl.getResolvedElementDeclaration();
}
if (decl == fElement) {
if (particle.isSetMaxOccurs()) {
maxOccurs.add(Integer.valueOf(particle.getMaxOccurs()));
} else if (particle.getContainer() instanceof XSDModelGroup
&& particle.getContainer().getContainer()
instanceof XSDParticle) {
particle = (XSDParticle) particle.getContainer().getContainer();
maxOccurs.add(Integer.valueOf(particle.getMaxOccurs()));
} else {
maxOccurs.add(1);
}
}
}
};
代码示例来源:origin: geotools/geotools
if (config.getNamespaceURI().equals(schemas[i].getTargetNamespace())) {
found = true;
break O;
prefix != null ? new QName(uri, localName, prefix) : new QName(uri, localName);
XSDElementDeclaration child = (XSDElementDeclaration) particle.getContent();
if (child.isElementDeclarationReference()) {
child = child.getResolvedElementDeclaration();
new QName(child.getTargetNamespace(), child.getName()),
parent,
this);
XSDElementDeclaration decl = XSDFactory.eINSTANCE.createXSDElementDeclaration();
decl.setName(qualifiedName.getLocalPart());
decl.setTargetNamespace(qualifiedName.getNamespaceURI());
代码示例来源:origin: geotools/geotools
XSDFactory factory = XSDFactory.eINSTANCE;
XSDComplexTypeDefinition definition = factory.createXSDComplexTypeDefinition();
definition.setName(type.getName().getLocalPart());
definition.setDerivationMethod(XSDDerivationMethod.EXTENSION_LITERAL);
XSDModelGroup attributes = factory.createXSDModelGroup();
attributes.setCompositor(XSDCompositor.SEQUENCE_LITERAL);
Name anyName = new NameImpl(XS.NAMESPACE, XS.ANYTYPE.getLocalPart());
if (xsd.resolveTypeDefinition(name.getNamespaceURI(), name.getLocalPart())
== null) {
xsd.resolveTypeDefinition(name.getNamespaceURI(), name.getLocalPart());
attribute.setTypeDefinition(attributeDefinition);
XSDParticle particle = factory.createXSDParticle();
particle.setMinOccurs(attributeDescriptor.getMinOccurs());
particle.setMaxOccurs(attributeDescriptor.getMaxOccurs());
particle.setContent(attribute);
attributes.getContents().add(particle);
XSDParticle contents = factory.createXSDParticle();
contents.setContent(attributes);
xsd.getContents().add(definition);
代码示例来源:origin: geotools/geotools
XSDElementDeclaration child = (XSDElementDeclaration) particle.getContent();
if (child.isElementDeclarationReference()) {
child = child.getResolvedElementDeclaration();
if ("*".equals(childName.getNamespaceURI())) {
QName name = (QName) entry.getKey();
if (name.getLocalPart().equals(childName.getLocalPart())) {
matches.add(entry.getValue());
particle = (XSDParticle) matches.get(0);
XSDElementDeclaration child = (XSDElementDeclaration) particle.getContent();
if (child.isElementDeclarationReference()) {
child = child.getResolvedElementDeclaration();
代码示例来源:origin: org.geotools/gt2-xml-xsd
for (Iterator itr = schema.getQNamePrefixToNamespaceMap()
.entrySet().iterator(); itr.hasNext();) {
namespaces.declarePrefix( "", schema.getTargetNamespace() );
if ( entry.element.isAbstract() ) {
continue;
Object[] tuple = (Object[]) e.next();
XSDParticle particle = (XSDParticle) tuple[ 0 ];
XSDElementDeclaration child = (XSDElementDeclaration) particle.getContent();
if ( child.isElementDeclarationReference() ) {
child = child.getResolvedElementDeclaration();
if ( particle.getMinOccurs() == 0 ) {
if( particle.isSetMaxOccurs() ) {
maxOccurs = particle.getMaxOccurs();
if ( particle.eContainer() instanceof XSDModelGroup ) {
XSDModelGroup group = (XSDModelGroup) particle.eContainer();
if ( group.eContainer() instanceof XSDParticle ) {
XSDParticle cParticle = (XSDParticle) group.eContainer();
if ( cParticle.isSetMaxOccurs() ) {
maxOccurs = cParticle.getMaxOccurs();
代码示例来源:origin: geotools/geotools
namespace = element.getTargetNamespace();
QName qualifiedTypeName = new QName(namespace, typeName);
type = e.getTypeDefinition();
.get(XSDElementDeclaration.class);
if (e != null) {
type = e.getTypeDefinition();
} else if (element != null) {
for (int i = 0; i < particles.size(); i++) {
XSDParticle particle = (XSDParticle) particles.get(i);
XSDElementDeclaration attribute = (XSDElementDeclaration) particle.getContent();
if (attribute.isElementDeclarationReference()) {
XSDParticle particle2 = (XSDParticle) particles.get(j);
XSDElementDeclaration attribute2 =
(XSDElementDeclaration) particle2.getContent();
if (attribute2.isElementDeclarationReference()) {
attribute2 = attribute2.getResolvedElementDeclaration();
(XSDParticle) particle.cloneConcreteComponent(true, false);
particle.setContent(xsdElementDeclaration);
break;
代码示例来源:origin: geotools/geotools
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;
}
}
代码示例来源:origin: org.geoserver/gs-wfs
List contents = ftSchema.getContents();
schema.getContents().addAll(contents);
schema.updateElement();
XSDComplexTypeDefinition complexType = factory.createXSDComplexTypeDefinition();
complexType.setName(name + "Type");
schema.resolveComplexTypeDefinition(GML.NAMESPACE, "AbstractFeatureType"));
XSDModelGroup group = factory.createXSDModelGroup();
group.setCompositor(XSDCompositor.SEQUENCE_LITERAL);
element.setTypeDefinition(type);
XSDParticle particle = factory.createXSDParticle();
particle.setMinOccurs(attribute.getMinOccurs());
particle.setMaxOccurs(attribute.getMaxOccurs());
particle.setContent(element);
group.getContents().add(particle);
XSDParticle particle = factory.createXSDParticle();
particle.setContent(group);
schema.getContents().add(complexType);
XSDElementDeclaration element = factory.createXSDElementDeclaration();
代码示例来源:origin: geotools/geotools
&& propertyElement instanceof XSDElementDeclaration) {
XSDParticle substitutedChildParticle =
XSDFactory.eINSTANCE.createXSDParticle();
substitutedChildParticle.setMaxOccurs(descriptor.getMaxOccurs());
substitutedChildParticle.setMinOccurs(descriptor.getMinOccurs());
XSDElementDeclaration wrapper =
XSDFactory.eINSTANCE.createXSDElementDeclaration();
wrapper.setResolvedElementDeclaration(
(XSDElementDeclaration) propertyElement);
substitutedChildParticle.setContent(wrapper);
properties.add(new Object[] {substitutedChildParticle, complex});
for (XSDParticle childParticle :
(List<XSDParticle>)
Schemas.getChildElementParticles(element.getTypeDefinition(), true)) {
XSDElementDeclaration childElement =
(XSDElementDeclaration) childParticle.getContent();
XSDFactory.eINSTANCE.createXSDParticle();
substitutedChildParticle.setMaxOccurs(childParticle.getMaxOccurs());
substitutedChildParticle.setMinOccurs(childParticle.getMinOccurs());
substitutedChildParticle.setContent(wrapper);
for (Property property : nameProperties) {
attTypeDef, true)) {
XSDElementDeclaration childEl =
(XSDElementDeclaration) attChild.getContent();
代码示例来源:origin: org.eclipse.xsd/org.eclipse.xsd
protected XSDModelGroup createAnyModelGroup(String processContents)
{
XSDModelGroup modelGroup = XSDFactory.eINSTANCE.createXSDModelGroup();
modelGroup.setCompositor(XSDCompositor.CHOICE_LITERAL);
XSDParticle particle = XSDFactory.eINSTANCE.createXSDParticle();
particle.setContent(createAny(processContents));
modelGroup.getContents().add(particle);
return modelGroup;
}
代码示例来源:origin: org.eclipse.xsd/org.eclipse.xsd
xsdComponent = ((XSDParticle)xsdComponent).getContent();
((XSDSchema)xsdComponent).getContents().add(0, xsdAnnotation = XSDFactory.eINSTANCE.createXSDAnnotation());
if ((xsdAnnotation = xsdTypeDefinition.getAnnotation()) == null)
xsdTypeDefinition.setAnnotation(xsdAnnotation = XSDFactory.eINSTANCE.createXSDAnnotation());
if ((xsdAnnotation = xsdFacet.getAnnotation()) == null)
xsdFacet.setAnnotation(xsdAnnotation = XSDFactory.eINSTANCE.createXSDAnnotation());
if ((xsdAnnotation = xsdElementDeclaration.getAnnotation()) == null)
xsdElementDeclaration.setAnnotation(xsdAnnotation = XSDFactory.eINSTANCE.createXSDAnnotation());
代码示例来源:origin: org.eclipse/org.eclipse.wst.xsd.ui
XSDConcreteComponent elementDecl = ((XSDElementDeclaration)getModelObject()).cloneConcreteComponent(true, true);
container.getSchema().getContents().add(elementDecl);
XSDFactory.eINSTANCE.createXSDElementDeclaration();
elementRef.setValue(element.getValue());
elementRef.setResolvedElementDeclaration((XSDElementDeclaration)elementDecl);
XSDModelGroup modelGroup = (XSDModelGroup)container;
int index = modelGroup.getContents().indexOf(parent);
XSDParticle particle =
XSDFactory.eINSTANCE.createXSDParticle();
particle.setContent(elementRef);
modelGroup.getContents().add(index, particle);
if (parentParticle.isSetMinOccurs()) {
particle.setMinOccurs(parentParticle.getMinOccurs());
parentParticle.unsetMinOccurs();
if (parentParticle.isSetMaxOccurs()) {
particle.setMaxOccurs(parentParticle.getMaxOccurs());
parentParticle.unsetMaxOccurs();
container.getSchema().updateElement(true);
formatChild(elementDecl.getElement());
代码示例来源:origin: org.eclipse.xsd/org.eclipse.xsd
protected void createAttributeElementDeclaration(EAttribute attribute, XSDComplexTypeDefinition xsdComplexTypeDefinition)
{
XSDModelGroup modelGroup = getModelGroup(xsdComplexTypeDefinition);
XSDElementDeclaration xsdElementDeclaration = XSDFactory.eINSTANCE.createXSDElementDeclaration();
xsdElementDeclaration.setName(getName(attribute));
// If the attribute can have a null value (primitives and enums can't), and
// if the attribute can hold many nulls or
// it can hold only a single value that is allowed to be null
// and it can be considered set when it has the null value...
//
if (attribute.getEType().getDefaultValue() == null
&& (attribute.isMany() || (!attribute.isRequired() && (attribute.getDefaultValueLiteral() != null || attribute.isUnsettable()))))
{
xsdElementDeclaration.setNillable(true);
}
if (xsdElementDeclaration.isNillable() || attribute.isMany() || !minimizedXMI)
{
XSDSimpleTypeDefinition attrType = getType(attribute.getEAttributeType());
if (attrType != null)
{
xsdElementDeclaration.setTypeDefinition(attrType);
}
XSDParticle particle = XSDFactory.eINSTANCE.createXSDParticle();
particle.setContent(xsdElementDeclaration);
setAttributeElementMultiplicity(attribute, particle);
modelGroup.getContents().add(particle);
map(particle, attribute);
}
}
代码示例来源:origin: org.eclipse.xsd/org.eclipse.xsd
protected void addElementDeclarationReference(XSDSchema schema, XSDModelGroup modelGroup, String reference)
{
XSDParticle particle = XSDFactory.eINSTANCE.createXSDParticle();
XSDElementDeclaration elementDeclaration = XSDFactory.eINSTANCE.createXSDElementDeclaration();
elementDeclaration.setResolvedElementDeclaration(schema.resolveElementDeclaration(reference));
particle.setContent(elementDeclaration);
modelGroup.getContents().add(particle);
}
代码示例来源:origin: org.eclipse.xsd/org.eclipse.xsd
protected void makeReferenceElement(EReference reference, XSDComplexTypeDefinition xsdComplexTypeDefinition)
{
XSDModelGroup modelGroup = getModelGroup(xsdComplexTypeDefinition);
XSDElementDeclaration xsdElementDeclaration = XSDFactory.eINSTANCE.createXSDElementDeclaration();
xsdElementDeclaration.setName(getName(reference));
if (reference.isUnsettable() && !reference.isMany())
{
xsdElementDeclaration.setNillable(true);
}
setReferenceElementType(reference, xsdElementDeclaration);
XSDParticle particle = XSDFactory.eINSTANCE.createXSDParticle();
particle.setContent(xsdElementDeclaration);
setReferenceElementMultiplicity(reference, particle);
modelGroup.getContents().add(particle);
map(particle, reference);
}
内容来源于网络,如有侵权,请联系作者删除!