You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Jeegar Shah <je...@hotmail.com> on 2005/01/26 20:11:22 UTC

Trailing blank space / Whitespace is not preserved : XmlObject.newDomNode

I have data with trailing blank spaces and because the user entered the 
spaces I need to preserve it.
This data is set to an element or attribute value of my XmlObject.

When I call XmlBean.newDomNode to get the top level 
org.w3c.xml.java.xml.Document the trailing blanks are removed.
Is there any way or setting to avoid this ?

I'm not using SAVE_PRETTY_PRINT option directly anywhere. Is this being used 
somewhere by default ?



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org


Re: Trailing blank space / Whitespace is not preserved : XmlObject.newDomNode

Posted by Jeegar Shah <je...@hotmail.com>.
This I think applies for the structural part of XML and so maybe user can't 
control what kind of whitespace is used between elements closing 
(\aElement>) and next element opening brackets (<anotherElement) and also 
the whitespace between two attributes etc.
But it does not apply to the value itself.

so If you have a data value "abcd   " (Notice its abcd followed with 3 
blanks) this is what I was expecting my XML to look like.

<aElement aAttribute="abcd   ">abcd   </aElement>

whereas its coming out as
<aElement aAttribute="abcd">abcd</aElement>

which in current project is interepreted as distorted data.

Is there any setting our workaround to this ?

>From: "Eric Vasilik" <er...@vasilik.com>
>Reply-To: eric@vasilik.com
>To: user@xmlbeans.apache.org
>Subject: Re: Trailing blank space / Whitespace is not preserved :      
>XmlObject.newDomNode
>Date: Wed, 26 Jan 2005 11:09:15 -0800 (PST)
>MIME-Version: 1.0
>Received: from mail.apache.org ([209.237.227.199]) by MC8-F38.hotmail.com 
>with Microsoft SMTPSVC(6.0.3790.211); Wed, 26 Jan 2005 11:32:17 -0800
>Received: (qmail 88447 invoked by uid 500); 26 Jan 2005 19:30:59 -0000
>Received: (qmail 88410 invoked by uid 99); 26 Jan 2005 19:30:58 -0000
>Received: neutral (hermes.apache.org: local policy)
>Received: from relay.mrelay.com (HELO relay.mrelay.com) (64.246.178.226)  
>by apache.org (qpsmtpd/0.28) with ESMTP; Wed, 26 Jan 2005 11:30:56 -0800
>Received: from mail2.snerty.com ([66.228.213.52])by relay.mrelay.com 
>(8.12.10/8.12.10) with ESMTP id j0QJUsO4002978for 
><us...@xmlbeans.apache.org>; Wed, 26 Jan 2005 11:30:58 -0800
>Received: from mail2.snerty.com (unknown [192.168.168.3])by 
>mail2.snerty.com (Postfix) with SMTP id 878867F019Afor 
><us...@xmlbeans.apache.org>; Wed, 26 Jan 2005 11:09:15 -0800 (PST)
>Received: from 63.211.200.74        (SquirrelMail authenticated user 
>ericvas)        by mail2.snerty.com with HTTP;        Wed, 26 Jan 2005 
>11:09:15 -0800 (PST)
>X-Message-Info: JGTYoYF78jHA1ITA44n/tlZAWgta9HPhVjcR/S4VdZc=
>Mailing-List: contact user-help@xmlbeans.apache.org; run by ezmlm
>Precedence: bulk
>List-Post: <ma...@xmlbeans.apache.org>
>List-Help: <ma...@xmlbeans.apache.org>
>List-Unsubscribe: <ma...@xmlbeans.apache.org>
>List-Subscribe: <ma...@xmlbeans.apache.org>
>Delivered-To: mailing list user@xmlbeans.apache.org
>X-ASF-Spam-Status: No, hits=0.0 required=10.0tests=
>X-Spam-Check-By: apache.org
>References: <BA...@phx.gbl>
>User-Agent: SquirrelMail/1.4.2
>X-Virus-Checked: Checked
>Return-Path: user-return-1700-jeegarshah=hotmail.com@xmlbeans.apache.org
>X-OriginalArrivalTime: 26 Jan 2005 19:32:17.0587 (UTC) 
>FILETIME=[BEEE4830:01C503DD]
>
>Unfortunately, the parser we use is not reporting this information.  Also,
>and more importantly, this whitespace outside the document element is not
>considered part of the XML Infoset.  XmlBeans, in general, supports only
>the data model specified by the XML Infoset:
>
>     http://www.w3.org/TR/xml-infoset/
>
>Note section 2.1 (1) where it specifies that the document must have one
>element and may have comments or PI's.  Character data is not allowed.
>
>So, XmlBeans does not preserve the exact syntax of an incoming document,
>just the Xml Infoset.  There are many other examples of this.  One is that
>the white space between attributes is not preserved.
>
>- Eric
>
> > I have data with trailing blank spaces and because the user entered the
> > spaces I need to preserve it.
> > This data is set to an element or attribute value of my XmlObject.
> >
> > When I call XmlBean.newDomNode to get the top level
> > org.w3c.xml.java.xml.Document the trailing blanks are removed.
> > Is there any way or setting to avoid this ?
> >
> > I'm not using SAVE_PRETTY_PRINT option directly anywhere. Is this being
> > used
> > somewhere by default ?
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> > For additional commands, e-mail: user-help@xmlbeans.apache.org
> >
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
>For additional commands, e-mail: user-help@xmlbeans.apache.org
>



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org


Re: Trailing blank space / Whitespace is not preserved : XmlObject.newDomNode

Posted by Eric Vasilik <er...@vasilik.com>.
Unfortunately, the parser we use is not reporting this information.  Also,
and more importantly, this whitespace outside the document element is not
considered part of the XML Infoset.  XmlBeans, in general, supports only
the data model specified by the XML Infoset:

    http://www.w3.org/TR/xml-infoset/

Note section 2.1 (1) where it specifies that the document must have one
element and may have comments or PI's.  Character data is not allowed.

So, XmlBeans does not preserve the exact syntax of an incoming document,
just the Xml Infoset.  There are many other examples of this.  One is that
the white space between attributes is not preserved.

- Eric

> I have data with trailing blank spaces and because the user entered the
> spaces I need to preserve it.
> This data is set to an element or attribute value of my XmlObject.
>
> When I call XmlBean.newDomNode to get the top level
> org.w3c.xml.java.xml.Document the trailing blanks are removed.
> Is there any way or setting to avoid this ?
>
> I'm not using SAVE_PRETTY_PRINT option directly anywhere. Is this being
> used
> somewhere by default ?
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org