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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:41:39+00:00 2026-05-17T22:41:39+00:00

I am using XML Data Mapping and having a problem with generating complex types

  • 0

I am using XML Data Mapping and having a problem with generating complex types while using it.

If i am having an XML like below its working fine

<?xml version="1.0" standalone="yes" ?>
<Sample>
      <connection>
        <item  Name="ABC">123</item>
        <item  Name="XYZ">123</item>
        <item  Name="MNO">123</item>
      </connection>
      <connection>
        <item  Name="ABC">123</item>
        <item  Name="XYZ">123</item>
        <item  Name="MNO">123</item>
      </connection>
</Sample>

I am getting complex types as SampleType, ConnectionType and ItemType.

But if i have the XML like

<?xml version="1.0" standalone="yes" ?>
<Sample>
      <connection>
        <item  Name="ABC"/>
        <item  Name="XYZ"/>
        <item  Name="MNO"/>
      </connection>
      <connection>
        <item  Name="ABC"/>
        <item  Name="XYZ"/>
        <item  Name="MNO"/>
      </connection>
</Sample>

I am getting complex types as SampleType, ConnectionType, ItemType, ItemType2, ItemType22, ItemType222, ItemType2222, and ItemType22222 i.e., ItemTypes were equal to number of items present in the XML.

Why this is happening and how can i solve this problem?.

  • 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-17T22:41:39+00:00Added an answer on May 17, 2026 at 10:41 pm

    It is because the data mapper is not meant to infer data from an XML file (or better phrased XML document), but from an XML Schema.

    An XML Schema describes the syntax an XML document should adhere to.

    XML schema’s can for instance be stored as XSD files, or DTD files.

    So the first step you should take is to create an XSD schema.
    You could start with generating an XSD from the XML, then polishing that XSD.

    The online XML-2-XSD tool can help you with generating that XSD, but there are many more tools.

    Then use that XSD in the data mapper, and you make a much better chance.

    Note: XML types are defined differently than most programming languages, so you cannot always map your XML data types to Delphi. Your simple case will work, but as soon as you do recursion or null in XML, it can get pretty hairy.

    Edit: added XSD sample for both XML documents.

    I used XmlForAsp to infer the XSD so you have a head start.

    The inferred XSD for both the first and second XML document is the same:

    <?xml version="1.0" encoding="utf-16"?>
    <xsd:schema attributeFormDefault="unqualified" elementFormDefault="qualified" version="1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <xsd:element name="Sample" type="SampleType" />
      <xsd:complexType name="SampleType">
        <xsd:sequence>
          <xsd:element maxOccurs="unbounded" name="connection" type="connectionType" />
        </xsd:sequence>
      </xsd:complexType>
      <xsd:complexType name="connectionType">
        <xsd:sequence>
          <xsd:element maxOccurs="unbounded" name="item" type="itemType" />
        </xsd:sequence>
      </xsd:complexType>
      <xsd:complexType name="itemType">
        <xsd:attribute name="Name" type="xsd:string" />
      </xsd:complexType>
    </xsd:schema>
    

    –jeroen

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

Sidebar

Related Questions

I'm using the XML data source feature in Reporting Services 2005 but having some
I using SiteMapPath with an xml file for data. I would like to use
I am returning XML data from the Yahoo GeoPlanet web service using HttpWebRequest .
I`m using Delphi 2009 and want to operate some XML data. I heard that
Apple strongly recommends using the binary plist format when reading large XML-based data sets
I'm loading data into a DataSet from an XML file using the ReadXml method.
I have an application which extracts data from an XML file using XPath. If
I'm using HttpWebRequest to pull down XML, and POST data back to a 'WebService'
I have a problem getting my change(s) to data object retrieved using NHibernate to
I'm using System.Xml.XmlElement as a parameter for sending XML data in WCF. Is this

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.