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

  • Home
  • SEARCH
  • 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 5985863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:35:28+00:00 2026-05-22T22:35:28+00:00

I have a very complex task – create a software that imports XMl files

  • 0

I have a very complex task – create a software that imports XMl files to MSSQL database. There is one serious problem – each file has different structure than datatable. Example :

DATABASE:
It has columns like : ImageURL, Title, Content

XML:
Each XML file is different , I’ll give you two examples :

  1. <contents>
        <ImageURL>www.123.com/image.png</ImageURL>
        <Title>Some text</title>
        <Content>Content of item</Content>
    </contents>
    <contents>
        <ImageURL>www.123.com/image.png</ImageURL>
        <Title>Some text</title>
        <Content>Content of item</Content>
    </contents>
    

2.

<item imageURL="url" title="title" content="content">

Is there any open source solution to this ?

* UPDATE *

I forgot to let you know that I will be using this code with an ASP.NET application in following steps:

  1. The user selects the url of the XML document which he wants to import
  2. The user would selectthe tags he wants to import to the database in GUI
  3. in code behind, rule for importing current file will be created and stored to database .

Any tips/tricks how to achieve this in the most simple way ? if you don’t have source code, please give me some hints. thanks
BE AWARE THAT EACH FILE HAS DIFFERENT STRUCTURE

  • 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-22T22:35:29+00:00Added an answer on May 22, 2026 at 10:35 pm

    You need to figure out the different version you have and write some code to handle each xml-structure.

    You can do like this in SQL Server

    1:

    declare @XML xml
    
    set @XML = 
    '<contents>
        <ImageURL>www.123.com/image.png</ImageURL>
        <Title>Some text</Title>
        <Content>Content of item</Content>
    </contents>
    <contents>
        <ImageURL>www.123.com/image.png</ImageURL>
        <Title>Some text</Title>
        <Content>Content of item</Content>
    </contents>'
    
    select 
      N.value('ImageURL[1]', 'varchar(max)') as ImageURL,
      N.value('Title[1]', 'varchar(max)') as Title,
      N.value('Content[1]', 'varchar(max)') as Content
    from @XML.nodes('/contents') as T(N)
    

    Result:

    ImageURL               Title      Content
    ---------------------  ---------  ---------------
    www.123.com/image.png  Some text  Content of item
    www.123.com/image.png  Some text  Content of item
    

    2:

    declare @XML xml
    set @XML = '<item imageURL="url" title="title" content="content"></item>'
    
    select 
      N.value('@imageURL', 'varchar(max)') as ImageURL,
      N.value('@title', 'varchar(max)') as Title,
      N.value('@content', 'varchar(max)') as Content
    from @XML.nodes('item') as T(N)
    

    Result:

    ImageURL   Title     Content
    --------   -----     -------
    url        title     content
    

    3.

    declare @XML xml
    
    set @XML = 
    '<contents>
      <content>
        <someOtherNode>
          <ImageURL>www.FirstURL.com/image.png</ImageURL>
        </someOtherNode>
      </content>
    </contents>
    <contents>
      <content>
        <someOtherNode>
          <ImageURL>www.SecondURL.com/image.png</ImageURL>
        </someOtherNode>
      </content>
    </contents>'
    
    select 
      N.value('ImageURL[1]', 'varchar(max)') as ImageURL
    from @XML.nodes('/contents/content/someOtherNode') as T(N)
    

    Result:

    ImageURL
    ---------------------------
    www.FirstURL.com/image.png
    www.SecondURL.com/image.png
    

    4.

    declare @XML xml
    
    set @XML = 
    '<content>
       <imageURL>
         <url>first url</url>
       </imageURL>
       <info>
         <title>title 1</title>
         <text>text 1</text>
       </info>
     </content>
     <content>
       <imageURL>
         <url>second url</url>
       </imageURL>
       <info>
         <title>title 2</title>
         <text>text 2</text>
       </info>
     </content>'
    
    select 
      N.value('imageURL[1]/url[1]', 'varchar(max)') as ImageURL,
      N.value('info[1]/title[1]', 'varchar(max)') as Title,
      N.value('info[1]/text[1]', 'varchar(max)') as Content
    from @XML.nodes('/content') as T(N)
    

    Result:

    ImageURL    Title    Content
    ---------   -------  -------
    first url   title 1  text 1
    second url  title 2  text 2
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an idea for a web-based service. The implementation is very complex. There
i have very simple problem. I need to create model, that represent element of
I have a set of complex Excel files (with figures in it) that I
So, we have a very large and complex website that requires a lot of
We have very strange problem, one of our applications is continually querying server by
I have very little experience building software for Windows, and zero experience using the
I have a very large code base that contains extensive unit tests (using CppUnit).
We have some very large data files (5 gig to 1TB) where we need
I have very simple select like this: SELECT * FROM table WHERE column1 IN
I have a very strange problem. Under some elusive circumstances I fail to apply

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.