/** * Creates a new OMNamespace. * * @see org.apache.axiom.om.OMFactory#createOMNamespace(String, String) */ public OMNamespace createOMNamespace(String uri, String prefix) { return new NamespaceImpl(uri, prefix); }
public OMNamespace getNamespace() { return new NamespaceImpl(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI, SOAP11Constants.SOAP_DEFAULT_NAMESPACE_PREFIX); }
public AttrImpl(DocumentImpl ownerDocument, String name, OMFactory factory) { super(ownerDocument, factory); this.attrName = name; //If this is a default namespace attr if (OMConstants.XMLNS_NS_PREFIX.equals(name)) { this.namespace = new NamespaceImpl( OMConstants.XMLNS_NS_URI, OMConstants.XMLNS_NS_PREFIX); } }
public SOAPEnvelope createSOAPEnvelope() { return new SOAPEnvelopeImpl( new NamespaceImpl( SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI, SOAP12Constants.SOAP_DEFAULT_NAMESPACE_PREFIX), this); }
public SOAPEnvelope createSOAPEnvelope() { return new SOAPEnvelopeImpl( new NamespaceImpl( SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI, SOAP11Constants.SOAP_DEFAULT_NAMESPACE_PREFIX), this); }
/** * We use "" to store the default namespace of this element. As one can see user can not give "" * as the prefix, when he declare a usual namespace. * * @param uri */ public OMNamespace declareDefaultNamespace(String uri) { NamespaceImpl ns = new NamespaceImpl(uri, ""); if (namespaces == null) { this.namespaces = new HashMap(5); } namespaces.put("", ns); return ns; }
/** * Creates an OMElement. * * @see org.apache.axiom.om.OMFactory#createOMElement(String, String, * String) */ public OMElement createOMElement(String localName, String namespaceURI, String namespacePrefix) { NamespaceImpl ns = new NamespaceImpl(namespaceURI, namespacePrefix); return this.createOMElement(localName, ns); }
/** * Creates a new OMDOM Element node and adds it to the given parent. * * @see #createOMElement(String, OMNamespace, OMContainer) * @see org.apache.axiom.om.OMFactory#createOMElement( javax.xml.namespace.QName, * org.apache.axiom.om.OMContainer) */ public OMElement createOMElement(QName qname, OMContainer parent) throws OMException { NamespaceImpl ns; if (qname.getPrefix() != null) { ns = new NamespaceImpl(qname.getNamespaceURI(), qname.getPrefix()); } else { ns = new NamespaceImpl(qname.getNamespaceURI()); } return createOMElement(qname.getLocalPart(), ns, parent); }
return new NamespaceImpl(uri, prefix);
/** * Allows overriding an existing declaration if the same prefix was used. * * @see org.apache.axiom.om.OMElement#declareNamespace(String, String) */ public OMNamespace declareNamespace(String uri, String prefix) { if (prefix == null) { prefix = OMSerializerUtil.getNextNSPrefix(); } NamespaceImpl ns = new NamespaceImpl(uri, prefix); return declareNamespace(ns); }
public Attr createAttributeNS(String namespaceURI, String qualifiedName) throws DOMException { String localName = DOMUtil.getLocalName(qualifiedName); String prefix = DOMUtil.getPrefix(qualifiedName); if (!OMConstants.XMLNS_NS_PREFIX.equals(localName)) { this.checkQName(prefix, localName); } else { return this.createAttribute(localName); } return new AttrImpl(this, localName, new NamespaceImpl( namespaceURI, prefix), this.factory); }
/** * @param attributeName * @param attrValue * @param soapEnvelopeNamespaceURI */ protected void setAttribute(String attributeName, String attrValue, String soapEnvelopeNamespaceURI) { OMAttribute omAttribute = this.getAttribute( new QName(soapEnvelopeNamespaceURI, attributeName)); if (omAttribute != null) { omAttribute.setAttributeValue(attrValue); } else { OMAttribute attribute = new AttrImpl(this.ownerNode, attributeName, new NamespaceImpl(soapEnvelopeNamespaceURI, SOAPConstants.SOAP_DEFAULT_NAMESPACE_PREFIX), attrValue, this.factory); this.addAttribute(attribute); } }
/** * Allows overriding an existing declaration if the same prefix was used. * * @see org.apache.axiom.om.OMElement#declareNamespace (org.apache.axiom.om.OMNamespace) */ public OMNamespace declareNamespace(OMNamespace namespace) { if (namespaces == null) { this.namespaces = new HashMap(5); } if (namespace != null) { String prefix = namespace.getPrefix(); if ("".equals(prefix)) { namespace = declareDefaultNamespace(namespace.getNamespaceURI()); } else if (prefix == null) { prefix = OMSerializerUtil.getNextNSPrefix(); namespace = new NamespaceImpl(namespace.getNamespaceURI(), prefix); } if (!namespace.getPrefix().startsWith(OMConstants.XMLNS_NS_PREFIX)) { namespaces.put(namespace.getPrefix(), namespace); } } return namespace; }
public SOAPEnvelope getDefaultEnvelope() throws SOAPProcessingException { OMNamespace ns = new NamespaceImpl( SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI, SOAP12Constants.SOAP_DEFAULT_NAMESPACE_PREFIX); SOAPEnvelopeImpl env = new SOAPEnvelopeImpl(ns, this); createSOAPHeader(env); createSOAPBody(env); return env; }
public SOAPEnvelope getDefaultEnvelope() throws SOAPProcessingException { OMNamespace ns = new NamespaceImpl( SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI, SOAP11Constants.SOAP_DEFAULT_NAMESPACE_PREFIX); SOAPEnvelopeImpl env = new SOAPEnvelopeImpl(ns, this); createSOAPHeader(env); createSOAPBody(env); return env; }
public Document createDocument(String namespaceURI, String qualifiedName, DocumentType doctype) throws DOMException { // TODO Handle docType stuff OMDOMFactory fac = new OMDOMFactory(); DocumentImpl doc = new DocumentImpl(fac); fac.setDocument(doc); new ElementImpl(doc, DOMUtil.getLocalName(qualifiedName), new NamespaceImpl(namespaceURI, DOMUtil .getPrefix(qualifiedName)), fac); return doc; }
public Element createElementNS(String ns, String qualifiedName) throws DOMException { if (ns == null) ns = ""; String localName = DOMUtil.getLocalName(qualifiedName); String prefix = DOMUtil.getPrefix(qualifiedName); if(prefix == null) { prefix = ""; } //When the namespace is a default namespace if (prefix != null && !"".equals(prefix)) { this.checkQName(prefix, localName); } NamespaceImpl namespace = new NamespaceImpl(ns, prefix); return new ElementImpl(this, localName, namespace, this.factory); }
/** * Retrieves an attribute node by local name and namespace URI. * * @see org.w3c.dom.Element#getAttributeNodeNS(String, String) */ public Attr getAttributeNodeNS(String namespaceURI, String localName) { if (OMConstants.XMLNS_NS_URI.equals(namespaceURI)) { OMNamespace ns = this.findNamespaceURI(localName); String nsuri = ns != null ? ns.getNamespaceURI() : ""; AttrImpl namespaceAttr = new AttrImpl(this.ownerNode, localName, nsuri, this.factory); NamespaceImpl xmlNs = new NamespaceImpl(OMConstants.XMLNS_NS_URI); namespaceAttr.setOMNamespace(xmlNs); return namespaceAttr; } return (this.attributes == null) ? null : (Attr) this.attributes .getNamedItemNS(namespaceURI, localName); }
private void internalSerializeLocal(XMLStreamWriter writer2) throws XMLStreamException { MTOMXMLStreamWriter writer = (MTOMXMLStreamWriter) writer2; if (!this.isBinary) { writeOutput(writer); } else { if (writer.isOptimized()) { if (contentID == null) { contentID = writer.getNextContentId(); } // send binary as MTOM optimised this.attribute = new AttrImpl(this.ownerNode, "href", new NamespaceImpl("", ""), "cid:" + getContentID(), this.factory); this.serializeStartpart(writer); writer.writeOptimized(this); writer.writeEndElement(); } else { writer.writeCharacters(this.getText()); } } }
/** * Adds a new attribute. * * @see org.w3c.dom.Element#setAttributeNS(String, String, String) */ public void setAttributeNS(String namespaceURI, String qualifiedName, String value) throws DOMException { if (namespaceURI != null && !"".equals(namespaceURI)) { if (namespaceURI.equals(OMConstants.XMLNS_NS_URI)) { this.declareNamespace(value, DOMUtil .getLocalName(qualifiedName)); } else { AttrImpl attr = new AttrImpl(this.ownerNode, DOMUtil .getLocalName(qualifiedName), value, this.factory); attr.setOMNamespace(new NamespaceImpl(namespaceURI, DOMUtil .getPrefix(qualifiedName))); this.setAttributeNodeNS(attr); } } else { // When the namespace is null, the attr name given better not be // a qualified name // But anyway check and set it this.setAttribute(DOMUtil.getLocalName(qualifiedName), value); } }