use of org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference in project eclipselink by eclipse-ee4j.
the class CompositeObjectIdentifiedByNameProject method getEmailAddressDescriptor.
private XMLDescriptor getEmailAddressDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(EmailAddress.class);
XMLDirectMapping userIDMapping = new XMLDirectMapping();
userIDMapping.setAttributeName("userID");
userIDMapping.setXPath("user-id/text()");
descriptor.addMapping(userIDMapping);
XMLDirectMapping domainMapping = new XMLDirectMapping();
domainMapping.setAttributeName("domain");
domainMapping.setXPath("domain/text()");
descriptor.addMapping(domainMapping);
XMLSchemaClassPathReference schemaRef = new XMLSchemaClassPathReference();
schemaRef.setSchemaContext("/emailAddressType");
schemaRef.setType(XMLSchemaClassPathReference.COMPLEX_TYPE);
descriptor.setSchemaReference(schemaRef);
return descriptor;
}
use of org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference in project eclipselink by eclipse-ee4j.
the class EmployeeWithDefaultRootElementProject method getEmployeeDescriptor.
private XMLDescriptor getEmployeeDescriptor() {
XMLDescriptor xmlDescriptor = new XMLDescriptor();
xmlDescriptor.setJavaClass(Employee.class);
xmlDescriptor.setDefaultRootElement("ns:DEFAULT-ROOT");
XMLSchemaClassPathReference schemaReference = new XMLSchemaClassPathReference();
schemaReference.setSchemaContext("/ns:employee-type");
xmlDescriptor.setSchemaReference(schemaReference);
NamespaceResolver namespaceResolver = new NamespaceResolver();
namespaceResolver.put("ns", "urn:test");
xmlDescriptor.setNamespaceResolver(namespaceResolver);
XMLDirectMapping nameMapping = new XMLDirectMapping();
nameMapping.setAttributeName("name");
nameMapping.setXPath("ns:name/text()");
xmlDescriptor.addMapping(nameMapping);
return xmlDescriptor;
}
use of org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference in project eclipselink by eclipse-ee4j.
the class EmployeeWithoutDefaultRootElementProject method getEmployeeDescriptor.
private XMLDescriptor getEmployeeDescriptor() {
XMLDescriptor xmlDescriptor = new XMLDescriptor();
xmlDescriptor.setJavaClass(Employee.class);
XMLSchemaClassPathReference schemaReference = new XMLSchemaClassPathReference();
schemaReference.setSchemaContext("/ns:employee-type");
xmlDescriptor.setSchemaReference(schemaReference);
NamespaceResolver namespaceResolver = new NamespaceResolver();
namespaceResolver.put("ns", "urn:test");
xmlDescriptor.setNamespaceResolver(namespaceResolver);
XMLDirectMapping nameMapping = new XMLDirectMapping();
nameMapping.setAttributeName("name");
nameMapping.setXPath("ns:name/text()");
xmlDescriptor.addMapping(nameMapping);
return xmlDescriptor;
}
use of org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference in project eclipselink by eclipse-ee4j.
the class CompositeObjectSelfNoRefClassNSProject method getAddressDescriptor.
protected XMLDescriptor getAddressDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(Address.class);
descriptor.setDefaultRootElement("ns0:address");
XMLDirectMapping streetMapping = new XMLDirectMapping();
streetMapping.setAttributeName("street");
streetMapping.setXPath("ns0:street/text()");
descriptor.addMapping(streetMapping);
XMLSchemaClassPathReference schemaReference = new XMLSchemaClassPathReference();
schemaReference.setSchemaContext("/ns0:mailingAddressType");
schemaReference.setType(XMLSchemaClassPathReference.COMPLEX_TYPE);
descriptor.setSchemaReference(schemaReference);
NamespaceResolver nr = new NamespaceResolver();
nr.put("ns0", "namespace1");
descriptor.setNamespaceResolver(nr);
return descriptor;
}
use of org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference in project eclipselink by eclipse-ee4j.
the class XMLMarshallerCarProject method getCarDescriptor.
private XMLDescriptor getCarDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(Car.class);
descriptor.setDefaultRootElement("Car");
XMLSchemaClassPathReference ref = new XMLSchemaClassPathReference("org/eclipse/persistence/testing/oxm/xmlmarshaller/Car.xsd");
descriptor.setSchemaReference(ref);
XMLDirectMapping licenseMapping = new XMLDirectMapping();
licenseMapping.setAttributeName("license");
licenseMapping.setXPath("license-number/text()");
descriptor.addMapping(licenseMapping);
return descriptor;
}
Aggregations