Search in sources :

Example 1 with OMAttribute

use of org.apache.axiom.om.OMAttribute in project webservices-axiom by apache.

the class TestGetAttributeTypeDefault method runTest.

@Override
protected void runTest() throws Throwable {
    OMFactory factory = metaFactory.getOMFactory();
    OMNamespace ns = factory.createOMNamespace("http://www.me.com", "axiom");
    OMAttribute at = factory.createOMAttribute("id", ns, "value");
    assertEquals("CDATA", at.getAttributeType());
}
Also used : OMFactory(org.apache.axiom.om.OMFactory) OMNamespace(org.apache.axiom.om.OMNamespace) OMAttribute(org.apache.axiom.om.OMAttribute)

Example 2 with OMAttribute

use of org.apache.axiom.om.OMAttribute in project webservices-axiom by apache.

the class TestGetNamespaceURIWithoutNamespace method runTest.

@Override
protected void runTest() throws Throwable {
    OMFactory factory = metaFactory.getOMFactory();
    OMAttribute attr = factory.createOMAttribute("name", null, "value");
    assertNull(attr.getNamespaceURI());
}
Also used : OMFactory(org.apache.axiom.om.OMFactory) OMAttribute(org.apache.axiom.om.OMAttribute)

Example 3 with OMAttribute

use of org.apache.axiom.om.OMAttribute in project webservices-axiom by apache.

the class TestHasNameWithoutNamespace method runTest.

@Override
protected void runTest() throws Throwable {
    OMAttribute attr = metaFactory.getOMFactory().createOMAttribute("name", null, "value");
    assertTrue(attr.hasName(new QName("name")));
    assertFalse(attr.hasName(new QName("urn:test", "name")));
}
Also used : QName(javax.xml.namespace.QName) OMAttribute(org.apache.axiom.om.OMAttribute)

Example 4 with OMAttribute

use of org.apache.axiom.om.OMAttribute in project webservices-axiom by apache.

the class TestSetLang method runTest.

@Override
protected void runTest() throws Throwable {
    SOAPFaultText faultText = soapFactory.createSOAPFaultText();
    faultText.setLang("en");
    assertEquals("SOAP Fault Text Test : - After calling setLang method, Lang attribute value mismatch", "en", faultText.getLang());
    OMAttribute langAttribute = faultText.getAllAttributes().next();
    assertEquals("SOAP Fault Text Test : - After calling setLang method, Lang attribute local name mismaatch", SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_LOCAL_NAME, langAttribute.getLocalName());
    assertEquals("SOAP Fault Text Test : - After calling setLang method, Lang attribute namespace prefix mismatch", SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_PREFIX, langAttribute.getNamespace().getPrefix());
    assertEquals("SOAP Fault Text Test : - After calling setLang method, Lang attribute namespace uri mismatch", SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_URI, langAttribute.getNamespace().getNamespaceURI());
}
Also used : SOAPFaultText(org.apache.axiom.soap.SOAPFaultText) OMAttribute(org.apache.axiom.om.OMAttribute)

Example 5 with OMAttribute

use of org.apache.axiom.om.OMAttribute in project webservices-axiom by apache.

the class OMOutputTest method setUp.

/*
     * @see TestCase#setUp()
     */
protected void setUp() throws Exception {
    super.setUp();
    DataHandler dataHandler;
    OMFactory fac = OMAbstractFactory.getOMFactory();
    OMNamespace soap = fac.createOMNamespace("http://schemas.xmlsoap.org/soap/envelope/", "soap");
    envelope = fac.createOMElement("Envelope", soap);
    OMElement body = fac.createOMElement("Body", soap);
    OMNamespace dataName = fac.createOMNamespace("http://www.example.org/stuff", "m");
    OMElement data = fac.createOMElement("data", dataName);
    OMNamespace mime = fac.createOMNamespace("http://www.w3.org/2003/06/xmlmime", "mime");
    OMElement text = fac.createOMElement("name", dataName);
    OMAttribute cType1 = fac.createOMAttribute("contentType", mime, "text/plain");
    text.addAttribute(cType1);
    byte[] byteArray = new byte[] { 13, 56, 65, 32, 12, 12, 7, -3, -2, -1, 98 };
    dataHandler = new DataHandler(new ByteArrayDataSource(byteArray));
    OMText textData = fac.createOMText(dataHandler, false);
    envelope.addChild(body);
    body.addChild(data);
    data.addChild(text);
    text.addChild(textData);
}
Also used : OMFactory(org.apache.axiom.om.OMFactory) OMNamespace(org.apache.axiom.om.OMNamespace) OMText(org.apache.axiom.om.OMText) OMElement(org.apache.axiom.om.OMElement) DataHandler(javax.activation.DataHandler) OMAttribute(org.apache.axiom.om.OMAttribute) ByteArrayDataSource(org.apache.axiom.attachments.ByteArrayDataSource)

Aggregations

OMAttribute (org.apache.axiom.om.OMAttribute)198 OMElement (org.apache.axiom.om.OMElement)127 QName (javax.xml.namespace.QName)92 Iterator (java.util.Iterator)43 OMFactory (org.apache.axiom.om.OMFactory)31 OMNamespace (org.apache.axiom.om.OMNamespace)28 SynapseException (org.apache.synapse.SynapseException)28 JaxenException (org.jaxen.JaxenException)28 OMNode (org.apache.axiom.om.OMNode)14 IOException (java.io.IOException)13 Value (org.apache.synapse.mediators.Value)12 ArrayList (java.util.ArrayList)11 SynapseXPath (org.apache.synapse.util.xpath.SynapseXPath)11 XMLStreamException (javax.xml.stream.XMLStreamException)10 List (java.util.List)6 OMText (org.apache.axiom.om.OMText)6 SOAPEnvelope (org.apache.axiom.soap.SOAPEnvelope)6 Resource (org.wso2.carbon.registry.core.Resource)6 RegistryException (org.wso2.carbon.registry.core.exceptions.RegistryException)6 StringReader (java.io.StringReader)5