Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Convert XML Schema

Avatar of KaranHoefling
KaranHoeflingFlag for United States of America asked on
Web Languages and Standards
9 Comments1 Solution1143 ViewsLast Modified:
Hi Experts -

I'm trying to convert some XML received from a web service to an ADO dataset, update some data values, and then export it back out to XML for sending back to the web service. The problem is that one of the XML nodes is repeated several times within the same parent node, so when I try to convert to a dataset I get the error: "A column named 'Fees' already belongs to this DataTable: cannot set a nested table name to the same name.". From what I've researched so far it appears that I should use XSLT to convert the schema and eliminate the duplicate names, and then use another XSLT script to convert it back when I'm finished.

Below is an example of one of the problem nodes followed by an example of a possible converted format that I could then import to a dataset. It looks like all I have to do is eliminate the Fees and RegFee nodes and then put them back. Can someone please provide me with the XSLT scripts I need to convert back and forth between these 2 formats?

Thanks in advance,
Karan

- original and final xml:
     <MiscFee>
          <Fee1>
            <Fees>
              <RegFee>
                <Fee>100</Fee>
                <Total>100</Total>
              </RegFee>
            </Fees>
            <TotalTax>100</TotalTax>
          </Fee1>
          <Fee2>
            <Fees>
              <RegFee>
                <Fee>200</Fee>
                <Total>200</Total>
              </RegFee>
            </Fees>
            <TotalTax>200</TotalTax>
          </Fee2>
          <DiscountTotal>300</DiscountTotal>
        </MiscFee>

- working xml for dataset import/export:
        <MiscFee>
          <Fee1>
             <Fee>100</Fee>
             <Total>100</Total>
             <TotalTax>100</TotalTax>
          </Fee1>
          <Fee2>
             <Fee>200</Fee>
             <Total>200</Total>
             <TotalTax>200</TotalTax>
          </Fee2>
          <DiscountTotal>300</DiscountTotal>
        </MiscFee>




ASKER CERTIFIED SOLUTION
Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)Flag of Belgium imageInformation Architect
Commented:
This problem has been solved!
Unlock 1 Answer and 9 Comments.
See Answers