Thanks Sandy for your reply. That's so good and there's a lot of details that I've been looking for.
On Fri, Mar 5, 2010 at 12:58 AM, Sandy Gao <[email protected]> wrote: > Ishan, > > Difference between a schema vs. a schema document: > > * Schema > > I am a schema, I have a global element declaration named "root" in > namespace "ns1", and its type is "myType" in namespace "ns2". "myType" is > derived from the schema built-in type "int" by specifying a maxInclusive > facet of 100. > > * Schema document > > I am an <xs:schema> element, I have an attribute named "targetNamespace" > whose value is "ns1". I have a child element <xs:element>. The child has an > attribute named "name" whose value is "root". It also has an attribute named > "type" whose value is "p2:int". It also has a namespace declaration that > associates the prefix "p2" with the namespace "ns2". > > I am another <xs:schema> element, with attribute targetNamespace="ns2", > child <xs:simpleType>. <xs:simpleType> has name="myType", child > <xs:restriction>, with attribute base="xs:int", ... > > > Now you can see the difference. Schema is an abstraction: it's a collection > of schema components. Each component has its properties, like name, type, > etc. And schema document is one way to represent a schema using XML syntax. > A schema may be assembled from one or more schema documents (or it could be > built without schema documents). > > For a SCD/SCP that says "give me the global element declaration for name > {ns1}root", we should return the element declaration in the schema (an > XSElementDeclaration object), and not the <xs:element> element in the schema > document. > > > Now about the absolute part of the SCD for identifying the schema. For a > given absolute URI (e.g. http://abc.def/xyz), there is no standard way to > know which schema it's pointing to. Dereferencing the URI will return you a > sequence of bytes (maybe some kind of file), but that's not a schema. The > association of the URI with a schema has to be done through magic: in my > system, I *know* this URI corresponds to that schema (e.g. that XSModel > object). > > In the example from the spec, it's assuming that, in that particular > environment, http://example.org/schemas/po.xsd corresponds to a particular > schema. It may be that that schema is assembled from loading the schema > document at "http://example.org/schemas/po.xsd", but that's the knowledge > only meaningful in that system, and not an established standard. > > This is exactly why I suggested > > > "It'll be useful, IMO, to focus more on relative SCDs (and SCPs in > particular), than absolute SCDs." > > e.g. our SCD interface could have methods like: > > String getCanonicalSCP(XSObject component, XSModel schema, NamespaceContext > nc); > XSObjectList resolveSCP(String scp, XSModel schema, NamespaceContext nc); > > instead of > > String getCanonicalSCD(XSObject component, XSModel schema); > XSObjectList resolveSCD(String scd); > > The first 2 methods assume that the association between the absolute URI > and the schema is done (hence the XSModel is available). The latter 2 > methods operate on absolute SCDs, and will suffer from the problem of not > knowing how to construct/resolve the absolute URI for the schema. > > > Thanks, > Sandy Gao > XML Technologies, IBM Canada > Editor, *W3C XML Schema WG* <http://www.w3.org/XML/Schema> > Member, *W3C SML WG* <http://www.w3.org/XML/SML> > (1-905) 413-3255 T/L 313-3255 > > > Ishan Jayawardena <[email protected]> wrote on 2010-02-27 05:49:42 AM: > > > [image removed] > > > > Re: SCD implementation > > > > Ishan Jayawardena > > > > to: > > > > j-dev > > > > 2010-02-27 05:50 AM > > > > Please respond to j-dev > > > > Hi Sandy, > > I think more clarification is needed about the association among the > > terms, "the schema", "a schema document", and an absolute SCD. The > > spec defines the absolute SCD in the following way, > > "An absolute schema component designator identifies a particular > > schema component; it consists of two parts: a designator for the > > assembled schema (a schema designator), and a designator for a > > particular schema component or schema components relative (a relative > > schema component designator) to that assembled schema." > > But at the same time, it gives > > "http://example.org/schemas/po.xsd#xscd(/type::purchaseOrderType)" as > > an example for an absolute SCD. Obviously, the first URI part refers > > to a schema document, not to a schema but the definition mentions it > > to be an assembled schema. > > Also, you say that, > > > > > - Differences between SCD and SCP. SCD could be absolute, with an URI > to > > > identify the schema, and a fragment for the component(s) in that > schema. > > > Given that there is no defined way to resolve an URI to a schema (note: > not > > > a schema document), it'll often be difficult (and not very useful) to > work > > > with absolute SCDs. > > > > So according to you, the URI part doesn't need to be something like > > 'http://example.org/schemas/po.xsd' because it has to be a URI for an > > assembled schema. Can you please help me clarify the correct > > interpretation of absolute SCD? Why do you say that there's no defined > > way to resolve a URI to a schema? Here, are you reffering to the > > capability of Xerces of resolving a URI to a schema? > > Thanks in advance. > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [email protected] > > For additional commands, e-mail: [email protected] > > > >
