Package org.apache.vysper.xml.fragment

Examples of org.apache.vysper.xml.fragment.XMLText


        List<XMLText> innerTexts = authStanza.getInnerTexts();
        if (innerTexts == null || innerTexts.isEmpty()) return AUTHORIZATION_RESPONSES.getFailureMalformedRequest();

        // retrieve credential payload and decode from BASE64
        XMLText base64Encoded = innerTexts.get(0);
        byte[] decoded;
        try {
            decoded = Base64.decodeBase64(base64Encoded.getText().getBytes());
        } catch (Throwable e) {
            return AUTHORIZATION_RESPONSES.getFailure(SASLFailureType.INCORRECT_ENCODING);
        }

        // parse clear text, extract parts, which are separated by zeros
View Full Code Here


                    xmlFragments.add(xmlInnerElement);
                } else {
                    return name.equals(elementEvent.element.rawname); // succeed if exact end element found and all is balanced
                }
            } else if (event.type == XMLEvent.CDATA) {
                xmlFragments.add(new XMLText(event.toString()));
            } else if (event.type == XMLEvent.CHARACTERS) {
                XMLString xmlString = ((CharactersEvent) event).text;
                xmlFragments.add(new XMLText(xmlString.toString()));
            } else {
                // ignore other types, as of XMPP spec
            }
        }
    }
View Full Code Here

        return attributes;
    }

    private static List<XMLFragment> createFragments(String message) {
        List<XMLFragment> fragments = new ArrayList<XMLFragment>();
        if(message != null) fragments.add(new XMLText(message));
        return fragments;
    }
View Full Code Here

    }

    private static List<XMLFragment> createFragments(String reason) {
        List<XMLFragment> fragments = new ArrayList<XMLFragment>();
        if(reason != null) {
            XMLElement reasonElm = new XMLElement(NamespaceURIs.XEP0045_MUC, "reason", null, null, new XMLFragment[]{new XMLText(reason)});
            fragments.add(reasonElm);
        }
        return fragments;
    }
View Full Code Here

import org.apache.vysper.xmpp.protocol.NamespaceURIs;

public class Password extends XMLElement {

    public Password(String password) {
        super(NamespaceURIs.XEP0045_MUC, "password", null, null, new XMLFragment[]{new XMLText(password)});
    }
View Full Code Here

    assertRendering("<foo xmlns=\"http://example.com\"><bar xmlns=\"\"></bar></foo>", builder.build());
  }
 
  public void testRenderSimpleText() {
    XMLElement elm = new XMLElement(null, "foo", null, null, new XMLFragment[]{
        new XMLText("bar")
    });
    assertRendering("<foo>bar</foo>", elm);
  }
View Full Code Here

    assertRendering("<foo>bar</foo>", elm);
  }

  public void testRenderTextWithAmpersand() {
    XMLElement elm = new XMLElement(null, "foo", null, null, new XMLFragment[]{
        new XMLText("ba&r")
    });
    assertRendering("<foo>ba&amp;r</foo>", elm);
  }
View Full Code Here

    assertRendering("<foo>ba&amp;r</foo>", elm);
  }

  public void testRenderTextWithGt() {
    XMLElement elm = new XMLElement(null, "foo", null, null, new XMLFragment[]{
        new XMLText("ba>r")
    });
    assertRendering("<foo>ba&gt;r</foo>", elm);
  }
View Full Code Here

    assertRendering("<foo>ba&gt;r</foo>", elm);
  }

  public void testRenderTextWithLt() {
    XMLElement elm = new XMLElement(null, "foo", null, null, new XMLFragment[]{
        new XMLText("ba<r")
    });
    assertRendering("<foo>ba&lt;r</foo>", elm);
  }
View Full Code Here

        List<XMLFragment> innerFragments = stanza.getInnerFragments();

        // inner frags are immutable
        int size = innerFragments.size();
        try {
            innerFragments.add(new XMLText("not insertable"));
            fail("fragments should be immutable");
        } catch (UnsupportedOperationException e) {
            // succeeded
        }
        assertEquals("nothing inserted", size, innerFragments.size());
View Full Code Here

TOP

Related Classes of org.apache.vysper.xml.fragment.XMLText

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.