Forum Moderators: open

Message Too Old, No Replies

Can XML documents have line breaks anywhere?

By anywhere I mean anywhere.

         

eSite

3:54 pm on May 6, 2007 (gmt 0)




I'm developing in an environment where documents' lines must be 255 character maximum.
It's not a problem for me to write an exporter that will add a line break every 255 character and an importer that will recombine lines, but what about other parsers, will they break?

cmarshall

4:03 pm on May 6, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't know for sure.

I tend to write "optimized" XML (no line breaks anywhere), and that always works/validates. I run it through a PHP "cleaner" that strips out comments, extra whitespace and line breaks.

It may break "well-formed-ness" rules and result in unexpected behavior. I know it's OK to break up XML elements along lines of their attributes, etc. You may want to consider controlling the way your file breaks up XML elements, and not just wait for the 256th character.

Sort of like how a word processor adds page breaks before paragraphs, etc.

daveVk

12:37 am on May 7, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



By anywhere I mean anywhere
Do not break in the middle of a word or on other than on an existing white space ( yes there are exceptions). There may me other case?

cmarshall

1:36 am on May 7, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I do recommend getting a tool like <oXygen/> or XMLSpy and testing it for yourself.

That's the only way you'll know for sure.