writer.writeStartElement( OWS_PREFIX, "ServiceProvider", owsNS );
// ows:ProviderName (type="string")
writer.writeStartElement( owsNS, "ProviderName" );
writer.writeCharacters( serviceProvider.getProviderName() );
writer.writeEndElement();
if ( serviceProvider.getProviderSite() != null && !"".equals( serviceProvider.getProviderSite().trim() ) ) {
// ows:ProviderSite (type="ows:OnlineResourceType")
writer.writeStartElement( owsNS, "ProviderSite" );
writer.writeAttribute( XLN_NS, "href", serviceProvider.getProviderSite() );
writer.writeEndElement();
}
// ows:ProviderSite (type="ows:ResponsiblePartySubsetType")
ServiceContactType serviceContact = serviceProvider.getServiceContact();
writer.writeStartElement( owsNS, "ServiceContact" );
if ( serviceContact.getIndividualName() != null && !"".equals( serviceContact.getIndividualName().trim() ) ) {
// ows:IndividualName (type="string")
writeElement( writer, owsNS, "IndividualName", serviceContact.getIndividualName() );
}
if ( serviceContact.getPositionName() != null && !"".equals( serviceContact.getPositionName().trim() ) ) {
// ows:PositionName (type="string")
writeElement( writer, owsNS, "PositionName", serviceContact.getPositionName() );
}
// ows:ContactInfo
if ( serviceContact.getPhone() != null || serviceContact.getFacsimile() != null
|| serviceContact.getAddress() != null || serviceContact.getElectronicMailAddress() != null
|| serviceContact.getOnlineResource() != null || serviceContact.getHoursOfService() != null
|| serviceContact.getContactInstructions() != null ) {
writer.writeStartElement( owsNS, "ContactInfo" );
// ows:Phone (type="ows:PhoneType")
if ( serviceContact.getPhone() != null || serviceContact.getFacsimile() != null ) {
writer.writeStartElement( owsNS, "Phone" );
// ows:Voice (type="string")
writeOptionalElement( writer, owsNS, "Voice", serviceContact.getPhone() );
// ows:Facsimile (type="string")
writeOptionalElement( writer, owsNS, "Facsimile", serviceContact.getFacsimile() );
writer.writeEndElement();
}
// ows:Address (type="ows:AddressType")
AddressType address = serviceContact.getAddress();
if ( address != null ) {
writer.writeStartElement( owsNS, "Address" );
exportSimpleStrings( writer, address.getDeliveryPoint(), owsNS, "DeliveryPoint" );
writeOptionalElement( writer, owsNS, "City", address.getCity() );
writeOptionalElement( writer, owsNS, "AdministrativeArea", address.getAdministrativeArea() );
writeOptionalElement( writer, owsNS, "PostalCode", address.getPostalCode() );
writeOptionalElement( writer, owsNS, "Country", address.getCountry() );
exportSimpleStrings( writer, serviceContact.getElectronicMailAddress(), owsNS, "ElectronicMailAddress" );
writer.writeEndElement();
}
if ( serviceContact.getOnlineResource() != null && !"".equals( serviceContact.getOnlineResource().trim() ) ) {
// ows:OnlineResource (type="ows:OnlineResourceType")
writer.writeStartElement( owsNS, "OnlineResource" );
writer.writeAttribute( XLN_NS, "href", serviceContact.getOnlineResource() );
writer.writeEndElement();
}
// ows:HoursOfService (type="string")
writeOptionalElement( writer, owsNS, "HoursOfService", serviceContact.getHoursOfService() );
// ows:ContactInstructions (type="string")
writeOptionalElement( writer, owsNS, "ContactInstructions", serviceContact.getContactInstructions() );
writer.writeEndElement(); // ContactInfo
}
// ows:Role (type="ows:CodeType)
writeElement( writer, owsNS, "Role", serviceContact.getRole() );
writer.writeEndElement();
writer.writeEndElement(); // ServiceProvider
}
/**
* Exports a {@link ServiceProviderType} as an OWS 1.1.0 <code>ServiceProvider</code> element. Validated against ows
* schema by rb at 23.02.2009.
*
* @param writer
* writer to append the xml
* @param serviceProvider
* <code>ServiceProviderType</code> to export
* @throws XMLStreamException
*/
public static void exportServiceProvider110( XMLStreamWriter writer, ServiceProviderType serviceProvider )