List of usage examples for javax.xml.stream XMLStreamWriter writeAttribute
public void writeAttribute(String localName, String value) throws XMLStreamException;
From source file:org.tolven.assembler.facesconfig.FacesConfigAssembler.java
protected boolean addLifeCycleTemplates(PluginDescriptor pluginDescriptor, XMLStreamWriter xmlStreamWriter) throws XMLStreamException { boolean added = false; xmlStreamWriter.writeStartElement("xsl:template"); xmlStreamWriter.writeAttribute("name", "addLifeCycles"); xmlStreamWriter.writeCharacters("\n"); for (Extension extension : getExtensions(pluginDescriptor, "lifecycle")) { Parameter phaseListener = extension.getParameter("phase-listener"); String phaseListenerString = null; if (phaseListener != null) { phaseListenerString = phaseListener.valueAsString(); }/* w w w .ja va 2s . c o m*/ addLifeCycle(phaseListenerString, xmlStreamWriter); added = true; } xmlStreamWriter.writeEndElement(); xmlStreamWriter.writeCharacters("\n"); return added; }
From source file:org.xmlsh.commands.internal.json2xml.java
private void write(JSONObject obj, XMLStreamWriter writer) throws XMLStreamException, InvalidArgumentException, JSONException { writer.writeStartElement("", "object", kJXML_URI); if (bFirstElement) writer.writeDefaultNamespace(kJXML_URI); bFirstElement = false;/* w w w . j a va2s . c o m*/ Iterator<?> keys = obj.keys(); while (keys.hasNext()) { Object k = keys.next(); writer.writeStartElement("", "member", kJXML_URI); String name = k.toString(); writer.writeAttribute("name", name); Object v = obj.get(name); write(v, writer); writer.writeEndElement(); } writer.writeEndElement(); }