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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:47:10+00:00 2026-06-13T12:47:10+00:00

I have an XML document with such format: <?xml version=1.0 encoding=utf-8?> <books-feed xmlns={NS-URL}> <generation-date>{DATE}</generation-date>

  • 0

I have an XML document with such format:

<?xml version="1.0" encoding="utf-8"?>
<books-feed xmlns="{NS-URL}">
<generation-date>{DATE}</generation-date>
<book id="{BOOK-ID}">
    <title>{BOOK-TITLE}</title>
    <author>{BOOK-AUTHOR}</author>
    .......................................... ← other information tags [any]
</book>
.............................................. ← other <book> elements
</books-feed>

And I’m trying to validate this file with this XSD-schema:

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="books-feed">
    <xsd:complexType>
        <xsd:sequence>
            <xsd:element name="generation-date" type="xsd:string"/>
            <xsd:element name="book" maxOccurs="unbounded">
                <xsd:complexType>
                    <xsd:sequence>
                        <xsd:any maxOccurs="unbounded" processContents="lax"/>
                    </xsd:sequence>
                    <xsd:attribute name="id" type="xsd:integer" use="required"/>
                </xsd:complexType>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>
</xsd:element>
</xsd:schema>

So DOMDocument::schemaValidate() returns FALSE. Is this problem in namespaces (books-feed xmlns=”{NS-URL}” not equals schema xmlns)? Or I need insert xsd:attribute for xmlns book-feed into schema (in will cause “Invalid schema” warning). Or what?

  • 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-13T12:47:11+00:00Added an answer on June 13, 2026 at 12:47 pm

    Yes, you have to make sure that you have an XSD with a targetNamespace which matches the one of the root element.

    <xsd:schema xmlns="{NS-URL}" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="{NS-URL}" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <xsd:element name="books-feed">
              ....
      </xsd:element>
    </xsd:schema>
    

    Assuming you want your XSD to match the provided XML, then your valid XSD may look as below:

    <?xml version="1.0" encoding="utf-8"?>
    <!--XML Schema generated by QTAssistant/XML Schema Refactoring (XSR) Module (http://www.paschidev.com)-->
    <xsd:schema xmlns="{NS-URL}" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="{NS-URL}" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <xsd:element name="books-feed">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="generation-date" type="xsd:string" />
            <xsd:element maxOccurs="unbounded" name="book">
              <xsd:complexType>
                <xsd:sequence>
                  <xsd:element name="title" type="xsd:string" />
                  <xsd:element name="author" type="xsd:string" />
                        <xsd:any maxOccurs="unbounded" processContents="lax" minOccurs="0"/>
                </xsd:sequence>
                <xsd:attribute name="id" type="xsd:string" use="required" />
              </xsd:complexType>
            </xsd:element>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
    </xsd:schema>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Xml document: <?xml version=1.0 encoding=utf-8?> <Family xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xmlns:xsd=http://www.w3.org/2001/XMLSchema> <Person member=father id=0>
Lets say I have the following XML file: <?xml version=1.0 encoding=utf-8?> <Customers xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:noNamespaceSchemaLocation=Customer.xsd>
Consider we have the following xml document <?xml version=1.0 encoding=utf-8?> <Root> <Child /> </Root>
I have an xml document with the following structure: <?xml version=1.0 encoding=UTF-8?> <items> <item>
In Flex, I have an xml document such as the following: var xml:XML =
If I have a simple XML document such as <case id=37d3c93c-3201-4002-b24f-08e1221c3cb7> <party id=26dad8c5-9487-48f2-8911-1d78c00095b2>...</party> <illustration
I have an xml sitemap structured like a document tree, such that it looks
I have an XML document that I'm trying to search through. The Main structure
I have an XML document composed of several other XML documents appended to it.
I have an XML document, and I want to print the tag names and

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.