Java Code Examples for org.exolab.castor.xml.Marshaller#setSchemaLocation()

The following examples show how to use org.exolab.castor.xml.Marshaller#setSchemaLocation() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CastorMarshaller.java    From java-technology-stack with MIT License 6 votes vote down vote up
/**
 * Template method that allows for customizing of the given Castor {@link Marshaller}.
 */
protected void customizeMarshaller(Marshaller marshaller) {
	marshaller.setValidation(this.validating);
	marshaller.setSuppressNamespaces(this.suppressNamespaces);
	marshaller.setSuppressXSIType(this.suppressXsiType);
	marshaller.setMarshalAsDocument(this.marshalAsDocument);
	marshaller.setMarshalExtendedType(this.marshalExtendedType);
	marshaller.setRootElement(this.rootElement);
	marshaller.setNoNamespaceSchemaLocation(this.noNamespaceSchemaLocation);
	marshaller.setSchemaLocation(this.schemaLocation);
	marshaller.setUseXSITypeAtRoot(this.useXSITypeAtRoot);
	if (this.doctypes != null) {
		this.doctypes.forEach(marshaller::setDoctype);
	}
	if (this.processingInstructions != null) {
		this.processingInstructions.forEach(marshaller::addProcessingInstruction);
	}
	if (this.namespaceMappings != null) {
		this.namespaceMappings.forEach(marshaller::setNamespaceMapping);
	}
}
 
Example 2
Source File: UncertaintyWriter.java    From OpenDA with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void write() throws IOException, ValidationException, MarshalException {

        String rootElement = "uncertainties" ;
        Marshaller marshaller = new Marshaller(writer);
        marshaller.setRootElement(rootElement);

        //if (variables != null && variables.containsKey("UA_SCHEMALOCATION"))
        //    marshaller.setSchemaLocation("http://www.wldelft.nl " + variables.getValue("UA_SCHEMALOCATION") + rootElement + ".xsd");
        //else
            marshaller.setSchemaLocation("http://www.wldelft.nl http://datools.wldelft.nl/schemas/v1.3/" + rootElement + ".xsd");

        marshaller.marshal(this.uncertaintiesComplexType);
    }
 
Example 3
Source File: CastorMarshaller.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Template method that allows for customizing of the given Castor {@link Marshaller}.
 */
protected void customizeMarshaller(Marshaller marshaller) {
	marshaller.setValidation(this.validating);
	marshaller.setSuppressNamespaces(this.suppressNamespaces);
	marshaller.setSuppressXSIType(this.suppressXsiType);
	marshaller.setMarshalAsDocument(this.marshalAsDocument);
	marshaller.setMarshalExtendedType(this.marshalExtendedType);
	marshaller.setRootElement(this.rootElement);
	marshaller.setNoNamespaceSchemaLocation(this.noNamespaceSchemaLocation);
	marshaller.setSchemaLocation(this.schemaLocation);
	marshaller.setUseXSITypeAtRoot(this.useXSITypeAtRoot);
	if (this.doctypes != null) {
		for (Map.Entry<String, String> doctype : this.doctypes.entrySet()) {
			marshaller.setDoctype(doctype.getKey(), doctype.getValue());
		}
	}
	if (this.processingInstructions != null) {
		for (Map.Entry<String, String> processingInstruction : this.processingInstructions.entrySet()) {
			marshaller.addProcessingInstruction(processingInstruction.getKey(), processingInstruction.getValue());
		}
	}
	if (this.namespaceMappings != null) {
		for (Map.Entry<String, String> entry : this.namespaceMappings.entrySet()) {
			marshaller.setNamespaceMapping(entry.getKey(), entry.getValue());
		}
	}
}