Jump to content

enumeration values


gr4tzy

Recommended Posts

hello,i'm working on a code generator for state machines and i need to define an attribute as a simple type enumeration but i want to get the values from an xml document. For example, if this is the xml doc:<STATES> <STATE Name="LIGHTS_ON"/> <STATE Name="LIGHTS_OFF"/></STATES>I need to use the Name attributes an enumeration values in an xsd schema.is that possible? if not, pls give some similar ideas.i've tried different xpath expression but it doesn't seem to work.

Link to comment
Share on other sites

I need to do something like this. I need to reference the values from a database into the value list from the elements.It is possible? Thanks

hello,i'm working on a code generator for state machines and i need to define an attribute as a simple type enumeration but i want to get the values from an xml document. For example, if this is the xml doc:<STATES> <STATE Name="LIGHTS_ON"/> <STATE Name="LIGHTS_OFF"/></STATES>I need to use the Name attributes an enumeration values in an xsd schema.is that possible? if not, pls give some similar ideas.i've tried different xpath expression but it doesn't seem to work.
Link to comment
Share on other sites

ok, i found out:it takes 2 steps:first you have to define a key for the states like this:<xs:key name="any_name"><xs:selector xpath=".//STATE"/><xs:field xpath="@Name"/></xs:key>then you need to define a reference to that key:<xs:keyref name="any_other_name" refer="xi:any_name"><xs:selector xpath="the path of the element containing the 'enumerated' values"><xs:field="@AnAttribute or element"></xs:keyref>Note that this isn't really a simple type enumeration and i dont know if it works for all applications (it wors for mine).The attribute or element that refers to the @Name attribute does not need be defined as enumeration values.For example if you want that the attribute @Value of the element NEW_STATE to contain a list of all @Name attributes, it's enough to write:<xs:attribute name="Value"/>and nothing morefor further information visit http://www.xml.com/pub/a/2000/11/29/schema...rt1.html?page=6

I need to do something like this. I need to reference the values from a database into the value list from the elements.It is possible? Thanks
hello,i'm working on a code generator for state machines and i need to define an attribute as a simple type enumeration but i want to get the values from an xml document. For example, if this is the xml doc:<STATES> <STATE Name="LIGHTS_ON"/> <STATE Name="LIGHTS_OFF"/></STATES>I need to use the Name attributes an enumeration values in an xsd schema.is that possible? if not, pls give some similar ideas.i've tried different xpath expression but it doesn't seem to work.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...