You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by "Peter A. Volchek" <Pe...@ti.com.od.ua> on 2002/06/27 09:48:46 UTC

Scope

To: xerces team

File: SchemaElementDecl.hpp

    //      The enclosing scope where this element is declared.
    int  fEnclosingScope;

    //      The Complex Element that this element belongs to.
    int  fDefinedScope;

Can you explain the differences between those two ?  What an "int" is represented? How to locate the corresponding object ?
And again, why to return int instead of direct object ?
In my understanding the should be only one scope member of ComplexTypeInfo type, like:

ComplexTypeInfo* fEnclosingScope;
if ( fEnclosingScope == NULL ) 
// Means the global declaration
else
// ComplexTypeIndo where element was defined

Thoughts ?

Peter



------------------------------------------------------------------------------

Here some info from XML rec:


http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/

2.2.2.1 Element Declaration
An element declaration is an association of a name with a type definition, either simple or complex, an (optional) default value and a (possibly empty) set of identity-constraint definitions. The association is either global or scoped to a containing complex type definition.

3.3.1 The Element Declaration Schema Component
{scope} 
Optional. Either global or a complex type definition.

A {scope} of global identifies element declarations available for use in content models throughout the schema. Locally scoped declarations are available for use only within the complex type identified by the {scope} property. This property is ·absent· in the case of declarations within named model groups: their scope is determined when they are used in the construction of complex type definitions.



Re: Scope

Posted by Khaled Noaman <kn...@ca.ibm.com>.
The fDefined scope is no longer used and we need to remove that data
member from the SchemaElementDecl class. Thank you for bringing that up.

The fEnclosingScope is one of the keys that is used by the SchemaGrammar
to store/retrieve elements (same element name can appear in different
scope).  Elements do not only appear in complex types but they also
appear in groups. The enclosing scope is for internal use only.

I understand that in order to get an element declaration from the
grammar you need to pass the scope of that element to the grammar as one
of the keys. I would assume that you are mostly interseted in top level
elements. All the top level elements have the same scope:
Grammar::TOP_LEVEL_SCOPE.

Khaled

"Peter A. Volchek" wrote:

> To: xerces team File: SchemaElementDecl.hpp     //      The enclosing
> scope where this element is declared.
>     int  fEnclosingScope;    //      The Complex Element that this
> element belongs to.
>     int  fDefinedScope;Can you explain the differences between those
> two ?  What an "int" is represented? How to locate the corresponding
> object ?And again, why to return int instead of direct object ?In my
> understanding the should be only one scope member of ComplexTypeInfo
> type, like: ComplexTypeInfo* fEnclosingScope;if ( fEnclosingScope ==
> NULL )// Means the global declarationelse// ComplexTypeIndo where
> element was defined Thoughts
> ? Peter   ------------------------------------------------------------------------------ Here
> some info from XML
> rec:  http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/
>
> 2.2.2.1 Element Declaration
>
> An element declaration is an association of a name with a type
> definition, either simple or complex, an (optional) default value and
> a (possibly empty) set of identity-constraint definitions. The
> association is either global or scoped to a containing complex type
> definition.
>
> 3.3.1 The Element Declaration Schema Component
>
> {scope}
>      Optional. Either global or a complex type definition.  A {scope}
> of global identifies element declarations available for use in content
> models throughout the schema. Locally scoped declarations are
> available for use only within the complex type identified by the
> {scope} property. This property is ·absent· in the case of
> declarations within named model groups: their scope is determined when
> they are used in the construction of complex type definitions.