| Author |
Blob in attribute
|
Kartik Shah
Ranch Hand
Joined: Dec 07, 2000
Posts: 102
|
|
Is it valid to have BLOB as attribute where image contains blob data Is it good design ? Thanks and Regards Kartik
|
Kartik Shah
SCJP, SCDJWS, IBM Certified Websphere & XML, PMP & Six Sigma - http://blog.kartikshah.info
|
 |
Nathaniel Stoddard
Ranch Hand
Joined: May 29, 2003
Posts: 1258
|
|
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.
|
Nathaniel Stodard<br />SCJP, SCJD, SCWCD, SCBCD, SCDJWS, ICAD, ICSD, ICED
|
 |
Kartik Shah
Ranch Hand
Joined: Dec 07, 2000
Posts: 102
|
|
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
|
 |
Lasse Koskela
author
Sheriff
Joined: Jan 23, 2002
Posts: 11962
|
|
|
Go for "everything is an element" -- that's way more safe than the other option...
|
Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
|
 |
Kartik Shah
Ranch Hand
Joined: Dec 07, 2000
Posts: 102
|
|
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 readableIs 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 ownDo we need to order child information itemIs it easier to transform a xml containing attributes or xml containing elements
|
 |
Lasse Koskela
author
Sheriff
Joined: Jan 23, 2002
Posts: 11962
|
|
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
|
 |
j David
Greenhorn
Joined: Jul 27, 2005
Posts: 3
|
|
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.
|
 |
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12271
|
|
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
|
Java Resources at www.wbrogden.com
|
 |
 |
|
|
subject: Blob in attribute
|
|
|