• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Blob in attribute

 
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it valid to have BLOB as attribute

where image contains blob data
Is it good design ?
Thanks and Regards
Kartik
 
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The hair on the back of my neck stood up when I read your post. I can't really tell you why, but I don't like what you're doing. Apparently there's been a long debate on what should be an attribute and what should be an element. It's possible that your image data won't be XML-compliant; since you can't smack a CDATA in an attribute, it'd be nice if you could put it in an element.
I'm still reeling from your "blob" comment--which of course is a SQL term, not an XML term.
 
Kartik Shah
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply.
To give you an insight
We have to design and xml schema for XForm based tool.
1. Data will be entered in this tool(MS Infopath or similar) and save as XML. This may contain photograph of facilities.
2. XML will be uploaded/emailed.
3. Engine needs to put data back to relational database.
4. similarly we might need to construct xml to send already entered data to be viewed in form.
As it is easier for DOM parser to read information from attributes.
but again I am trying to find out are their any problems in doing that.
My thought is that either everything is attribute or everything is element for all table that we got in database.
-- Kartik
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Go for "everything is an element" -- that's way more safe than the other option...
 
Kartik Shah
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply, Lasse.
Yes. I think so everything is element is safer criteria. Do you have any specific criteria's why is it more safer ?
I am searching net to find out what is specific decision criteria for this.
One of them certainly is blob may be incompatible with attributes as point by Nathaniel.
So far I have collected following criteria we need to evaluate with regards to application that is being designed.
  • Is xml you are designing is human readable or machine readable ? Use elements if human readable

  • Use attributes if attribute readable
  • Is the data flat or hierarchical ?

  • Attributes can only hold a single level of data
    Elements on the other hand can have much more complex content models of theif own
  • Do we need to order child information item
  • Is it easier to transform a xml containing attributes or xml containing elements

  •  
    Lasse Koskela
    author
    Posts: 11962
    5
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Originally posted by Kartik Shah:
    Do you have any specific criteria's why is it more safer ?


    1) You're prepared for moving from a flat structure to a hierarchy
    2) You're able to use CDATA
    2) (I admit this one is a bit flaky) You don't need to worry about some parser implementation assuming a given maximum size for an attribute
     
    Greenhorn
    Posts: 3
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    InfoJet Service is a Java class library to publish InfoPath Forms to the web. InfoJet Service can be deployed as Web Services. J2EE and .Net web application with integration of InfoJet Service support the users to edit InfoPath Forms in Internet Explorer and FireFox.

    http://www.infojetsoft.com

    Thanks.
     
    Author and all-around good cowpoke
    Posts: 13078
    6
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    If you really mean a BLOB, base64 encoding is the only safe way to include binary data in an XML document.
    If "Large", a very large attribute may screw up XML parsers since a parser attempts to assemble all of the startElement data at once.
    Much safer to make a large run of text as Element content.
    Bill
     
    With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    reply
      Bookmark Topic Watch Topic
    • New Topic