Package org.apache.xmlbeans

Examples of org.apache.xmlbeans.XmlObject.xmlText()


        throws Exception
    {
        XmlObject xDst = XmlObject.Factory.newInstance();
        XmlObject xSrc = XmlObject.Factory.parse( "<foo/>" );
        XmlObject newDst = xDst.set( xSrc );
        Assert.assertTrue( newDst.xmlText().equals( "<foo/>" ) );
       
        xDst = XmlObject.Factory.parse( "<bar/>" );
        xSrc = XmlObject.Factory.parse( "<foo/>" );
        XmlCursor c = xDst.newCursor();
        c.toNextToken();
View Full Code Here


        c.beginElement( "a", "foo.com" );
        c.beginElement( "b", "default.com" );
        c.beginElement( "c", "bar.com" );

        Assert.assertTrue(
            x.xmlText( options ).equals( "<foo:a><b><bar:c/></b></foo:a>" ) );
    }

    private static class Content implements ContentHandler, LexicalHandler
    {
        public void startDocument ( ) throws SAXException
View Full Code Here

        c.toNextToken();
        c.setName( new QName( "bar" ) );
        c.toNextToken();
        c.setName( new QName( "y" ) );

        Assert.assertTrue( x.xmlText().equals( "<bar y=\"a\"/>" ) );
    }
   
    //
    // Basic load up a file and iterate through it
    //
View Full Code Here

        throws Exception
    {
        XmlCursor c = XmlObject.Factory.parse( xml ).newCursor();
        XMLInputStream xmlStream = c.newXMLInputStream();
        XmlObject o = XmlObject.Factory.parse( xmlStream );
        Assert.assertTrue( o.xmlText().equals( xml ) );
    }

    private void doSaverTest ( String xml )
        throws Exception
    {
View Full Code Here

        options.put(
            XmlOptions.SAVE_SYNTHETIC_DOCUMENT_ELEMENT,
            new QName( null, "bar" ) );

        Assert.assertTrue(
            x.xmlText( options ).equals( "<bar>[FROM][TO]<foo>abcdef</foo></bar>" ) ||
                x.xmlText( options ).equals( "<bar>[TO][FROM]<foo>abcdef</foo></bar>" ) );
       
        //
       
        x = XmlObject.Factory.parse( "<foo>abcdef</foo>" );
View Full Code Here

            XmlOptions.SAVE_SYNTHETIC_DOCUMENT_ELEMENT,
            new QName( null, "bar" ) );

        Assert.assertTrue(
            x.xmlText( options ).equals( "<bar>[FROM][TO]<foo>abcdef</foo></bar>" ) ||
                x.xmlText( options ).equals( "<bar>[TO][FROM]<foo>abcdef</foo></bar>" ) );
       
        //
       
        x = XmlObject.Factory.parse( "<foo>abcdef</foo>" );
       
View Full Code Here

        Assert.assertTrue( !cFrom.moveXml( cTo ) );
        cFrom.insertChars( "[FROM]" );
        cTo.insertChars( "[TO]" );

        Assert.assertTrue(
            x.xmlText( options ).equals( "<bar>[FROM]<foo>abcdef</foo>[TO]</bar>" ) );
       
        //
       
        x = XmlObject.Factory.parse( "<foo>abcdef</foo>" );
       
View Full Code Here

        Assert.assertTrue( !cFrom.moveXml( cTo ) );
        cFrom.insertChars( "[FROM]" );
        cTo.insertChars( "[TO]" );

        Assert.assertTrue(
            x.xmlText( options ).equals( "<bar>[FROM]<foo>abc[TO]def</foo></bar>" ) );
       
        //
       
        x = XmlObject.Factory.parse( "<r><a>xyz</a><b>pqr</b></r>" );
       
View Full Code Here

        Assert.assertTrue( cFrom.moveXml( cTo ) );
        cFrom.insertChars( "[FROM]" );
        cTo.insertChars( "[TO]" );

        Assert.assertTrue(
            x.xmlText().equals( "<r>[FROM]<b>pqr</b><a>xyz</a>[TO]</r>" ) );
       
        //
       
        x = XmlObject.Factory.parse( "<r><a>xyz</a><b>pqr</b>AB</r>" );
       
View Full Code Here

        Assert.assertTrue( cFrom.moveXml( cTo ) );
        cFrom.insertChars( "[FROM]" );
        cTo.insertChars( "[TO]" );

        Assert.assertTrue(
            x.xmlText().equals( "<r>[FROM]<b>pqr</b>A<a>xyz</a>[TO]B</r>" ) );
       
        //
       
        x = XmlObject.Factory.parse( "<r><a>xyz</a><b>pqr</b>AB</r>" );
       
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.