Package org.apache.xmlbeans.impl.values

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


    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

    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

            // Defensive
            if (parentType == null)
                return null;

            TypeStoreUser newUser;

            if (isBegin())
            {
                newUser =
                    parentType.create_element_user(
View Full Code Here

        return _user.get_attribute_type( attrName );
    }
   
    TypeStoreUser create_element_user ( QName eltName, QName xsiType )
    {
        TypeStoreUser ret = null;
        if (getRoot()._factory != null)
            ret = getRoot()._factory.createElementUser(get_schema_type(), eltName, xsiType);

        if (ret == null)
            ret = _user.create_element_user( eltName, xsiType );
View Full Code Here

        return ret;
    }
           
    TypeStoreUser create_attribute_user( QName attrName )
    {
        TypeStoreUser ret = null;

        if (getRoot()._factory != null)
            ret = getRoot()._factory.createAttributeUser(get_schema_type(),  attrName);

        if (ret == null)
View Full Code Here

        Type parentType = parentContainer.getType( getRoot() );

        assert parentType != null;

        TypeStoreUser parentUser = parentType._user;

        if (s.isAttr())
            return parentUser.get_attributeflags( s.getName() );

        int f = parentUser.get_elementflags( s.getName() );

        if (f != -1)
            return f;

        TypeStoreVisitor visitor = parentUser.new_visitor();

        if (visitor == null)
            return 0;

        assert !parentContainer.isLeaf();
View Full Code Here

        if (s.isDoc())
            return null;
       
        Container parentContainer = s.getContainer();

        TypeStoreUser parentUser = parentContainer.getType( getRoot() )._user;
       
        if (s.isAttr())
            return parentUser.get_attribute_field( s.getName() );

        assert s.isBegin();

        assert !parentContainer.isLeaf();
       
        TypeStoreVisitor visitor = parentUser.new_visitor();

        if (visitor == null)
            return null;

        for ( Splay t = parentContainer.nextSplay() ; ; t = t.nextSplay() )
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.