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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T09:21:06+00:00 2026-05-18T09:21:06+00:00

I have a XML schema like: <?xml version=1.0 encoding=utf-8?> <xs:schema id=MySchema targetNamespace=http://tempuri.org/MySchema.xsd elementFormDefault=qualified xmlns=http://tempuri.org/MySchema.xsd

  • 0

I have a XML schema like:

<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="MySchema"
    targetNamespace="http://tempuri.org/MySchema.xsd"
    elementFormDefault="qualified"
    xmlns="http://tempuri.org/MySchema.xsd"
    xmlns:mstns="http://tempuri.org/MySchema.xsd"
    xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="MyDocument">
    <xs:complexType>
      <xs:all>
        <xs:element name="TextHeader" type="xs:string" minOccurs="0" />
        <xs:element name="TextBody" type="xs:string" minOccurs="0" />
      </xs:all>
    </xs:complexType>
  </xs:element>
</xs:schema>

A valid XML document according to this schema would be:

<?xml version="1.0" encoding="utf-8" ?>
<MyDocument xmlns="http://tempuri.org/MySchema.xsd">
  <TextHeader>My header which is almost always the same...</TextHeader>
  <TextBody>My text body which is always different...</TextBody>
</MyDocument>

Question 1: Is there a way to “include” the TextHeader element from another file?

Like so:

File “Header.xml”:

<?xml version="1.0" encoding="utf-8" ?>
<MyDocument xmlns="http://tempuri.org/MySchema.xsd">
  <TextHeader>My Header which is almost always the same...</TextHeader>
</MyDocument>

File “CompleteDocument.xml”:

<?xml version="1.0" encoding="utf-8" ?>
<MyDocument xmlns="http://tempuri.org/MySchema.xsd">

  include "Header.xml" ???

  <TextBody>My text body which is always different...</TextBody>
</MyDocument>

Question 2: If it’s possible at all, will the .NET XMLSerializer be able to parse and understand the document containing such an “include…”?

Thank you for help in advance!

  • 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-18T09:21:07+00:00Added an answer on May 18, 2026 at 9:21 am

    No to both questions. You could code something (like how app.config allows sections to be imported, or how xslt handles includes/imports), but this is not inbuilt onto any XML spec and would not match the existing schema. You’d have to do everything yourself, basically.

    If you really wanted to go this route, writing a custom XmlReader that recognised a specific element (in a specific xmlns) and silently merging at that point – would perhaps be the beat choice.

    • 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 that looks like this: <?xml version=1.0 encoding=utf-8?> <Schema Namespace=EDIManagement.Models.Store
If you have a Java object and an XML schema (XSD), what is the
I have an XML schema that includes multiple addresses: <xs:element name=personal_address maxOccurs=1> <!-- address
I have a XML schema that I will need to create Java classes for.
I have an XML schema that represents a product in a DB, and I
I have an XML file and an XML schema in another file and I'd
I have a custom XML schema defined for page display that puts elements on
I have run across an XML Schema with the following definition: <xs:simpleType name=ClassRankType> <xs:restriction
Are there any tools to effectively compare two XML schema's? I have seen some
I have a xml blob that's checked against a schema in sql 2005. My

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.