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 6645969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:21:19+00:00 2026-05-26T00:21:19+00:00

How to verify XML element with mixed content? Element can contain string Undefined or

  • 0

How to verify XML element with mixed content? Element can contain string “Undefined” or float values.
I think it can be done thru string Restriction with pattern, but maybe a better way exists?

  • 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-26T00:21:20+00:00Added an answer on May 26, 2026 at 12:21 am

    Resolved by Union element using.

    Consider below example: A sample XML defines calender dates.

    <Calender>
      <Date>
        <Date>01</Date>
        <Month>Jan</Month>
        <Year>2013</Year>
      </Date>
      <Date>
        <Date>31</Date>
        <Month>01</Month>
        <Year>2013</Year>
      </Date>
    </Calender>
    

    Since Month element has both types Int and String .. It can be resolved like the way below XSD is written:

    <?xml version="1.0" encoding="utf-8"?>
    <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
      <xs:element name="Calender" type="Calender"/>
      <xs:complexType name="Calender">
        <xs:sequence>
          <xs:element maxOccurs="unbounded" name="Date" type="Date"/>
        </xs:sequence>
      </xs:complexType>
    
      <xs:complexType name="Date">
        <xs:sequence>
          <xs:element name="Date" type="xs:unsignedByte" />
          <xs:element name="Month" type="Month" />
          <xs:element name="Year" type="xs:unsignedShort" />
        </xs:sequence>
      </xs:complexType>
    
      <xs:simpleType name="Month">
        <xs:union memberTypes="MonthNum MonthVal" />
      </xs:simpleType>
      <xs:simpleType name="MonthNum">
        <xs:restriction base="xs:int">
          <xs:minInclusive value="01"/>
          <xs:maxInclusive value="31"/>
        </xs:restriction>
      </xs:simpleType>
      <xs:simpleType name="MonthVal">
        <xs:restriction base="xs:string">
          <xs:enumeration value="Jan"/>
          <xs:enumeration value="Feb"/>
          <xs:enumeration value="Mar"/>
          <xs:enumeration value="Dec"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:schema>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this is my XML file <atm> i want to know how can i verify
I am trying to verify that a C# string is compliant with XML Schema
You can verify an XPath expression against an XML doc to verify it, but
Input is xml as a string and I have a XSD schema to verify
I wanna verify a digitally signed xml against its schema definition while this schema
I am trying to verify the content of a large list using Robotium, and
How can I verify that passing block is execute correctly ? - (void)locationManager:(CLLocationManager *)manager
I would like to sign my XDocument XML document (to verify it later on).
I am new to phing and trying to verify if my build.xml works as
I need the checksum of an XML file in order to verify that no

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.