List of usage examples for javax.xml.stream XMLStreamWriter writeStartElement
public void writeStartElement(String namespaceURI, String localName) throws XMLStreamException;
From source file:org.deegree.services.csw.exporthandling.GetCapabilitiesHelper.java
public void exportServiceIdentification(XMLStreamWriter writer, ServiceIdentificationType identification, String serviceType, String serviceTypeVersion, String serviceTypeCodeSpace) throws XMLStreamException { writer.writeStartElement("http://www.opengis.net/ows", Sections.ServiceIdentification.toString()); for (String oneTitle : identification.getTitle()) { writeElement(writer, "http://www.opengis.net/ows", "Title", oneTitle); }/*from w ww . j a va 2 s . c o m*/ for (String oneAbstract : identification.getAbstract()) { writeElement(writer, "http://www.opengis.net/ows", "Abstract", oneAbstract); } // keywords [0,n] exportKeywords(writer, identification.getKeywords()); if (serviceTypeCodeSpace != null) { writeElement(writer, "http://www.opengis.net/ows", "ServiceType", serviceType, null, null, "codeSpace", serviceTypeCodeSpace); } else { writeElement(writer, "http://www.opengis.net/ows", "ServiceType", serviceType); } writeElement(writer, "http://www.opengis.net/ows", "ServiceTypeVersion", serviceTypeVersion); // fees [1] String fees = identification.getFees(); if (fees == null || fees.length() == 0) { identification.setFees("NONE"); } fees = identification.getFees(); // fees = fees.replaceAll( "\\W", " " ); writeElement(writer, "http://www.opengis.net/ows", "Fees", fees); // accessConstraints [0,n] exportAccessConstraints(writer, identification); writer.writeEndElement(); }
From source file:org.deegree.services.csw.exporthandling.GetCapabilitiesHelper.java
/** * Writes the parameter and attributes for the mandatory DescribeRecord operation to the output. * // www.j a va2 s . co m * @param writer * to write the output * @param owsNS * the OWS namespace * @throws XMLStreamException */ public void writeDescribeRecordParameters(XMLStreamWriter writer, String owsNS, String[] typeNames, String[] outputFormats, String schemaLanguage) throws XMLStreamException { if (typeNames != null && typeNames.length > 0) { writer.writeStartElement(owsNS, "Parameter"); writer.writeAttribute("name", "typeName"); for (String typeName : typeNames) { writeValue(writer, owsNS, typeName); } writer.writeEndElement();// Parameter } writeOutputFormat(writer, owsNS, outputFormats); writer.writeStartElement(owsNS, "Parameter"); writer.writeAttribute("name", "schemaLanguage"); writeValue(writer, owsNS, schemaLanguage); writer.writeEndElement();// Parameter }
From source file:org.deegree.services.csw.exporthandling.GetCapabilitiesHelper.java
private void writeOutputFormat(XMLStreamWriter writer, String owsNS, String[] outputFormats) throws XMLStreamException { writer.writeStartElement(owsNS, "Parameter"); writer.writeAttribute("name", "outputFormat"); for (String outputFormat : outputFormats) { writeValue(writer, owsNS, outputFormat); }/*from w w w . ja va 2 s . c o m*/ writer.writeEndElement();// Parameter }
From source file:org.deegree.services.csw.exporthandling.GetCapabilitiesHelper.java
/** * Writes the parameter and attributes for the mandatory GetCapabilities operation to the output. * // w w w . j ava 2 s . com * @param writer * to write the output * @param owsNS * the OWS namespace * @throws XMLStreamException */ public void writeGetCapabilitiesParameters(XMLStreamWriter writer, String owsNS) throws XMLStreamException { writer.writeStartElement(owsNS, "Parameter"); writer.writeAttribute("name", "sections"); for (String value : parameterValues) { writer.writeStartElement(owsNS, "Value"); writer.writeCharacters(value); writer.writeEndElement();// Value } writer.writeEndElement();// Parameter // Constraints... }
From source file:org.deegree.services.csw.exporthandling.GetCapabilitiesHelper.java
/** * Writes the parameter and attributes for the mandatory GetRecords operation to the output. * /* w w w. j a v a 2 s . c o m*/ * @param writer * @param owsNS * @param typeNames * the typeNames to write * @param outputFormats * the outputFormats to write * @param outputSchemas * the outputSchemas to write * @param elementSetNames * the elementSetNames to write, if null this parameter will be ignored, can be <code>null</code> * @throws XMLStreamException */ public void writeGetRecordsParameters(XMLStreamWriter writer, String owsNS, String[] typeNames, String[] outputFormats, String[] outputSchemas, String[] elementSetNames) throws XMLStreamException { writer.writeStartElement(owsNS, "Parameter"); writer.writeAttribute("name", "typeNames"); for (String typeName : typeNames) { writeValue(writer, owsNS, typeName); } writer.writeEndElement();// Parameter writeOutputFormat(writer, owsNS, outputFormats); writer.writeStartElement(owsNS, "Parameter"); writer.writeAttribute("name", "outputSchema"); for (String outputSchema : outputSchemas) { writeValue(writer, owsNS, outputSchema); } writer.writeEndElement();// Parameter writer.writeStartElement(owsNS, "Parameter"); writer.writeAttribute("name", "resultType"); writeValue(writer, owsNS, "hits"); writeValue(writer, owsNS, "results"); writeValue(writer, owsNS, "validate"); writer.writeEndElement();// Parameter if (elementSetNames != null && elementSetNames.length > 0) { writer.writeStartElement(owsNS, "Parameter"); writer.writeAttribute("name", "ElementSetName"); for (String elementSetName : elementSetNames) { writeValue(writer, owsNS, elementSetName); } writer.writeEndElement();// Parameter } }
From source file:org.deegree.services.csw.exporthandling.GetCapabilitiesHelper.java
/** * Writes the parameter and attributes for the mandatory GetRecordById operation to the output.<br> * In this case the optional transaction operation uses this writing to the output, as well. * /*from www .j a v a 2s.c om*/ * @param writer * @param owsNS * @param outputFormats * the outpurFormats to write * @param outputSchemas * the outputSChemas to write * @throws XMLStreamException */ public void writeGetRecordByIdParameters(XMLStreamWriter writer, String owsNS, String[] outputFormats, String[] outputSchemas) throws XMLStreamException { writeOutputFormat(writer, owsNS, outputFormats); writer.writeStartElement(owsNS, "Parameter"); writer.writeAttribute("name", "outputSchema"); for (String outputSchema : outputSchemas) { writeValue(writer, owsNS, outputSchema); } writer.writeEndElement(); // Parameter }
From source file:org.deegree.services.csw.exporthandling.GetCapabilitiesHelper.java
/** * write a list of keywords in csw 2.0.2 style. * // w w w .ja va 2s. c o m * @param writer * @param keywords * @throws XMLStreamException */ private void exportKeywords(XMLStreamWriter writer, List<KeywordsType> keywords) throws XMLStreamException { if (!keywords.isEmpty()) { for (KeywordsType kwt : keywords) { if (kwt != null) { writer.writeStartElement("http://www.opengis.net/ows", "Keywords"); List<LanguageStringType> keyword = kwt.getKeyword(); for (LanguageStringType lst : keyword) { if (lst != null) { writeElement(writer, "http://www.opengis.net/ows", "Keyword", lst.getValue()); } // -> keyword [1, n] } // -> type [0,1] // exportCodeType( writer, kwt.getType() ); writer.writeEndElement();// WCS_100_NS, "keywords" ); } } } }
From source file:org.deegree.services.csw.exporthandling.GetCapabilitiesHelper.java
/** * @param writer//from w w w.j a v a2 s .co m * the writer to write the extedned capabilities, never <code>null</code> * @param owsNS * the namespaceURI of the ExtendedCapabilities element * @param extendedCapabilities * the inputStream containing the extended capabilites, if <code>null</code> nothing is exported * @param varToValue * an optional list of key value pairs replaced in the extended capabilities, may be <code>null</code> * @throws XMLStreamException */ void exportExtendedCapabilities(XMLStreamWriter writer, String owsNS, InputStream extendedCapabilities, Map<String, String> varToValue) throws XMLStreamException { if (extendedCapabilities != null) { if (varToValue == null) varToValue = Collections.emptyMap(); writer.writeStartElement(owsNS, "ExtendedCapabilities"); try { XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(extendedCapabilities); reader.nextTag(); writeTemplateElement(writer, reader, varToValue); writer.writeEndElement(); } finally { IOUtils.closeQuietly(extendedCapabilities); } } }
From source file:org.deegree.services.wps.execute.ExecuteResponseXMLWriter.java
private static void exportDataInputs(XMLStreamWriter writer, ExecuteResponse response) throws XMLStreamException { // "wps:DataInputs" (minOccurs="0", maxOccurs="1") writer.writeStartElement(WPS_NS, "DataInputs"); for (ProcessletInput input : response.getDataInputs().getParameters()) { // "wps:Input" (minOccurs="1", maxOccurs="1") writer.writeStartElement(WPS_NS, "Input"); // "ows:Identifier" (minOccurs="1", maxOccurs="1") writer.writeStartElement(OWS_NS, "Identifier"); if (input.getIdentifier().getCodeSpace() != null) { writer.writeAttribute("codeSpace", input.getIdentifier().getCodeSpace()); }/*from w ww. j ava2s . c o m*/ writer.writeCharacters(input.getIdentifier().getCode()); writer.writeEndElement(); // "ows:Title" (minOccurs="0", maxOccurs="1") if (input.getTitle() != null) { writer.writeStartElement(OWS_NS, "Title"); if (input.getTitle().getLanguage() != null) { writer.writeAttribute("xml:lang", input.getTitle().getLanguage()); } writer.writeCharacters(input.getTitle().getString()); writer.writeEndElement(); } // "ows:Abstract" (minOccurs="0", maxOccurs="1") if (input.getAbstract() != null) { writer.writeStartElement(OWS_NS, "Abstract"); if (input.getAbstract().getLanguage() != null) { writer.writeAttribute("xml:lang", input.getAbstract().getLanguage()); } writer.writeCharacters(input.getAbstract().getString()); writer.writeEndElement(); } if (input instanceof LiteralInput) { exportLiteralInput(writer, (LiteralInput) input); } else if (input instanceof BoundingBoxInput) { exportBoundingBoxInput(writer, (BoundingBoxInput) input); } else if (input instanceof ComplexInput) { exportComplexInput(writer, (ComplexInput) input); } writer.writeEndElement(); } writer.writeEndElement(); }
From source file:org.deegree.services.wps.execute.ExecuteResponseXMLWriter.java
private static void exportLiteralInput(XMLStreamWriter writer, LiteralInput input) throws XMLStreamException { // "wps:Data" element writer.writeStartElement(WPS_NS, "Data"); // "wps:LiteralData" element writer.writeStartElement(WPS_NS, "LiteralData"); // "dataType" attribute (optional) if (input.getDataType() != null) { writer.writeAttribute("dataType", input.getDataType()); }//www .j a v a 2s .c o m // "uom" attribute (optional) if (input.getUOM() != null) { writer.writeAttribute("uom", input.getUOM()); } writer.writeCharacters(input.getValue()); writer.writeEndElement(); writer.writeEndElement(); }