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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:49:21+00:00 2026-05-26T08:49:21+00:00

I am setting up an XML file for a web site that I am

  • 0

I am setting up an XML file for a web site that I am creating. The XML file is to contain art (image) details. Each art record can have multiple sizes available (size1, size2, etc.) for purchase and multiple categories (cat1, cat2, cat3, etc). What is the best way to setup the xml file for multiple values? Here are the two options that I can think of.


…With elements for size and category…

<?xml version='1.0' encoding='utf-8' ?>
<images>
    <image id='' ImageName=''>
        <title></title>

        <sizes>
            <size>size1</size>
            <size>size2</size>
        </sizes>

        <categories>
            <category>cat1</category>
            <category>cat2</category>
        </categories>

        <description>
            <short></short>
            <long></long>
        </description>
    </image>
</images>

with JQuery ajax, I reference each size / category with the following…

$(xml).find('image').each(function(){
    $(this).find('size').each(function(){
        var size = $(this).text();
        {do something here with the size variable}
    });
});

…OR…


…With attributes for size and category…

<?xml version='1.0' encoding='utf-8' ?>
<images>
    <image id='' ImageName='' sizes='size1 size2' category='cat1 cat2 cat3'>
        <title></title>

        <description>
            <short></short>
            <long></long>
        </description>
    </image>
</images>

with JQuery ajax, I can reference each size / category with the following…

$(xml).find('image').each(function(){
    $(this).attr('size').split(' ');
        {Loop through each split attribute}
});

Any help is much appreciated.

  • 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-26T08:49:22+00:00Added an answer on May 26, 2026 at 8:49 am

    I would take advantage of the intrinsic nature of xml to define and document the relationships in the data it marks up.

    Use of elements for multiple values conceptually keeps the xml representation of your object closer to the model without requiring you have an understanding of the domain to interpret it.

    <Image>
        <Sizes>
            <Size sizeName="size1"/>
            <Size sizeName="size2"/>
        </Sizes>
    </Image>
    

    It is clear here that there are two sizes.

    A space inside a string has no intrinsic meaning in xml

    <Image sizes="size1 size2" />
    

    This may be clear there are two size, but only because of your understanding of sizes.

    <Blarg bebos="sldkd eldks" />
    

    Is this one bebos value of sldkd eldks or two bebo values of sldkd and eldks?
    But…

    <Blarg>
        <Bepos>
            <Bepo value="sldkd"/>
            <Bepo value="eldks"/>
        </Bepos>
    </Blarg>
    

    You would not want to return to a project a year later, or pick up somebody elses code, with the intention of adding or changing functionality and not realize you had to go through extra steps to make the pure data behave properly.

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

Sidebar

Related Questions

I know invalidating a session by setting a time-out period in DD-web.xml file but
I have defined a local mirror for all repositories in the settings.xml file: <mirror>
Im attempting to load a hex literal from an xml settings file, I can
I'm setting up a simple page that just displays the contents of an XML
I have xml like this: <configurationData> <path name='b'> <path name='a'> <setting name='s1'> ![CDATA[XXXX]] </setting>
I am setting up a web service where users can include a dynmically created
I have a SharePoint web part (essentially just a Hello World app) that I
I have just short of 2 million XML documents sitting on 16gb of file
In the Telerik.Web.UI.xml file I found this entry <member name=P:Telerik.Web.UI.RadDataBoundControl.Skin> <summary>Gets or sets the
I'm setting up a User Control driven by a XML configuration. It is easier

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.