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

  • Home
  • SEARCH
  • 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 4081696
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:05:38+00:00 2026-05-20T18:05:38+00:00

i have xsd and xml file. xml parse fine when validation is turned off.

  • 0

i have xsd and xml file. xml parse fine when validation is turned off.
but with xsd validation it complains about root element in xsd being null.

  1. my xsd file is having multiple global elements. so basically this can be a problem.
    i guess from xsd,XOM take root element as null. if you can confirm on it

  2. how to declare root element in xsd file and whats best way to do it, in xsd restricting global elements to just 1 element doesnt look good to me


<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://www.popcornmonsters.com/"
xmlns="http://www.popcornmonsters.com/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
attributeFormDefault="unqualified">

<xs:element name="address_book" >
<xs:complexType>
<xs:sequence>
<xs:element ref="entry" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>

<xs:element name="email" type="xs:string"/>
<xs:element name="first_name" type="xs:string"/>
<xs:element name="last_name" type="xs:string"/>

<xs:element name="entry">
<xs:complexType>
<xs:sequence>
<xs:element ref="first_name" minOccurs="0"/>
<xs:element ref="last_name" minOccurs="0"/>
<xs:element ref="email" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

<?xml version="1.0" encoding="UTF-8"?>
<address_book xmlns="http://www.popcornmonsters.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.popcornmonsters.com/address_book.xsd">
<entry>
<first_name>Ken</first_name>
<last_name>Cochrane</last_name>
<email>ken@fakeURL.no</email>
</entry>
<entry>
<first_name>Emily</first_name>
<last_name>Cochrane</last_name>
<email>Emily@fakeURL.no</email>
</entry>
</address_book>
  • 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-20T18:05:39+00:00Added an answer on May 20, 2026 at 6:05 pm

    Your schema is basically Ok, only that it allows at most one <entry> element; you probably want maxOccurs=”unbounded” at that point.

    However, to solve your problem we need to know more about how you set up the parsing/validation and what tools you use. If it is xom.nu you’re using, make sure you pass a namespace aware, schema validating XMLReader to the Builder instance,

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

Sidebar

Related Questions

I have a simple doc.xml file which contains a single root element with a
I have an XML file that I used to create an XSD File and
I have an XML Schema Definition file .XSD who's elements are in Spanish. I
It seems I can't easily have an XSD declaration for this simple XML <root>
I have a XML file and a a bunch of XSD files with schemas.
I have a very large XML file that I need to parse so I
I'm creating an xml file and have an XSD file to work against. I'm
I have an XML document, base XSD file and extended XSD file. Both XSD
I have an XSD file and I want to create an XML file at
I have an XML file that is validated against an XSD file. When a

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.