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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:42:09+00:00 2026-05-11T19:42:09+00:00

I have an XML document containing types from 2 XML schemas. One (theirs.xsd) is

  • 0

I have an XML document containing types from 2 XML schemas. One (theirs.xsd) is a proprietary schema that I am integrating with (and cannot edit). To do this I am defining my own type (mine.xsd) that is an element within an ‘any’ element is the proprietary type.

I use Visual Studio’s xsd.exe to generate C# classes from the schemas. However, the ‘any’ element in the proprietary type is generated as XmlElement[], and therefore my type doesn’t get deserialized.

So I guess I can go one of two ways: either generate classes that will deserialize my type rather then keeping it as an XmlElement, or take the XmlElements and deserialize them individually. To deserialize I need an XmlReader, so I would need to go from an XmlElement to an XmlReader which I’m not sure how to do. Thanks.

Example:
File: theirs.xsd

<xs:element name="ProprietaryContainer">
  <xs:complexType>
    <xs:sequence>
      <xs:element name="name" type="xs:string"/>
      <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
  </xs:complexType>
</xs:element>

File: mine.xsd

<xs:element name="MyPairType">
  <xs:complexType>
    <xs:sequence>
      <xs:element name="key" type="xs:string"/>
      <xs:element name="value" type="xs:long"/>
    </xs:sequence>
  </xs:complexType>
</xs:element>

File: message.xml

<their:ProprietaryContainer>
  <their:name>pairContainer</their:name>
  <mine:MyPairType>
    <mine:key>abc</mine:key>
    <mine:value>long</mine:value>
  </mine:MyPairType>
</their:ProprietaryContainer>
  • 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-11T19:42:10+00:00Added an answer on May 11, 2026 at 7:42 pm

    From the question:

    To deserialize I need an XmlReader, so I would need to go from an XmlElement to an XmlReader which I’m not sure how to do

    using(XmlReader reader = new XmlNodeReader(element)) {
        //... use reader
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have a source xml document that uses namespace containing prefixes and a default namespace.
I have an array that is created dynamic from an xml document looking something
I have a string containing XML document using LinqtoXML What is the best way
I have an XML document that I'm trying to style via CSS. A relevant
I have an xml document object that I need to convert into a string.
I have an XML document that looks like this <Elements> <Element> <DisplayName /> <Type
I have one piece of Cocoa code I wrote that takes in an XML
I have a simple XML document containing two city id's. <?xml version=1.0 encoding=ISO-8859-1?> <config>
I have an XML document with a node containing the escaped XML serialization of
I have tons of XML files all containing a the same XML Document, but

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.