Search in sources :

Example 16 with XMLSchemaClassPathReference

use of org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference in project eclipselink by eclipse-ee4j.

the class ChildAndGeneratedPrefixClashProject method getTeamDescriptor.

private XMLDescriptor getTeamDescriptor() {
    XMLDescriptor xmlDescriptor = new XMLDescriptor();
    xmlDescriptor.setJavaClass(Team.class);
    xmlDescriptor.setDefaultRootElement("aaa:team");
    XMLDirectMapping nameMapping = new XMLDirectMapping();
    nameMapping.setAttributeName("teamName");
    nameMapping.setXPath("ns0:teamName/text()");
    xmlDescriptor.addMapping(nameMapping);
    XMLSchemaClassPathReference ref = new XMLSchemaClassPathReference();
    ref.setSchemaContext("/aaa:team");
    ref.setType(XMLSchemaClassPathReference.COMPLEX_TYPE);
    xmlDescriptor.setSchemaReference(ref);
    NamespaceResolver nsResolver = new NamespaceResolver();
    nsResolver.put("aaa", "http://www.example.com/aaa");
    nsResolver.put("ns0", "http://www.example.com/teamNS0");
    nsResolver.put("ns1", "http://www.example.com/teamNS1");
    xmlDescriptor.setNamespaceResolver(nsResolver);
    return xmlDescriptor;
}
Also used : XMLDescriptor(org.eclipse.persistence.oxm.XMLDescriptor) XMLDirectMapping(org.eclipse.persistence.oxm.mappings.XMLDirectMapping) NamespaceResolver(org.eclipse.persistence.oxm.NamespaceResolver) XMLSchemaClassPathReference(org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference)

Example 17 with XMLSchemaClassPathReference

use of org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference in project eclipselink by eclipse-ee4j.

the class CompositeCollectionWithGroupingElementIdentifiedByNamespaceProject method getEmailAddressDescriptor.

private XMLDescriptor getEmailAddressDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(EmailAddress.class);
    descriptor.setNamespaceResolver(namespaceResolver);
    XMLDirectMapping userIDMapping = new XMLDirectMapping();
    userIDMapping.setAttributeName("userID");
    userIDMapping.setXPath(EMAIL_PREFIX + ":user-id/text()");
    descriptor.addMapping(userIDMapping);
    XMLDirectMapping domainMapping = new XMLDirectMapping();
    domainMapping.setAttributeName("domain");
    domainMapping.setXPath(EMAIL_PREFIX + ":domain/text()");
    descriptor.addMapping(domainMapping);
    XMLSchemaClassPathReference schemaRef = new XMLSchemaClassPathReference();
    schemaRef.setSchemaContext("/email:addressType");
    schemaRef.setType(XMLSchemaClassPathReference.COMPLEX_TYPE);
    descriptor.setSchemaReference(schemaRef);
    return descriptor;
}
Also used : XMLDescriptor(org.eclipse.persistence.oxm.XMLDescriptor) XMLDirectMapping(org.eclipse.persistence.oxm.mappings.XMLDirectMapping) XMLSchemaClassPathReference(org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference)

Example 18 with XMLSchemaClassPathReference

use of org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference in project eclipselink by eclipse-ee4j.

the class CustomerProject method getAddressDescriptor.

private XMLDescriptor getAddressDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(Address.class);
    NamespaceResolver nsResolver = new NamespaceResolver();
    nsResolver.setDefaultNamespaceURI("urn:customer");
    descriptor.setNamespaceResolver(nsResolver);
    XMLSchemaClassPathReference schemaReference = new XMLSchemaClassPathReference();
    schemaReference.setSchemaContext("/address-type");
    schemaReference.setType(XMLSchemaClassPathReference.COMPLEX_TYPE);
    descriptor.setSchemaReference(schemaReference);
    return descriptor;
}
Also used : XMLDescriptor(org.eclipse.persistence.oxm.XMLDescriptor) NamespaceResolver(org.eclipse.persistence.oxm.NamespaceResolver) XMLSchemaClassPathReference(org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference)

Example 19 with XMLSchemaClassPathReference

use of org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference in project eclipselink by eclipse-ee4j.

the class TypeProject method getAddressDescriptor.

public XMLDescriptor getAddressDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(Address.class);
    descriptor.setDefaultRootElement("contact-method");
    descriptor.setDefaultRootElementType(new QName("http://www.example.com/toplink-oxm", "contact-method-type"));
    descriptor.setNamespaceResolver(namespaceResolver);
    descriptor.getInheritancePolicy().setParentClass(ContactMethod.class);
    XMLSchemaClassPathReference ref = new XMLSchemaClassPathReference();
    ref.setSchemaContext("/address-type");
    ref.setType(XMLSchemaClassPathReference.COMPLEX_TYPE);
    descriptor.setSchemaReference(ref);
    XMLDirectMapping streetMapping = new XMLDirectMapping();
    streetMapping.setAttributeName("street");
    streetMapping.setXPath("street/text()");
    descriptor.addMapping(streetMapping);
    return descriptor;
}
Also used : XMLDescriptor(org.eclipse.persistence.oxm.XMLDescriptor) XMLDirectMapping(org.eclipse.persistence.oxm.mappings.XMLDirectMapping) QName(javax.xml.namespace.QName) XMLSchemaClassPathReference(org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference)

Example 20 with XMLSchemaClassPathReference

use of org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference in project eclipselink by eclipse-ee4j.

the class AnyTypeProject method getCdnAddressDescriptor.

public XMLDescriptor getCdnAddressDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(CanadianAddress.class);
    descriptor.setDefaultRootElement("contact-method");
    descriptor.setDefaultRootElementType(new QName("http://www.example.com/toplink-oxm", "contact-method-type"));
    descriptor.setNamespaceResolver(namespaceResolver);
    descriptor.getInheritancePolicy().setParentClass(Address.class);
    XMLSchemaClassPathReference ref = new XMLSchemaClassPathReference();
    ref.setSchemaContext("/oxm:canadian-address-type");
    ref.setType(XMLSchemaClassPathReference.COMPLEX_TYPE);
    descriptor.setSchemaReference(ref);
    XMLDirectMapping postalCodeMapping = new XMLDirectMapping();
    postalCodeMapping.setAttributeName("postalCode");
    postalCodeMapping.setXPath("postal-code/text()");
    descriptor.addMapping(postalCodeMapping);
    return descriptor;
}
Also used : XMLDescriptor(org.eclipse.persistence.oxm.XMLDescriptor) XMLDirectMapping(org.eclipse.persistence.oxm.mappings.XMLDirectMapping) QName(javax.xml.namespace.QName) XMLSchemaClassPathReference(org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference)

Aggregations

XMLSchemaClassPathReference (org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference)71 XMLDescriptor (org.eclipse.persistence.oxm.XMLDescriptor)69 XMLDirectMapping (org.eclipse.persistence.oxm.mappings.XMLDirectMapping)52 NamespaceResolver (org.eclipse.persistence.oxm.NamespaceResolver)36 QName (javax.xml.namespace.QName)13 XMLCompositeCollectionMapping (org.eclipse.persistence.oxm.mappings.XMLCompositeCollectionMapping)9 XMLCompositeObjectMapping (org.eclipse.persistence.oxm.mappings.XMLCompositeObjectMapping)9 XMLField (org.eclipse.persistence.oxm.XMLField)8 XMLObjectReferenceMapping (org.eclipse.persistence.oxm.mappings.XMLObjectReferenceMapping)6 XMLSchemaReference (org.eclipse.persistence.oxm.schema.XMLSchemaReference)5 XMLCollectionReferenceMapping (org.eclipse.persistence.oxm.mappings.XMLCollectionReferenceMapping)4 XMLCompositeDirectCollectionMapping (org.eclipse.persistence.oxm.mappings.XMLCompositeDirectCollectionMapping)2 XmlValue (jakarta.xml.bind.annotation.XmlValue)1 XMLAnyCollectionMapping (org.eclipse.persistence.oxm.mappings.XMLAnyCollectionMapping)1 XMLTransformationMapping (org.eclipse.persistence.oxm.mappings.XMLTransformationMapping)1