public static String getUniquePrefix(XMLStreamWriter writer, String namespaceURI) throws XMLStreamException { return getUniquePrefix(writer, namespaceURI, false); } public static String getUniquePrefix(XMLStreamWriter writer) {
public static String getUniquePrefix(XMLStreamWriter writer, String namespaceURI) throws XMLStreamException { return getUniquePrefix(writer, namespaceURI, false); } public static String getUniquePrefix(XMLStreamWriter writer) {
public static String getUniquePrefix(XMLStreamWriter writer, String namespaceURI) throws XMLStreamException { return getUniquePrefix(writer, namespaceURI, false); } public static String getUniquePrefix(XMLStreamWriter writer) {
public static String getUniquePrefix(XMLStreamWriter writer, String namespaceURI) throws XMLStreamException { return getUniquePrefix(writer, namespaceURI, false); } public static String getUniquePrefix(XMLStreamWriter writer) {
public static String getUniquePrefix(XMLStreamWriter writer, String namespaceURI) throws XMLStreamException { return getUniquePrefix(writer, namespaceURI, false); } public static String getUniquePrefix(XMLStreamWriter writer) {
/** * Create a unique namespace uri/prefix combination. * * @return The namespace with the specified URI. If one doesn't exist, one * is created. * @throws XMLStreamException */ public static String getUniquePrefix(XMLStreamWriter writer, String namespaceURI, boolean declare) throws XMLStreamException { String prefix = writer.getPrefix(namespaceURI); if (prefix == null) { prefix = getUniquePrefix(writer); if (declare) { writer.setPrefix(prefix, namespaceURI); writer.writeNamespace(prefix, namespaceURI); } } return prefix; } public static String getUniquePrefix(XMLStreamWriter writer, String namespaceURI)
/** * Create a unique namespace uri/prefix combination. * * @param nsUri * @return The namespace with the specified URI. If one doesn't exist, one * is created. * @throws XMLStreamException */ public static String getUniquePrefix(XMLStreamWriter writer, String namespaceURI, boolean declare) throws XMLStreamException { String prefix = writer.getPrefix(namespaceURI); if (prefix == null) { prefix = getUniquePrefix(writer); if (declare) { writer.setPrefix(prefix, namespaceURI); writer.writeNamespace(prefix, namespaceURI); } } return prefix; } public static String getUniquePrefix(XMLStreamWriter writer, String namespaceURI)
/** * Create a unique namespace uri/prefix combination. * * @return The namespace with the specified URI. If one doesn't exist, one * is created. * @throws XMLStreamException */ public static String getUniquePrefix(XMLStreamWriter writer, String namespaceURI, boolean declare) throws XMLStreamException { String prefix = writer.getPrefix(namespaceURI); if (prefix == null) { prefix = getUniquePrefix(writer); if (declare) { writer.setPrefix(prefix, namespaceURI); writer.writeNamespace(prefix, namespaceURI); } } return prefix; } public static String getUniquePrefix(XMLStreamWriter writer, String namespaceURI)
/** * Create a unique namespace uri/prefix combination. * * @return The namespace with the specified URI. If one doesn't exist, one * is created. * @throws XMLStreamException */ public static String getUniquePrefix(XMLStreamWriter writer, String namespaceURI, boolean declare) throws XMLStreamException { String prefix = writer.getPrefix(namespaceURI); if (prefix == null) { prefix = getUniquePrefix(writer); if (declare) { writer.setPrefix(prefix, namespaceURI); writer.writeNamespace(prefix, namespaceURI); } } return prefix; } public static String getUniquePrefix(XMLStreamWriter writer, String namespaceURI)
/** * Create a unique namespace uri/prefix combination. * * @return The namespace with the specified URI. If one doesn't exist, one * is created. * @throws XMLStreamException */ public static String getUniquePrefix(XMLStreamWriter writer, String namespaceURI, boolean declare) throws XMLStreamException { String prefix = writer.getPrefix(namespaceURI); if (prefix == null) { prefix = getUniquePrefix(writer); if (declare) { writer.setPrefix(prefix, namespaceURI); writer.writeNamespace(prefix, namespaceURI); } } return prefix; } public static String getUniquePrefix(XMLStreamWriter writer, String namespaceURI)
public String getPrefixForNamespace(String ns) { try { String pfx = writer.getPrefix(ns); if (pfx == null) { pfx = StaxUtils.getUniquePrefix(writer); writer.setPrefix(pfx, ns); writer.writeNamespace(pfx, ns); } return prefix; } catch (XMLStreamException e) { throw new DatabindingException("Error writing document.", e); } }
public String getPrefixForNamespace(String ns) { try { String pfx = writer.getPrefix(ns); if (pfx == null) { pfx = StaxUtils.getUniquePrefix(writer); writer.setPrefix(pfx, ns); writer.writeNamespace(pfx, ns); } return prefix; } catch (XMLStreamException e) { throw new DatabindingException("Error writing document.", e); } }
protected String getFaultCodePrefix(XMLStreamWriter writer, QName faultCode) throws XMLStreamException { String codeNs = faultCode.getNamespaceURI(); String prefix = null; if (codeNs.length() > 0) { prefix = faultCode.getPrefix(); if (!StringUtils.isEmpty(prefix)) { String boundNS = writer.getNamespaceContext().getNamespaceURI(prefix); if (StringUtils.isEmpty(boundNS)) { writer.writeNamespace(prefix, codeNs); } else if (!codeNs.equals(boundNS)) { prefix = null; } } if (StringUtils.isEmpty(prefix)) { prefix = StaxUtils.getUniquePrefix(writer, codeNs, true); } } return prefix; }
protected String getFaultCodePrefix(XMLStreamWriter writer, QName faultCode) throws XMLStreamException { String codeNs = faultCode.getNamespaceURI(); String prefix = null; if (codeNs.length() > 0) { prefix = faultCode.getPrefix(); if (!StringUtils.isEmpty(prefix)) { String boundNS = writer.getNamespaceContext().getNamespaceURI(prefix); if (StringUtils.isEmpty(boundNS)) { writer.writeNamespace(prefix, codeNs); } else if (!codeNs.equals(boundNS)) { prefix = null; } } if (StringUtils.isEmpty(prefix)) { prefix = StaxUtils.getUniquePrefix(writer, codeNs, true); } } return prefix; }
private void writeWrapper(Message message, BindingOperationInfo bop, XMLStreamWriter xmlWriter) { if (bop.isUnwrapped()) { MessageInfo messageInfo; if (isRequestor(message)) { messageInfo = bop.getWrappedOperation().getOperationInfo().getInput(); } else { messageInfo = bop.getWrappedOperation().getOperationInfo().getOutput(); } MessagePartInfo outPart = messageInfo.getMessageParts().get(0); QName name = outPart.getConcreteName(); try { String pfx = StaxUtils.getUniquePrefix(xmlWriter, name.getNamespaceURI()); xmlWriter.setPrefix(pfx, name.getNamespaceURI()); xmlWriter.writeStartElement(pfx, name.getLocalPart(), name.getNamespaceURI()); xmlWriter.writeNamespace(pfx, name.getNamespaceURI()); } catch (XMLStreamException e) { throw new Fault(new org.apache.cxf.common.i18n.Message("STAX_WRITE_EXC", BUNDLE), e); } } }
public void writeAttribute(String uri, String name, String value) throws XMLStreamException { if (!StringUtils.isEmpty(uri)) { String pfx = StaxUtils.getUniquePrefix(this, uri, false); addEvent(factory.createAttribute(pfx, uri, name, value)); } else { addEvent(factory.createAttribute(name, value)); } } public void setPrefix(String pfx, String uri) throws XMLStreamException {
public void writeAttribute(String uri, String name, String value) throws XMLStreamException { if (!StringUtils.isEmpty(uri)) { String pfx = StaxUtils.getUniquePrefix(this, uri, false); addEvent(factory.createAttribute(pfx, uri, name, value)); } else { addEvent(factory.createAttribute(name, value)); } } public void setPrefix(String pfx, String uri) throws XMLStreamException {
public void writeAttribute(String uri, String name, String value) throws XMLStreamException { if (!StringUtils.isEmpty(uri)) { String pfx = StaxUtils.getUniquePrefix(this, uri, false); addEvent(factory.createAttribute(pfx, uri, name, value)); } else { addEvent(factory.createAttribute(name, value)); } } public void setPrefix(String pfx, String uri) throws XMLStreamException {
public void writeAttribute(String uri, String name, String value) throws XMLStreamException { if (!StringUtils.isEmpty(uri)) { String pfx = StaxUtils.getUniquePrefix(this, uri, false); addEvent(factory.createAttribute(pfx, uri, name, value)); } else { addEvent(factory.createAttribute(name, value)); } } public void setPrefix(String pfx, String uri) throws XMLStreamException {
public void writeAttribute(String uri, String name, String value) throws XMLStreamException { if (!StringUtils.isEmpty(uri)) { String pfx = StaxUtils.getUniquePrefix(this, uri, false); addEvent(factory.createAttribute(pfx, uri, name, value)); } else { addEvent(factory.createAttribute(name, value)); } } public void setPrefix(String pfx, String uri) throws XMLStreamException {