Package org.apache.axis2.om.impl.dom.factory

Examples of org.apache.axis2.om.impl.dom.factory.OMDOMFactory


  /**
   * @see javax.xml.parsers.DocumentBuilder#parse(java.io.File)
   */
  public Document parse(File file) throws SAXException, IOException {
    try {
      OMDOMFactory factory = new OMDOMFactory();
      XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new FileInputStream(file));
      StAXOMBuilder builder = new StAXOMBuilder(factory,reader);
      return (DocumentImpl)builder.getDocument();
    }catch (XMLStreamException e) {
      throw new SAXException(e);
View Full Code Here


  public ElementImplTest(String name) {
    super(name);
  }
 
  public void testSetText() {
    OMDOMFactory factory = new OMDOMFactory();
    String localName = "TestLocalName";
    String namespace = "http://ws.apache.org/axis2/ns";
    String prefix = "axis2";
    OMElement elem = factory.createOMElement(localName,namespace,prefix);
   
    String text = "The quick brown fox jumps over the lazy dog";
   
    elem.setText(text);
   
View Full Code Here

    assertEquals("Text value mismatch", text, elem.getText());
   
  }
 
  public void testSerialize() {
    OMDOMFactory factory = new OMDOMFactory();
    String localName = "TestLocalName";
    String namespace = "http://ws.apache.org/axis2/ns";
    String prefix = "axis2";
    String tempText = "The quick brown fox jumps over the lazy dog";
    String textToAppend = " followed by another";
   
    OMElement elem = factory.createOMElement(localName,namespace,prefix);
    OMText textNode = factory.createText(elem,tempText);
   
    ((Text)textNode).appendData(textToAppend);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    try {
      elem.serialize(baos);
View Full Code Here

      fail(e.getMessage());
    }
  }
 
  public void testAddChild() {
    OMDOMFactory factory = new OMDOMFactory();
    String localName = "TestLocalName";
    String childLocalName = "TestChildLocalName";
    String namespace = "http://ws.apache.org/axis2/ns";
    String prefix = "axis2";
   
    OMElement elem = factory.createOMElement(localName,namespace,prefix);
    OMElement childElem = factory.createOMElement(childLocalName,namespace, prefix);
   
    elem.addChild(childElem);
   
    Iterator it = elem.getChildrenWithName(new QName(namespace, childLocalName));
   
View Full Code Here

  public OMDOMFactoryTest(String name) {
    super(name);
  }
 
  public void testCreateElement() {
    OMDOMFactory factory = new OMDOMFactory();
    String localName = "TestLocalName";
    String namespace = "http://ws.apache.org/axis2/ns";
    String prefix = "axis2";
    OMElement elem = factory.createOMElement(localName,namespace,prefix);
    QName qname = elem.getQName();
   
    assertEquals("Localname mismatch",localName,qname.getLocalPart());
    assertEquals("Namespace mismatch",namespace,qname.getNamespaceURI());
    assertEquals("namespace prefix mismatch", prefix, qname.getPrefix());
View Full Code Here

  public TextImplTest(String name) {
    super(name);
  }

  public void testSetText() {
    OMDOMFactory factory = new OMDOMFactory();
    String localName = "TestLocalName";
    String namespace = "http://ws.apache.org/axis2/ns";
    String prefix = "axis2";
    String tempText = "The quick brown fox jumps over the lazy dog";

    OMElement elem = factory.createOMElement(localName, namespace, prefix);
    OMText textNode = factory.createText(elem, tempText);

    assertEquals("Text value mismatch", tempText, textNode.getText());
  }
View Full Code Here

    assertEquals("Text value mismatch", tempText, textNode.getText());
  }

  public void testAppendText() {
    OMDOMFactory factory = new OMDOMFactory();
    String localName = "TestLocalName";
    String namespace = "http://ws.apache.org/axis2/ns";
    String prefix = "axis2";
    String tempText = "The quick brown fox jumps over the lazy dog";
    String textToAppend = " followed by another fox";

    OMElement elem = factory.createOMElement(localName, namespace, prefix);
    OMText textNode = factory.createText(elem, tempText);

    ((Text) textNode).appendData(textToAppend);

    assertEquals("Text value mismatch", tempText + textToAppend, textNode
        .getText());
View Full Code Here

     * Creates a clone which belongs to a new document.
     *
     * @see org.apache.ws.commons.om.OMElement#cloneOMElement()
     */
    public OMElement cloneOMElement() {
        ElementImpl elem = (ElementImpl) (new StAXOMBuilder(new OMDOMFactory(),
                this.getXMLStreamReader(true))).getDocumentElement();
        return elem;
    }
View Full Code Here

    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),fac);
View Full Code Here

  public ElementImplTest(String name) {
    super(name);
  }
 
  public void testSetText() {
    OMDOMFactory factory = new OMDOMFactory();
    String localName = "TestLocalName";
    String namespace = "http://ws.apache.org/axis2/ns";
    String prefix = "axis2";
    OMElement elem = factory.createOMElement(localName,namespace,prefix);
   
    String text = "The quick brown fox jumps over the lazy dog";
   
    elem.setText(text);
   
View Full Code Here

TOP

Related Classes of org.apache.axis2.om.impl.dom.factory.OMDOMFactory

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.