Package com.sun.star.xml.dom

Examples of com.sun.star.xml.dom.XNode


     *      the node of the newly created element
     * @throws com.sun.star.xml.dom.DOMException
     */
    public XNode createElement( XNode _parentElement, String _elementName, String _initialNodeValue ) throws DOMException
    {
        XNode node = _parentElement.appendChild(
            m_model.getUIHelper().createElement( _parentElement, _elementName )
        );
        if ( _initialNodeValue != null )
            node.setNodeValue( _initialNodeValue );
        return node;
    }
View Full Code Here


     *      the DOM node, which has already been inserted into the DOM tree
     * @throws com.sun.star.xml.dom.DOMException
     */
    public XNode createAttribute( XNode _parentElement, String _attribName, String _initialNodeValue ) throws DOMException
    {
        XNode node = _parentElement.appendChild(
            m_model.getUIHelper().createAttribute( _parentElement, _attribName )
        );
        if ( _initialNodeValue != null )
            node.setNodeValue( _initialNodeValue );
        return node;
    }
View Full Code Here

        // create a simple structure in the DOM tree: an element with two attributes
        String[] modelNames = m_document.getXFormModelNames();
        m_defaultModel = m_document.getXFormModel( modelNames[0] );
        Instance defaultInstance = m_defaultModel.getDefaultInstance();
        XNode stringElement = defaultInstance.createElement( "stringElement" );
        XNode booleanAttrib = defaultInstance.createAttribute( stringElement, "booleanAttribute", "true" );
        XNode dateAttrib = defaultInstance.createAttribute( stringElement, "dateAttribute" );

        assure( "booleanAttrib's parent is wrong",
            UnoRuntime.areSame( stringElement, booleanAttrib.getParentNode() ) );
        assure( "dateAttrib's parent is wrong",
            UnoRuntime.areSame( stringElement, dateAttrib.getParentNode() ) );

        // also create bindings for the element and its attributes, of the proper type
        m_stringBinding = m_defaultModel.createBindingForNode( stringElement, DataTypeClass.STRING );
        m_booleanBinding = m_defaultModel.createBindingForNode( booleanAttrib, DataTypeClass.BOOLEAN );
        m_dateBinding = m_defaultModel.createBindingForNode( dateAttrib, DataTypeClass.DATE );
View Full Code Here

     *      the node of the newly created element
     * @throws com.sun.star.xml.dom.DOMException
     */
    public XNode createElement( XNode _parentElement, String _elementName, String _initialNodeValue ) throws DOMException
    {
        XNode node = _parentElement.appendChild(
            m_model.getUIHelper().createElement( _parentElement, _elementName )
        );
        if ( _initialNodeValue != null )
            node.setNodeValue( _initialNodeValue );
        return node;
    }
View Full Code Here

    public XNode removeNode( XNode _parentElement, String _elementName ) throws DOMException
    {
        XNodeList nodes = _parentElement.getChildNodes();
        for ( int i=0; i<nodes.getLength(); ++i )
        {
            XNode node = nodes.item(i);
            if ( node.getLocalName().equals( _elementName ) )
            {
                _parentElement.removeChild( node );
                return node;
            }
        }
View Full Code Here

     *      the DOM node, which has already been inserted into the DOM tree
     * @throws com.sun.star.xml.dom.DOMException
     */
    public XNode createAttribute( XNode _parentElement, String _attribName, String _initialNodeValue ) throws DOMException
    {
        XNode node = _parentElement.appendChild(
            m_model.getUIHelper().createAttribute( _parentElement, _attribName )
        );
        if ( _initialNodeValue != null )
            node.setNodeValue( _initialNodeValue );
        return node;
    }
View Full Code Here

        // create a simple structure in the DOM tree: an element with two attributes
        String[] modelNames = m_document.getXFormModelNames();
        m_defaultModel = m_document.getXFormModel( modelNames[0] );
        Instance defaultInstance = m_defaultModel.getDefaultInstance();
        XNode stringElement = defaultInstance.createElement( "stringElement" );
        XNode booleanAttrib = defaultInstance.createAttribute( stringElement, "booleanAttribute", "true" );
        XNode dateAttrib = defaultInstance.createAttribute( stringElement, "dateAttribute" );

        // when it comes to saving and loading, only one child of the root element of the instance
        // is handled (is this a bug? see xmloff/source/xforms/XFormsInstanceContext.cxx, method
        // CreateChildContext).
        // So, we remove the default node of the instance which it has all the time
        defaultInstance.removeNode( "instanceData" );

        assure( "booleanAttrib's parent is wrong",
            UnoRuntime.areSame( stringElement, booleanAttrib.getParentNode() ) );
        assure( "dateAttrib's parent is wrong",
            UnoRuntime.areSame( stringElement, dateAttrib.getParentNode() ) );

        // also create bindings for the element and its attributes, of the proper type
        m_stringBinding = m_defaultModel.createBindingForNode( stringElement, DataTypeClass.STRING );
        m_booleanBinding = m_defaultModel.createBindingForNode( booleanAttrib, DataTypeClass.BOOLEAN );
        m_dateBinding = m_defaultModel.createBindingForNode( dateAttrib, DataTypeClass.DATE );
View Full Code Here

     *      the node of the newly created element
     * @throws com.sun.star.xml.dom.DOMException
     */
    public XNode createElement( XNode _parentElement, String _elementName, String _initialNodeValue ) throws DOMException
    {
        XNode node = _parentElement.appendChild(
            m_model.getUIHelper().createElement( _parentElement, _elementName )
        );
        if ( _initialNodeValue != null )
            node.setNodeValue( _initialNodeValue );
        return node;
    }
View Full Code Here

    public XNode removeNode( XNode _parentElement, String _elementName ) throws DOMException
    {
        XNodeList nodes = _parentElement.getChildNodes();
        for ( int i=0; i<nodes.getLength(); ++i )
        {
            XNode node = nodes.item(i);
            if ( node.getLocalName().equals( _elementName ) )
            {
                _parentElement.removeChild( node );
                return node;
            }
        }
View Full Code Here

     *      the DOM node, which has already been inserted into the DOM tree
     * @throws com.sun.star.xml.dom.DOMException
     */
    public XNode createAttribute( XNode _parentElement, String _attribName, String _initialNodeValue ) throws DOMException
    {
        XNode node = _parentElement.appendChild(
            m_model.getUIHelper().createAttribute( _parentElement, _attribName )
        );
        if ( _initialNodeValue != null )
            node.setNodeValue( _initialNodeValue );
        return node;
    }
View Full Code Here

TOP

Related Classes of com.sun.star.xml.dom.XNode

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.