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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:52:47+00:00 2026-06-01T17:52:47+00:00

I need to use a complex type defined in a different assembly in my

  • 0

I need to use a complex type defined in a different assembly in my xsd schema. Both of my .xsd schemas are defined as embedded resources and I’ve tried to link the sheet I have to import in the assembly, who needs it with no results.

Basically, when I need to validate one of my xml pages, I call this function, but it isn’t able to add in cascade the xml schema sets of the types inside Operations.

public static XmlSchema GetDocumentSchema(this Document doc)
{
    var actualType = doc.GetType();
    var stream = actualType.Assembly.GetManifestResourceStream(actualType.FullName);

    if (stream == null)
    {
        throw new FileNotFoundException("Unable to load the embedded file [" + actualType.FullName + "]");
    }

    var documentSchema = XmlSchema.Read(stream, null);

    foreach (XmlSchemaExternal xmlInclude in documentSchema.Includes)
    {
        var includeStream = xmlInclude.SchemaLocation != "Operations.xsd" 
            ? actualType.Assembly.GetManifestResourceStream(xmlInclude.Id) 
            : typeof (Operations).Assembly.GetManifestResourceStream(xmlInclude.Id);

        if (includeStream == null)
        {
            throw new FileNotFoundException("Unable to load the embedded include file [" + xmlInclude.Id + "]");
        }

        xmlInclude.Schema = XmlSchema.Read(includeStream, null); 
    }

    return documentSchema;
}

This is the main schema:

<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="ExampleSheet"
       attributeFormDefault="unqualified"
       elementFormDefault="qualified"
       xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:include id="Operations" schemaLocation="Operations.xsd"/>
  <xs:element name="ExampleSheet">
    <xs:complexType>
      <xs:sequence>
      <xs:element name="Operations" type="Operations"/>
    </xs:sequence>
    <xs:attribute name="version" type="xs:string" use="required"/>
  </xs:complexType>
  </xs:element>
</xs:schema>    

And this is the schema of Operations:

<xs:schema id="Operations"    
  elementFormDefault="qualified"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
>
<xs:element name="Operations" type="Operations"/>
  <xs:complexType name="Operations">
    <xs:choice minOccurs="1" maxOccurs="unbounded">
      <xs:element name="Insert" type="Insert"/>
      <xs:element name="InsertUpdate" type="InsertUpdate"/>
      <xs:element name="Update" type="Update"/>
      <xs:element name="Delete" type="Delete"/>
    </xs:choice>
    <xs:attribute name="version" type="xs:string" use="required"/>
    <xs:attribute name="store" type="xs:string" use="required"/>
    <xs:attribute name="chain" type="xs:string" use="optional"/>
  </xs:complexType>
</xs:schema>

For example, if I have an ExampleSheet with an Insert, it isn’t able to recognize it. Operations and Insert are classes who implement IXmlSerializable, and the first one retrieves the schema sets of the inner types using a custom XmlSchemaProvider.

Am I doing something wrong?
How can I help my ExampleSheet to accet the members of Operations?
Should it ExampleSheet implement IXmlSerializable so I can build the reader and writer as I want, and would the schema be still useful?

  • 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-01T17:52:49+00:00Added an answer on June 1, 2026 at 5:52 pm

    Instead of XmlSchema, have you looked into the XmlSchemaSet class?

    I have not done a lot with XML Serialization, so I don’t know if it will fit your current application, but I’ve used it before in a similar situation where I have to refer to types defined in 3 separate schemas.

    The complete XmlSchemaSet object will then have access to all of the types in each of the schemas.

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

Sidebar

Related Questions

I would like to use complex numbers as defined in C99, but I need
I have following complex query which I need to use. When I run it,
I have the following complex type in my XML schema: <xs:complexType name=Widget mixed=true> <xs:sequence>
I need to rig up an XSD schema that will validate files partially. The
I have a bunch of XSD's from https://github.com/XeroAPI/XeroAPI-Schemas/tree/master/v2.00 I need to do two things:
So, I need use this event so I can navigate trought blog posts. I
Need to use own imaged markers instead built-in pins. I have several questions. 1.
I need to use sed to convert all occurences of ##XXX## to ${XXX} .
I need to use an alias in the WHERE clause, but It keeps telling
I need to use NSImage which appears need to be imported from <AppKit/AppKit.h> .

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.