Click here to Skip to main content
13,004,215 members (80,389 online)
Rate this:
Please Sign up or sign in to vote.
See more:
using xsd.exe tool to create XML Schema (XSD) for the following file

by xsd.exe and \dataset option , or drag xsd file directly in solution explorer and write this code
Time t = new Time();

error meassage appear when using dataset for this xsd schema
The same table 'Name' cannot be the child table in two nested relations.

how can i solve this problem ?
I want to handle this schema without
change "name" element to "hourName" and "dayName" for example or change "number" element to attribute,since another program (not open source) take generated XML file to deal with.
Posted 19-Mar-13 12:45pm
Updated 19-Mar-13 12:55pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You could rename the nodes with XSLT and then read it in, and then rename them back when writing the output.

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl=""
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
    <xsl:output method="xml" indent="yes"/>
  <xsl:template match="*">
    <xsl:param name="parentElm">
      <xsl:value-of select="name(..)" />
      <xsl:when test="local-name() = 'Name'">
        <xsl:element name="{concat('Name',$parentElm)}">
          <xsl:apply-templates select="@* | node()" />
        <xsl:element name="{local-name()}">
          <xsl:copy-of select="@*" />
          <xsl:apply-templates select="@* | node()" />

I took the XSLT example from here:[^]
ibrahim_ragab 20-Mar-13 10:45am
thanks very much
but how can I use xslt file in C# code?
and how can I generate it for large xml that contain hundred of conversions(edit in visual studio text editor will be hard)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170627.1 | Last Updated 20 Mar 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100