Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / July 2007

Tip: Looking for answers? Try searching our database.

best practice for XML / HTML generation of />

Thread view: 
Roedy Green - 24 Jul 2007 10:51 GMT
Which is considered preferable when generating XML or HTML:
space /> or no-space /> for an abbreviated tag ending?
e.g.  <img src="picture.png" alt="landscape"/>
or
<img src="picture.png" alt="landscape" />
Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

tovare@gmail.com - 24 Jul 2007 11:03 GMT
On 24 Jul, 11:51, Roedy Green <see_webs...@mindprod.com.invalid>
wrote:
> Which is considered preferable when generating XML or HTML:
> space /> or no-space /> for an abbreviated tag ending?
> e.g.  <img src="picture.png" alt="landscape"/>
> or
> <img src="picture.png" alt="landscape" />

Hi,

I think space ensures compatability with more browsers.

 "Include a space before the trailing / and > of empty elements,
  e.g. <br />, <hr /> and <img src="karen.jpg" alt="Karen" />.
  Also, use the minimized tag syntax for empty elements, e.g. <br />,
  as the alternative syntax <br></br> allowed by XML gives uncertain
  results in many existing user agents."

 from http://www.w3.org/TR/xhtml1/#guidelines

Regards,

Tov Are Jacobsen
Daniel Pitts - 24 Jul 2007 14:50 GMT
On Jul 24, 3:03 am, "tov...@gmail.com" <tov...@gmail.com> wrote:
> On 24 Jul, 11:51, Roedy Green <see_webs...@mindprod.com.invalid>
> wrote:
[quoted text clipped - 20 lines]
>
> Tov Are Jacobsen

I'm almost certain thats outdated. I think the only major browser that
didn't support <br/> was something like Netscape 3 :-)  Also, I still
automatically write <br />  I do tend to like the space myself, kind
of separates the tag name from the fact that its an empty element.
Both are important to know, but not necessarily at the same instance.

Although, in reality, XML "best practices" is somewhat unnecessary to
worry about, as long as its valid XML, anybody can use a tool to
reformat the document however they want.
Lew - 24 Jul 2007 23:45 GMT
> Although, in reality, XML "best practices" is somewhat unnecessary to
> worry about, as long as its valid XML, anybody can use a tool to
> reformat the document however they want.

Possibly into canonical form.
<http://www.w3.org/TR/xml-c14n>

Signature

Lew

Roedy Green - 25 Jul 2007 08:05 GMT
>Possibly into canonical form.
><http://www.w3.org/TR/xml-c14n>

they expand <br /> to <br></br>
Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Lew - 25 Jul 2007 15:07 GMT
>> Possibly into canonical form.
>> <http://www.w3.org/TR/xml-c14n>
>
> they expand <br /> to <br></br>

Indeed they do.

Signature

Lew



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.