You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Neil Sherman <ns...@aimltd.co.uk> on 2001/12/21 11:02:19 UTC

Odd results with whitespace and DOMPRINT

Hi all!

I am trying to validate an XML document that contains attributes who have 
whitespace at the beginning.  It is important to retain the whitespace, for 
various checks later.

I am basing my code on the DOMPRINT and DOMCOUNT examples.  When I run the 
DOMPRINT example on my XML document, it outputs the XML content as 
expected, however it strips the whitespace from all but the last occurence 
of the attribute with whitespace ??!!

e.g.

....
<StopPointRef TimingPoint="0" ActivityFlag="Both" 
StopPointRefCode="AIMExtension" aim:AimStopPointRefCode="   10852" 
DynamicDestinationDisplay="">
</StopPointRef>
</TimingLink>
<TimingLink Distance="541" Direction="Outbound" HailAndRide="0" 
DefaultRunTime="2280">
<StoppingArrangements>

</StoppingArrangements>
<StopPointRef TimingPoint="0" ActivityFlag="Both" 
StopPointRefCode="AIMExtension" aim:AimStopPointRefCode="   10852" 
DynamicDestinationDisplay="">
</StopPointRef>
<StopPointRef TimingPoint="0" ActivityFlag="Both" StopPointRefCode="TOA1  
0122" DynamicDestinationDisplay="">
</StopPointRef>
...

results in

...
<StopPointRef TimingPoint="0" ActivityFlag="Both" 
StopPointRefCode="AIMExtension" aim:AimStopPointRefCode="10852" 
DynamicDestinationDisplay="">
</StopPointRef>
</TimingLink>
<TimingLink Distance="541" Direction="Outbound" HailAndRide="0" 
DefaultRunTime="2280">
<StoppingArrangements>

</StoppingArrangements>
<StopPointRef TimingPoint="0" ActivityFlag="Both" 
StopPointRefCode="AIMExtension" aim:AimStopPointRefCode="   10852" 
DynamicDestinationDisplay="">
</StopPointRef>
<StopPointRef TimingPoint="0" ActivityFlag="Both" 
StopPointRefCode="TOA10122" DynamicDestinationDisplay="">
</StopPointRef>
...

NOTE: The value contained in aim:AimStopPointRefCode, has its whitespace 
stripped except in the last occurence.

Why does this happen, even though they are the same attribute ??

Many thanks for the help

Neil

PS: Attatched are:

TMT21.xml	- My XML document
schema.xsd	- Main schema
aim.xsd		- Schema to extend the main schema