Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 555531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:49:27+00:00 2026-05-13T11:49:27+00:00

I have an XML schema that uses enumerations, but when I look at the

  • 0

I have an XML schema that uses enumerations, but when I look at the generated XML object in Delphi, the enumeration restriction has been dropped. Is there any way to get Delphi to generate the enum and build it into the object?

XSD Snippet:

<xs:simpleType name="enumType" final="restriction">
    <xs:restriction base="xs:NMTOKEN">
        <xs:enumeration value="Each"/>
        <xs:enumeration value="Units"/>
        <xs:enumeration value="Area"/>
        <xs:enumeration value="Payroll"/>
        <xs:enumeration value="Sales"/>
        <xs:enumeration value="TotalCost"/>
        <xs:enumeration value="Other"/>
    </xs:restriction>
</xs:simpleType>

What I would expect to see in Delphi is a field that accepts a enum that is then converted to it’s corresponing string when the XML is generated, but that field is just an ordinary string.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T11:49:27+00:00Added an answer on May 13, 2026 at 11:49 am

    What you can do is create your own enumerated type with the same string constants as names and use the unit TypInfo with the function GetEnumValue and GetEnumString.
    This allows you to prefix the names with a few lowercase letters like in other Delphi code:

    Value :=  TMyEnum( GetEnumValue( typeinfo( TMyEnum ), Prefix + AString )  )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an XML schema that I need to extract values from but I
I have an XML schema that includes multiple addresses: <xs:element name=personal_address maxOccurs=1> <!-- address
I have a XML schema that I will need to create Java classes for.
I have an XML schema that represents a product in a DB, and I
I have a custom XML schema defined for page display that puts elements on
I have a xml blob that's checked against a schema in sql 2005. My
I have to make a schema for an XML format that's already being used.
I have run across an XML Schema with the following definition: <xs:simpleType name=ClassRankType> <xs:restriction
If you have a Java object and an XML schema (XSD), what is the
I have a number of XML schema that use JAXB (Java Architecture for XML

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.