Jump to content

enumeration values


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 post
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 post
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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...