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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T12:41:19+00:00 2026-05-29T12:41:19+00:00

Currently, I’m adding elements to my XmlDocument using XPath notation for which I’ve written

  • 0

Currently, I’m adding elements to my XmlDocument using XPath notation for which I’ve written code to that places the element at the proper location in the file. With one exception. I don’t know how to make it pay attention to the sequence rules defined in my XSD file.

Is there a way to add an element to an XmlDocument so that is abides by the sequence define in the XSD that governs my XML file?

For example, my xml document should look like:

<rootTag>
  <area name="I define an area">
    <description>some text here</description>
    <point x="1" y="1" />
    <point x="2" y="2" />
    <point x="3" y="3" />
  </area>
</rootTag>

Yet I get, depending on the order in which the user enters values for the child tags above:

<rootTag>
  <area name="I define an area">
    <point x="1" y="1" />
    <point x="2" y="2" />
    <point x="3" y="3" />
    <description>some text here</description>
  </area>
</rootTag>

To correct the above, I create a DataSet (named tempXmlDataset) from the XSD file. I pass the contents of the XmlDocument into tempXmlDataset and things get re-ordered appropriately.

However, my problem is caused by an option for the first child of the XML document. This option is defined in the XSD to allow for “area”, “line” or “point” objects. “area” and “line” both have “point” elements as children. But child “point” is not the same as “point” object. So, as you might already realize, tempXmlDataset.ReadXmlSchema(…) creates a “point” table which only has x and y in it. This is by definition of the children for “area” and “line”.

So when my code runs tempXmlDataset.ReadXml(…) the attributes for “point” object do not get read in because it sees “point” object as child “point”. Here’s an example of “point” object:

<rootTag>
  <point name="I define a point" x="3" y="3" otherAttributes="">
    <description>some text here</description>
  </point>
</rootTag>
  • 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-29T12:41:20+00:00Added an answer on May 29, 2026 at 12:41 pm

    use xsd.exe to generate the required code based on the xsd for classes. Don’t try to create the dataset for this case. You can then use the generated code together with the XmlSerializer to produce the needed xml files.

    http://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlserializer.aspx

    Also see:
    http://msdn.microsoft.com/en-us/library/ms950721.aspx

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

Sidebar

Related Questions

Currently, I am developing a product that does fairly intensive calculations using MS SQL
Currently, I'm using && and || instead of AND and OR because that's how
Currently I'm doing some unit tests which are executed from bash. Unit tests are
Currently I am adding object by creating it like: type TRecord = class private
Currently i'm having trouble using two functions in my -(void)viewDidLoad , both of these
Currently, my MVC 3 app has a dependency on a static class that is
Currently I am using Amazon Cloudfront to service static objects on my ASP.Net MVC3
Currently, Enum.Parse supports only the comma as the value separator, so that MemberOne,MemberThree will
Currently I have in my code tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(addCompoundToLabel:)]; My code
Currently I have a web service, which loads up any plugins located within its

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.