List of usage examples for javax.xml.stream XMLStreamWriter writeEndElement
public void writeEndElement() throws XMLStreamException;
From source file:org.apache.axiom.om.impl.util.OMSerializerUtil.java
/** * Method serializeEndpart.//from w w w .j a v a 2 s. co m * * @param writer * @throws javax.xml.stream.XMLStreamException * */ public static void serializeEndpart(XMLStreamWriter writer) throws XMLStreamException { writer.writeEndElement(); }
From source file:org.apache.axis2.policy.model.MTOM10Assertion.java
public void serialize(XMLStreamWriter writer) throws XMLStreamException { String prefix = writer.getPrefix(NS); if (prefix == null) { prefix = PREFIX;//w ww . j av a2 s . c o m writer.setPrefix(PREFIX, NS); } writer.writeStartElement(PREFIX, MTOM_SERIALIZATION_CONFIG_LN, NS); if (optional) { writer.writeAttribute(Constants.ATTR_WSP, null, Constants.Q_ELEM_OPTIONAL_ATTR.getLocalPart(), "true"); } writer.writeNamespace(PREFIX, NS); writer.writeEndElement(); }
From source file:org.apache.axis2.policy.model.MTOM11Assertion.java
public void serialize(XMLStreamWriter writer) throws XMLStreamException { String prefix = writer.getPrefix(NS); if (prefix == null) { prefix = PREFIX;/* w w w . j a va2 s .c o m*/ writer.setPrefix(PREFIX, NS); } writer.writeStartElement(PREFIX, MTOM_LN, NS); if (optional) { writer.writeAttribute(Constants.ATTR_WSP, null, Constants.Q_ELEM_OPTIONAL_ATTR.getLocalPart(), "true"); } writer.writeNamespace(PREFIX, NS); writer.writeEndElement(); }
From source file:org.apache.chemistry.opencmis.server.impl.atompub.AtomDocumentBase.java
/** * Writes a simple tag./*from w ww . j av a2 s . co m*/ */ public void writeSimpleTag(String namespace, String name, String value) throws XMLStreamException { if (value == null) { return; } XMLStreamWriter xsw = getWriter(); xsw.writeStartElement(namespace, name); xsw.writeCharacters(value); xsw.writeEndElement(); }
From source file:org.apache.chemistry.opencmis.server.impl.atompub.AtomDocumentBase.java
/** * Writes an Atom author tag.//ww w.jav a2s .com */ public void writeAuthor(String author) throws XMLStreamException { XMLStreamWriter xsw = getWriter(); xsw.writeStartElement(Constants.NAMESPACE_ATOM, "author"); writeSimpleTag(Constants.NAMESPACE_ATOM, "name", author); xsw.writeEndElement(); }
From source file:org.apache.chemistry.opencmis.server.impl.atompub.AtomDocumentBase.java
/** * Writes an Atom collection.//from w ww . j av a 2s . com */ public void writeCollection(String href, String collectionType, String text, String... accept) throws XMLStreamException { XMLStreamWriter xsw = getWriter(); xsw.writeStartElement(Constants.NAMESPACE_APP, "collection"); xsw.writeAttribute("href", href); if (collectionType != null) { xsw.writeStartElement(Constants.NAMESPACE_RESTATOM, "collectionType"); xsw.writeCharacters(collectionType); xsw.writeEndElement(); } xsw.writeStartElement(Constants.NAMESPACE_ATOM, "title"); xsw.writeAttribute("type", "text"); xsw.writeCharacters(text); xsw.writeEndElement(); for (String ct : accept) { xsw.writeStartElement(Constants.NAMESPACE_APP, "accept"); xsw.writeCharacters(ct); xsw.writeEndElement(); } xsw.writeEndElement(); }
From source file:org.apache.chemistry.opencmis.server.impl.atompub.AtomDocumentBase.java
/** * Writes a link./*from w ww. ja v a 2 s . co m*/ */ public void writeLink(String rel, String href, String type, String id) throws XMLStreamException { XMLStreamWriter xsw = getWriter(); xsw.writeStartElement(Constants.NAMESPACE_ATOM, "link"); xsw.writeAttribute("rel", rel); xsw.writeAttribute("href", href); if (type != null) { xsw.writeAttribute("type", type); } if (id != null) { xsw.writeAttribute(Constants.NAMESPACE_RESTATOM, "id", id); } xsw.writeEndElement(); }
From source file:org.apache.chemistry.opencmis.server.impl.atompub.AtomDocumentBase.java
public void writeAlternateLink(String href, String type, String kind, String title, BigInteger length) throws XMLStreamException { XMLStreamWriter xsw = getWriter(); xsw.writeStartElement(Constants.NAMESPACE_ATOM, "link"); xsw.writeAttribute("rel", Constants.REL_ALTERNATE); xsw.writeAttribute("href", href); if (type != null) { xsw.writeAttribute("type", type); }//from w w w. ja v a2s .co m if (kind != null) { xsw.writeAttribute(Constants.NAMESPACE_RESTATOM, "renditionKind", kind); } if (title != null) { xsw.writeAttribute("title", title); } if (length != null) { xsw.writeAttribute("length", length.toString()); } xsw.writeEndElement(); }
From source file:org.apache.flex.compiler.config.Configuration.java
/** * @return Metadata XML string.//from w w w . j a v a2s.c om */ private final String generateMetadata() { final XMLOutputFactory xmlOutputFactory = XMLOutputFactory.newInstance(); assert xmlOutputFactory != null : "Expect XMLOutputFactory implementation."; final StringWriter stringWriter = new StringWriter(); XMLStreamWriter xmlWriter = null; try { xmlWriter = new XMLFormatter(xmlOutputFactory.createXMLStreamWriter(stringWriter)); xmlWriter.writeStartDocument(); xmlWriter.writeStartElement("rdf", "RDF", RDF_URI); xmlWriter.setPrefix("rdf", RDF_URI); xmlWriter.writeNamespace("rdf", RDF_URI); // write rdf:Description xmlWriter.writeStartElement(RDF_URI, "Description"); xmlWriter.setPrefix("dc", DC_URI); xmlWriter.setPrefix(VersionInfo.COMPILER_NAMESPACE_PREFIX, VersionInfo.COMPILER_NAMESPACE_URI); xmlWriter.writeNamespace("dc", DC_URI); xmlWriter.writeNamespace(VersionInfo.COMPILER_NAMESPACE_PREFIX, VersionInfo.COMPILER_NAMESPACE_URI); // write dc:format xmlWriter.writeStartElement(DC_URI, "format"); xmlWriter.writeCharacters("application/x-shockwave-flash"); xmlWriter.writeEndElement(); if (isFlex()) { // write localizedTitles writeMap(xmlWriter, DC_URI, "description", localizedDescriptions); // write localizedDescription writeMap(xmlWriter, DC_URI, "title", localizedTitles); // write publisher writeCollection(xmlWriter, DC_URI, "publisher", publishers); // write creators writeCollection(xmlWriter, DC_URI, "creator", creators); // write contributor writeCollection(xmlWriter, DC_URI, "contributor", contributors); // write language writeCollection(xmlWriter, DC_URI, "language", langs); // write date writeDate(xmlWriter); } // write compiledBy writeCompiledBy(xmlWriter); // write xmlWriter.writeEndElement(); // Description xmlWriter.writeEndDocument(); } catch (XMLStreamException e) { return ""; } return stringWriter.toString(); }
From source file:org.apache.flex.compiler.config.Configuration.java
/** * Write information about the compiler that compiled the swf. * //from w w w. j a v a 2 s.c o m * @param writer * @throws XMLStreamException */ private void writeCompiledBy(XMLStreamWriter writer) throws XMLStreamException { writer.writeEmptyElement(VersionInfo.COMPILER_NAMESPACE_URI, VersionInfo.COMPILER_ELEMENT); writer.writeAttribute(VersionInfo.COMPILER_NAME_ATTRIBUTE, VersionInfo.getCompilerName()); writer.writeAttribute(VersionInfo.COMPILER_VERSION_ATTRIBUTE, VersionInfo.getCompilerVersion()); writer.writeAttribute(VersionInfo.COMPILER_BUILD_ATTRIBUTE, VersionInfo.getCompilerBuild()); writer.writeEndElement(); // compiledBy }