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

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


    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

     * Returns a new document impl.
     *
     * @see javax.xml.parsers.DocumentBuilder#newDocument()
     */
    public Document newDocument() {
        OMDOMFactory factory = new OMDOMFactory();
        DocumentImpl documentImpl = new DocumentImpl(factory);
        documentImpl.setComplete(true);
        return documentImpl;
    }
View Full Code Here

    }

    public Document parse(InputSource inputSource) throws SAXException,
            IOException {
        try {
            OMDOMFactory factory = new OMDOMFactory();
            // Not really sure whether this will work :-?
            XMLStreamReader reader = XMLInputFactory.newInstance()
                    .createXMLStreamReader(inputSource.getCharacterStream());
            StAXOMBuilder builder = new StAXOMBuilder(factory, reader);
            DocumentImpl doc = (DocumentImpl) builder.getDocument();
View Full Code Here

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

    /**
     * @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) {
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 void testCreateElement() {
    String tagName = "LocalName";
    String namespace = "http://ws.apache.org/axis2/ns";
        OMDOMFactory fac = new OMDOMFactory();
    DocumentImpl doc = new DocumentImpl(fac);
    Element elem = doc.createElement(tagName);
   
    assertEquals("Local name misnatch",tagName, elem.getNodeName());
   
View Full Code Here

    String attrName = "attrIdentifier";
    String attrValue = "attrValue";
    String attrNs = "http://ws.apache.org/axis2/ns";
    String attrNsPrefix = "axis2";
   
        OMDOMFactory fac = new OMDOMFactory();
        DocumentImpl doc = new DocumentImpl(fac);
    Attr attr = doc.createAttribute(attrName);

    assertEquals("Attr name mismatch",attrName,attr.getName());
    assertNull("Namespace value should be null", attr.getNamespaceURI());
View Full Code Here

  }
 
  public void testCreateText() {
    String textValue = "temp text value";
   
        OMDOMFactory fac = new OMDOMFactory();
        DocumentImpl doc = new DocumentImpl(fac);
    Text txt = doc.createTextNode(textValue);
   
    assertEquals("Text value mismatch", textValue, txt.getData());
  }
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.