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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:19:37+00:00 2026-06-17T15:19:37+00:00

I have an xsd to validate an xml file, but I’m getting the error

  • 0

I have an xsd to validate an xml file, but I’m getting the error Invalid content was found starting with element 'user'. One of '{user}' is expected.

If I change the namespace declaration to xmlns:synchronisation="synchronisation" and put synchronisation:syncQueryMapping as the root tag, but keep the rest the same, it is validated, but I do not understand why this works, why it is necessary and why the rest of the tags don’t require it.

I can’t seem to understand & fix the issue, so any help would be greatly appreciated!

Thanks!

The xml file:

<?xml version="1.0" encoding="UTF-8"?>
<syncQueryMapping xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="synchronisation"
    xsi:schemaLocation="synchronisation syncQueryMappingSchema.xsd">

    <user>
        <tableName></tableName>
        <nameColumn></nameColumn>
        <passwordColumn></passwordColumn>
    </user>
    <group>
        <tableName></tableName>
        <nameColumn></nameColumn>
    </group>
    <userGroupMapping>
        <tableName></tableName>
        <userNameColumn></userNameColumn>
        <groupNameColumn></groupNameColumn>
    </userGroupMapping>

</syncQueryMapping>

The xsd:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
    jaxb:version="1.0" targetNamespace="synchronisation" xmlns="synchronisation">

    <!-- JAXB Configuration -->
    <xs:annotation>
        <xs:appinfo>
            <jaxb:schemaBindings>
                <jaxb:package name="synchronisation.implementation" />
            </jaxb:schemaBindings>
        </xs:appinfo>
    </xs:annotation>

    <xs:complexType name="dbSyncUserType" >
        <xs:sequence>
            <xs:element type="xs:string" name="tableName" />
            <xs:element type="xs:string" name="nameColumn" />
            <xs:element type="xs:string" name="passwordColumn" />
            <xs:element type="xs:string" name="suspendStartDateColumn" minOccurs="0" />
            <xs:element type="xs:string" name="suspendEndDateColumn" minOccurs="0" />
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="dbSyncGroupType">
        <xs:sequence>
            <xs:element type="xs:string" name="tableName" />
            <xs:element type="xs:string" name="nameColumn" />
            <xs:element type="xs:string" name="typeColumn" minOccurs="0" />
            <xs:element type="typeColumnDataTypeType" name="typeColumnDataType" minOccurs="0" />
            <xs:element type="xs:string" name="typeValue" minOccurs="0" />
        </xs:sequence>
    </xs:complexType>

    <xs:simpleType name="typeColumnDataTypeType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="INTEGER" />
            <xs:enumeration value="VARCHAR" />
        </xs:restriction>
    </xs:simpleType>

    <xs:complexType name="dbSyncUserTableJoinType">
        <xs:sequence>
            <xs:element type="xs:string" name="userKeyColumn" />
            <xs:element type="xs:string" name="mappingsForeignKeyColumn" />
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="dbSyncGroupTableJoinType">
        <xs:sequence>
            <xs:element type="xs:string" name="groupKeyColumn" />
            <xs:element type="xs:string" name="mappingsForeignKeyColumn" />
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="dbSyncUserGroupMappingJoinType">
        <xs:sequence>
            <xs:element type="dbSyncUserTableJoinType" name="userTable" />
            <xs:element type="dbSyncGroupTableJoinType" name="groupTable" />
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="dbSyncUserGroupMappingType">
        <xs:sequence>
            <xs:element type="xs:string" name="tableName" />
            <xs:element type="xs:string" name="userNameColumn" />
            <xs:element type="xs:string" name="groupNameColumn" />
            <xs:element type="dbSyncUserGroupMappingJoinType" name="join" minOccurs="0" />
        </xs:sequence>
    </xs:complexType>

    <!-- Root element -->
    <xs:element name="syncQueryMapping">
        <xs:complexType>
            <xs:sequence>
                <xs:element type="dbSyncUserType" name="user" />
                <xs:element type="dbSyncGroupType" name="group" />
                <xs:element type="dbSyncUserGroupMappingType" name="userGroupMapping" />
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>
  • 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-17T15:19:38+00:00Added an answer on June 17, 2026 at 3:19 pm

    When you added xmlns="synchronisation" to your XML document you are specifying that all nested elements without a prefix belong to that namespace (syncQueryMapping and user).

    <syncQueryMapping 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        xmlns="synchronisation"
        xsi:schemaLocation="synchronisation syncQueryMappingSchema.xsd">
        <user>
            ....
    

    You need to add elementFormDefault="qualified" on the root element in your XML schema to indicate that all the elements in a XML document corresponding to this XML schema are namespace qualified.

    <xs:schema 
        xmlns:xs="http://www.w3.org/2001/XMLSchema" 
        xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
        jaxb:version="1.0" 
        targetNamespace="synchronisation" 
        xmlns="synchronisation"
        elementFormDefault="qualfied">
    

    Without that specified in order for your XML document to be valid only the global elements should be namespace qualfied. This would mean you could not use a default namespace.

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

Sidebar

Related Questions

I have a standard code like below to validate xml against xsd, but it
I have two xsd files to validate a xml. But the problem is my
I am working on getting an xml file to validate against an XSD schema
I have an XML file that I'm trying to validate against an XSD file
I have xml File with element date type: ... <startDate /> ... in xsd
I have one xsd file ,I used xmlpad to validate this xsd against xml
I have an XML file and a XSD file, I want to validate the
I want to validate an XML file against an XSD schema. The XML files
I have a simple doc.xml file which contains a single root element with a
I want to validate xml against xsd file. So I would like to install

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.