You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xml.apache.org by je...@nl.ibm.com on 2001/04/18 15:51:30 UTC

Leaving elements with values open



Hi,

I have a basic question about XML format.  It has probably already been
dealt with but I cannot access the archive at the moment.

The question is, is it okay to leave an element that contains a value,
open, to be closed a few lines later?   ie does the value now contain a new
line character or is this new line considered to be whitespace which is
ignored by XML parsers.

example:

<HW_UPGRADES>
<HU_FROM_MODEL>250
<HU_TO_MODEL>270</HU_TO_MODEL>
<HU_TO_MODEL>280</HU_TO_MODEL>
</HU_FROM_MODEL>
</HW_UPGRADES>

thanks
Jenny



---------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org


Re: Leaving elements with values open

Posted by James Melton <ja...@cylogix.com>.
The whitespace becomes part of the data.

Jim.

jenny.bourke@nl.ibm.com wrote:
> does the value now contain a new
> line character or is this new line considered to be whitespace 

____________________________________________________________
James Melton                 CyLogix
609.750.5190                 609.750.5100
james.melton@cylogix.com     www.cylogix.com

---------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org


Re: Leaving elements with values open

Posted by "Thomas B. Passin" <tp...@mitretek.org>.
It depends on the content model and whether you are validating or not.  If
you are not validating, the whitespace is part of the content and is
significant.  There's no way for the parser to know if you meant something
else.

If your content model allows mixed content, the linefeed is still
significant since PCDATA includes whitespace.  If your model does not allow
mixed content, then the example is invalid.

If your model requires element-only content, whitespace between elements
isn't significant.  Of course, your example wouldn't be valid, either.

Cheers,

Tom P

<je...@nl.ibm.com> asked
>
>
> The question is, is it okay to leave an element that contains a value,
> open, to be closed a few lines later?   ie does the value now contain a
new
> line character or is this new line considered to be whitespace which is
> ignored by XML parsers.
>
> example:
>
> <HW_UPGRADES>
> <HU_FROM_MODEL>250
> <HU_TO_MODEL>270</HU_TO_MODEL>
> <HU_TO_MODEL>280</HU_TO_MODEL>
> </HU_FROM_MODEL>
> </HW_UPGRADES>
>



---------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org