Package org.apache.xmlbeans.impl.values

Examples of org.apache.xmlbeans.impl.values.TypeStoreUser


    void setType ( SchemaType type, boolean complain )
    {
        assert type != null;
        assert isUserNode();

        TypeStoreUser user = peekUser();

        if (user != null && user.get_schema_type() == type)
            return;

        if (isRoot())
        {
            _xobj.setStableType( type );
            return;
        }

        // Gotta get the parent user to make sure this type is ok here

        TypeStoreUser parentUser = _xobj.ensureParent().getUser();

        // One may only set the type of an attribute to its 'natural' type because
        // attributes cannot take advantage of the xsiType attribute.

        if (isAttr())
        {
            if (complain && parentUser.get_attribute_type( getName() ) != type)
            {
                throw
                    new IllegalArgumentException(
                        "Can't set type of attribute to " + type.toString() );
            }

            return;
        }

        assert isElem();

        // First check to see if this type can be here sans xsi:type.
        // If so, make sure there is no xsi:type

        if (parentUser.get_element_type( getName(), null ) == type)
        {
            removeAttr( Locale._xsiType );
            return;
        }

        // If the desired type has no name, then it cannot be
        // referenced via xsi:type

        QName typeName = type.getName();

        if (typeName == null)
        {
            if (complain)
                throw new IllegalArgumentException( "Can't set type of element, type is un-named" );
            else
                return;
        }

        // See if setting xsiType would result in the target type

        if (parentUser.get_element_type( getName(), typeName ) != type)
        {
            if (complain)
                throw new IllegalArgumentException( "Can't set type of element, invalid type" );
            else
                return;
View Full Code Here


    {
        assert name != null;
        assert type != null;
        assert isUserNode();

        TypeStoreUser user = peekUser();

        if (user != null && user.get_schema_type() == type && name.equals(getName()))
            return;

        if (isRoot())
        {
            // If this is the root node, we can't set its name, so the whole
            // operation is aborted
            return;
        }

        // Gotta get the parent user to make sure this type is ok here

        TypeStoreUser parentUser = _xobj.ensureParent().getUser();

        // One may only set the type of an attribute to its 'natural' type because
        // attributes cannot take advantage of the xsiType attribute.

        if (isAttr())
        {
            if (complain)
            {
                throw
                    new IllegalArgumentException(
                        "Can't use substitution with attributes");
            }

            return;
        }

        assert isElem();

        // First check to see if this type can be here sans xsi:type.
        // If so, make sure there is no xsi:type

        if (parentUser.get_element_type( name, null ) == type)
        {
            setName( name );
            removeAttr( Locale._xsiType );
            return;
        }

        // If the desired type has no name, then it cannot be
        // referenced via xsi:type

        QName typeName = type.getName();

        if (typeName == null)
        {
            if (complain)
                throw new IllegalArgumentException( "Can't set xsi:type on element, type is un-named" );
            else
                return;
        }

        // See if setting xsiType would result in the target type
       
        if (parentUser.get_element_type( name, typeName ) != type)
        {
            if (complain)
                throw new IllegalArgumentException( "Can't set xsi:type on element, invalid type" );
            else
                return;
View Full Code Here

        if (_user == null)
        {
            // BUGBUG - this is recursive

            TypeStoreUser parentUser =
                _parent == null
                    ? ((TypeStoreUserFactory) XmlBeans.NO_TYPE).createTypeStoreUser()
                    : _parent.getUser();

            _user =
                isElem()
                    ? parentUser.create_element_user( _name, getXsiTypeName() )
                    : parentUser.create_attribute_user( _name );

            _user.attach_store( this );
        }

        return _user;
View Full Code Here

            // value as occupied and remove the user to prohibit
            // further user invalidations

            clearBit( VACANT );

            TypeStoreUser user = _user;
            _user = null;

            String value = user.build_text( this );


            long saveVersion = _locale._versionAll;
            long saveVersionSansText = _locale._versionSansText;
View Full Code Here

            if (isOccupied())
            {
                if (hasTextNoEnsureOccupancy() || hasChildren())
                {
                    TypeStoreUser user = _user;
                    _user = null;

                    Cur c = tempCur();
                    c.moveNodeContents( null, false );
                    c.release();
View Full Code Here

        assert isValid();

        if (isRoot())
            return null;

        TypeStoreUser parentUser = ensureParent().getUser();

        if (isAttr())
            return parentUser.get_attribute_field( _name );

        assert isElem();

        TypeStoreVisitor visitor = parentUser.new_visitor();

        if (visitor == null)
            return null;

        for ( Xobj x = _parent._firstChild ; ; x = x._nextSibling )
View Full Code Here

    public void store_text ( String text )
    {
        _locale.enter();

        TypeStoreUser user = _user;
        _user = null;

        try
        {
            Cur c = tempCur();
View Full Code Here

    public int compute_flags ( )
    {
        if (isRoot())
            return 0;

        TypeStoreUser parentUser = ensureParent().getUser();

        if (isAttr())
            return parentUser.get_attributeflags( _name );

        int f = parentUser.get_elementflags( _name );

        if (f != -1)
            return f;

        TypeStoreVisitor visitor = parentUser.new_visitor();

        if (visitor == null)
            return 0;

        for ( Xobj x = _parent._firstChild ; ; x = x._nextSibling )
View Full Code Here

    public String compute_default_text ( )
    {
        if (isRoot())
            return null;

        TypeStoreUser parentUser = ensureParent().getUser();

        if (isAttr())
            return parentUser.get_default_attribute_text( _name );

        String result = parentUser.get_default_element_text( _name );

        if (result != null)
            return result;

        TypeStoreVisitor visitor = parentUser.new_visitor();

        if (visitor == null)
            return null;

        for ( Xobj x = _parent._firstChild ; ; x = x._nextSibling )
View Full Code Here

        try
        {
            Cur c = x._locale.tempCur();
            c.moveTo( x, pos );
            c.createElement( name );
            TypeStoreUser user = c.getUser();
            c.release();
            return user;
        }
        finally
        {
View Full Code Here

TOP

Related Classes of org.apache.xmlbeans.impl.values.TypeStoreUser

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.