muteXe
September 3rd, 2010, 01:46 PM
Hiya,
Sample xml:
<Logging>
<LoggingLevel level="low" />
<LoggingSystemLocal file="filetx.log" directory="/proj/log" permissions="0600" />
</Logging>
and corresponding xsd (auto-generated):
<xs:element name="LoggingLevel">
<xs:complexType>
<xs:attribute name="level" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
<xs:element name="LoggingSystemLocal">
<xs:complexType>
<xs:attribute name="file" type="xs:string" use="required" />
<xs:attribute name="directory" type="xs:string" use="required" />
<xs:attribute name="permissions" type="xs:unsignedShort" use="required" />
</xs:complexType>
</xs:element>
i am trying to apply enumerations to certain attiributes. For example, I only want the values "low" and "high" to be allowed for logging level.
I've read loads of pages and can't enumerations to work for some reason. Something like the 2nd green box on this site: http://www.w3schools.com/schema/schema_complex.asp. I'm thinking that as i'm trying to assign enums and min and max values to attributes, rather than elements, i need to do something extra but cant see what.
Anyone have any ideas? I'm a xml/xsd noob.
Many thanks in advance,
Tom
Sample xml:
<Logging>
<LoggingLevel level="low" />
<LoggingSystemLocal file="filetx.log" directory="/proj/log" permissions="0600" />
</Logging>
and corresponding xsd (auto-generated):
<xs:element name="LoggingLevel">
<xs:complexType>
<xs:attribute name="level" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
<xs:element name="LoggingSystemLocal">
<xs:complexType>
<xs:attribute name="file" type="xs:string" use="required" />
<xs:attribute name="directory" type="xs:string" use="required" />
<xs:attribute name="permissions" type="xs:unsignedShort" use="required" />
</xs:complexType>
</xs:element>
i am trying to apply enumerations to certain attiributes. For example, I only want the values "low" and "high" to be allowed for logging level.
I've read loads of pages and can't enumerations to work for some reason. Something like the 2nd green box on this site: http://www.w3schools.com/schema/schema_complex.asp. I'm thinking that as i'm trying to assign enums and min and max values to attributes, rather than elements, i need to do something extra but cant see what.
Anyone have any ideas? I'm a xml/xsd noob.
Many thanks in advance,
Tom