You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Srdjan Djuricic <sd...@galdosinc.com> on 2007/12/06 19:38:59 UTC

XSAttributeGroupDefinition

Hello,

	<xsd:attribute name="role" type="xsd:string"/>
	<xsd:attribute name="title" type="xsd:string"/>
	<xsd:element name="price" type="xsd:string"/>
	<xsd:attributeGroup name="secondGroup">
		<xsd:attribute name="name" type="xsd:string"
fixed="extended" form="qualified"/>
	</xsd:attributeGroup>
	<xsd:attributeGroup name="firstGroup">
		<xsd:attribute name="type" type="xsd:string"
fixed="extended" form="qualified"/>
		<xsd:attributeGroup ref="test:secondGroup"/>
		<xsd:attribute ref="test:title" use="optional"/>
	</xsd:attributeGroup>

Supppose I have the following schema above and I am using XML Schema
API.  I am parsing attribute groups and I want to find out all
XSAttributeUse that an XSAttributeGroupDefinition contains.  I don't
have an issue of finding all XSAttributeUses for
XSAttributeGroupDefinition.  My issue is when parsing a
XSAttributeGroupDefinition and encountering a XSAttributeUse I don't
know how to identify whether that attributeUse is obtained from another
attributeGroup or not.

For example:
When I parse secondGroup I get a singe attribute name.

When I parse firstGroup I get three XSAttributeUses: type, name and
title.  What I would like to somehow figure out is that attributeGroup
(firstGroup) contains another attributeGroup (secondGroup ) and that
XSAttributeUse with the name set to name is actually an attribute
defined by the first attributeGroup.  

I haven't been able to determine that at all.  By using XML Schema API
all I able to figure out is that firstGroup contains three attributes.
So the following schema

	<xsd:attributeGroup name="firstGroup">
		<xsd:attribute name="type" type="xsd:string"
fixed="extended" form="qualified"/>
		<xsd:attributeGroup ref="test:secondGroup"/>
		<xsd:attribute ref="test:title" use="optional"/>
	</xsd:attributeGroup>

Is identical to this schema

	<xsd:attributeGroup name="firstGroup">
		<xsd:attribute name="type" type="xsd:string"
fixed="extended" form="qualified"/>
		<xsd:attribute name="name" type="xsd:string"
fixed="extended" form="qualified"/>
		<xsd:attribute ref="test:title" use="optional"/>
	</xsd:attributeGroup>

Thank you,

Srdjan




---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


RE: XSAttributeGroupDefinition

Posted by Srdjan Djuricic <sd...@galdosinc.com>.
Thank you Michael. 


 Be there when the Web and GIS unite! Register now for GeoWeb 2007 at
www.geoweb.org 
-----Original Message-----
From: Michael Glavassevich [mailto:mrglavas@ca.ibm.com] 
Sent: Friday, December 07, 2007 8:17 AM
To: j-users@xerces.apache.org
Subject: Re: XSAttributeGroupDefinition

Stanimir Stamenkov <s7...@netscape.net> wrote on 12/07/2007 01:34:08
AM:

> Thu, 6 Dec 2007 10:38:59 -0800, /Srdjan Djuricic/:
>
> > My issue is when parsing a
> > XSAttributeGroupDefinition and encountering a XSAttributeUse I don't

> > know how to identify whether that attributeUse is obtained from 
> > another

> > attributeGroup or not.
>
> As far as I can tell you can't determine what you want using the 
> Xerces XSModel API, but I don't think it is designed to parse an XML 
> Schema in such detail.  It implements the abstract model defined in 
> the XML Schema Structures specification and is primarily intended for 
> use of validation, i.e. it is read-only and light-weight.

Right, there's no representation of a reference to an attribute group
definition in the model. The {attribute uses} contained in them get
absorbed into the complex type definition's {attribute uses}. The spec
describes how that's computed here:
http://www.w3.org/TR/2004/REC-xmlschema-1-20041028/#declare-type. See
the definition of {attribute uses) in the sections titled "Complex Type
Definition ... Schema Component".

> I think you need another API like the Eclipse XSD model [1] to analyze

> (and possibly modify) the source XML Schema document(s) in greater 
> detail.
>
> [1] http://www.eclipse.org/modeling/mdt/?project=xsd
>
> --
> Stanimir
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org

Thanks.

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


RE: XSAttributeGroupDefinition

Posted by Srdjan Djuricic <sd...@galdosinc.com>.
Thank you Stanimir,

I will check out the API that you recommended. 


 Be there when the Web and GIS unite! Register now for GeoWeb 2007 at
www.geoweb.org 
-----Original Message-----
From: Stanimir Stamenkov [mailto:s7an10@netscape.net] 
Sent: Thursday, December 06, 2007 10:34 PM
To: j-users@xerces.apache.org
Subject: Re: XSAttributeGroupDefinition

Thu, 6 Dec 2007 10:38:59 -0800, /Srdjan Djuricic/:

> My issue is when parsing a
> XSAttributeGroupDefinition and encountering a XSAttributeUse I don't 
> know how to identify whether that attributeUse is obtained from 
> another attributeGroup or not.

As far as I can tell you can't determine what you want using the Xerces
XSModel API, but I don't think it is designed to parse an XML Schema in
such detail.  It implements the abstract model defined in the XML Schema
Structures specification and is primarily intended for use of
validation, i.e. it is read-only and light-weight.  I think you need
another API like the Eclipse XSD model [1] to analyze (and possibly
modify) the source XML Schema document(s) in greater detail.

[1] http://www.eclipse.org/modeling/mdt/?project=xsd

--
Stanimir

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


Re: XSAttributeGroupDefinition

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Stanimir Stamenkov <s7...@netscape.net> wrote on 12/07/2007 01:34:08 AM:

> Thu, 6 Dec 2007 10:38:59 -0800, /Srdjan Djuricic/:
>
> > My issue is when parsing a
> > XSAttributeGroupDefinition and encountering a XSAttributeUse I don't
> > know how to identify whether that attributeUse is obtained from another

> > attributeGroup or not.
>
> As far as I can tell you can't determine what you want using the
> Xerces XSModel API, but I don't think it is designed to parse an XML
> Schema in such detail.  It implements the abstract model defined in
> the XML Schema Structures specification and is primarily intended
> for use of validation, i.e. it is read-only and light-weight.

Right, there's no representation of a reference to an attribute group
definition in the model. The {attribute uses} contained in them get
absorbed into the complex type definition's {attribute uses}. The spec
describes how that's computed here:
http://www.w3.org/TR/2004/REC-xmlschema-1-20041028/#declare-type. See the
definition of {attribute uses) in the sections titled "Complex Type
Definition ... Schema Component".

> I think you need another API like the Eclipse XSD model [1] to analyze
> (and possibly modify) the source XML Schema document(s) in greater
> detail.
>
> [1] http://www.eclipse.org/modeling/mdt/?project=xsd
>
> --
> Stanimir
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org

Thanks.

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


Re: XSAttributeGroupDefinition

Posted by Stanimir Stamenkov <s7...@netscape.net>.
Thu, 6 Dec 2007 10:38:59 -0800, /Srdjan Djuricic/:

> My issue is when parsing a 
> XSAttributeGroupDefinition and encountering a XSAttributeUse I don't 
> know how to identify whether that attributeUse is obtained from another 
> attributeGroup or not.

As far as I can tell you can't determine what you want using the 
Xerces XSModel API, but I don't think it is designed to parse an XML 
Schema in such detail.  It implements the abstract model defined in 
the XML Schema Structures specification and is primarily intended 
for use of validation, i.e. it is read-only and light-weight.  I 
think you need another API like the Eclipse XSD model [1] to analyze 
(and possibly modify) the source XML Schema document(s) in greater 
detail.

[1] http://www.eclipse.org/modeling/mdt/?project=xsd

-- 
Stanimir

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org