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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:13:58+00:00 2026-06-01T02:13:58+00:00

Learning xml, Can anyone help me? I have following XML code: **<book lang=en>name of

  • 0

Learning xml, Can anyone help me? I have following XML code:

**<book lang="en">name of book</book>**

i want to write a xsd file with constraint:

book tag with

  • lang att is required

  • content of book tag restriction lenght from 5 to 30 characters.

Help!! Thank everybody

  • 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-06-01T02:13:59+00:00Added an answer on June 1, 2026 at 2:13 am

    This XSD should do:

    <?xml version="1.0" encoding="utf-8"?>
    <!--W3C Schema generated by QTAssistant/W3C Schema Refactoring Module (http://www.paschidev.com)-->
    <xsd:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <xsd:element name="book">
            <xsd:complexType>
                <xsd:simpleContent>
                    <xsd:extension base="String5To30">
                        <xsd:attribute name="lang" type="xsd:string" use="required"/>
                    </xsd:extension>
                </xsd:simpleContent>
            </xsd:complexType>
        </xsd:element>
        <xsd:simpleType name="String5To30">
            <xsd:restriction base="xsd:string">
                <xsd:maxLength value="30"/>
                <xsd:minLength value="5"/>
            </xsd:restriction>
        </xsd:simpleType>
    </xsd:schema>
    

    The way I did it was to automatically generate an XSD from your XML fragment; then add the simple type that gives you the restriction vis-a-vis lengths.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am learning JPA. I read about persistence.xml file. It can contain more that
Can anyone help me, I'm a n00b at this and still learning. I simply
Learning XML Schema, I want to be able to have collections of elements inside
I am learning about XML Attributes from W3Schools . The author mentions the following
I have spent quite a few hours reading and learning about LINQ to XML , but
Can anyone direct me to a good tutorial in building an XML parser? I
I'm starting learning JAXB, so my question can be very silly. Now I have
I have just started learning android. And i don't know How can I change
I am just learning to write XML and associated DTD's, and I'm wondering if
I have a stream object, and I want to create and output xml using

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.