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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T14:43:34+00:00 2026-05-16T14:43:34+00:00

I’m engaged in a debate over XML representations of groups of objects. Given an

  • 0

I’m engaged in a debate over XML representations of groups of objects. Given an object hierarchy of entities like Artist, Album and Track, with a high amount of connectivity between the object, what are the pros and cons of formatting the XML representation of a given object graph with deep XML versus using object references.

I’m firmly in the object reference camp, while others content that this model is somehow less ‘RESTful’ and that it should only be pursued if there’s a compelling reason not to use the deep objects version.

I consider the following to be fundamental flaws on the part of deep objects

  • Circular references mean there will may be multiple versions of the same object in the graph. Some objects will necessarily be incomplete.
  • If you choose to avoid circular references by only having one canonical version of a given object in the graph, you place a burden of implementing the logic to determine which instance in the graph should be treated as canonical. Further, if you’re creating a service you place this burden on both clients and servers. Further, this logic has to resolve tons of ambiguities. Which instance of an object should be canonical? The first encountered in pre-order traversal? The closest to the root (breadth first traversal)? A particular parent child relationship?
  • There is no canonical representation of a given object, essentially gutting caching opportunities on both the client and the server.
  • All logic to get a deep property has to be able to fall back on fetching the containing deep object as a top level item because you never know if the deep property is going to be there
  • The schema becomes useless because every connection between objects necessarily has to be set to occur a minimum of 0 times to avoid infinite regression from circular references.

My question is essentially, are there any significant arguments for shallow representation that I’ve missed, and what are the counter-arguments

Here is a small example of a deep object

<artist id="1234">            <!-- This object is of type Artist in the Schema-->
  <name>Lady GaGa</name>
  <sampleTrack id="1235">     <!-- This object is of type Track in the Schema-->
    <name>Poker Face</name>
    <album id="1236">        <!-- This object is of type Album in the Schema-->
      <name>The Fame Monster</name>
      ...
    </album>
  </sampleTrack> 
  <album id="1236">
    ....
    <track id="1235">
    </track>
  </album>
</artist>

Here is a similar example of using object references

Lady GaGa

<track id="1235">           <!-- This object is of type Track in the Schema-->
  <name>Poker Face</name>
  <album id="1236"/>        <!-- This object is of type Reference in the Schema-->
</track>

<album id="1236">
  <name>The Fame Monster</name>
  <track id="1235">
</album>
  • 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-16T14:43:35+00:00Added an answer on May 16, 2026 at 2:43 pm

    In terms of REST where resources can be looked up by URI, I side with you with references. What I’ve seen people do is use links:

    If the following URI can be used to look up an album:
    – http://www.example.com/albums/1236

    Then the XML representation for http://www.example.com/tracks/1235 may look like:

    <track id="1235">
      <name>Poker Face</name> 
      <album link="http://www.example.com/albums/1236"/> 
    </track> 
    

    Following the album link you would get:

    <album id="1236"> 
      <name>The Fame Monster</name> 
      <track link="http://www.example.com/tracks/1235"> 
    </album> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
I have this code to decode numeric html entities to the UTF8 equivalent character.
In my XML file chapters tag has more chapter tag.i need to display chapters
I am trying to render a haml file in a javascript response like so:
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns 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.