logo       

RE: Trailing blank space / Whitespace is not preserved : XmlObject.newDomNo: msg#00151

text.xml.xmlbeans.user

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

Well this was totally dumb...
I just opened the XML in notepad and realised that the spaces in data is being preserved. Its was good old Mr. Internet Explorer taking them out in display. and because the default XMl viewer is IE I did not realise this.

I also tried all the different ways

newDomNode and save the DOM document
toString
xmlText

and all of the above with XMLOptions.setPrettyPrint and in all the cases the spaces are being preserved as is.

From: "Dogan Atay" <DAtay@xxxxxxxxx>
Reply-To: user@xxxxxxxxxxxxxxxxxxx
To: <user@xxxxxxxxxxxxxxxxxxx>
Subject: RE: Trailing blank space / Whitespace is not preserved : XmlObject.newDomNode
Date: Wed, 26 Jan 2005 14:53:49 -0500
MIME-Version: 1.0
Received: from mail.apache.org ([209.237.227.199]) by mc2-f38.hotmail.com with Microsoft SMTPSVC(6.0.3790.211); Wed, 26 Jan 2005 12:28:31 -0800
Received: (qmail 23649 invoked by uid 500); 26 Jan 2005 20:28:30 -0000
Received: (qmail 23583 invoked by uid 99); 26 Jan 2005 20:28:30 -0000
Received: pass (hermes.apache.org: local policy)
Received: from mail2.aflac.com (HELO PCMSMTP04.dmz.aflac.net) (209.37.4.240) by apache.org (qpsmtpd/0.28) with ESMTP; Wed, 26 Jan 2005 12:28:28 -0800
Received: from PCMEX03A.hq.aflac.com (unverified [10.175.6.24]) by PCMSMTP04.dmz.aflac.net (Content Technologies SMTPRS 4.3.14) with ESMTP id <T6ebbec63baac1404f06dc@xxxxxxxxxxxxxxxxxxxxxxx> for <user@xxxxxxxxxxxxxxxxxxx>; Wed, 26 Jan 2005 14:53:53 -0500
Received: from PCMEX01.hq.aflac.com ([10.175.6.22]) by PCMEX03A.hq.aflac.com with Microsoft SMTPSVC(6.0.3790.211); Wed, 26 Jan 2005 14:53:53 -0500
X-Message-Info: JGTYoYF78jGFdHv4gjruB+Men7RXP6IlB3vN/0wMqJY=
Mailing-List: contact user-help@xxxxxxxxxxxxxxxxxxx; run by ezmlm
Precedence: bulk
List-Post: <mailto:user@xxxxxxxxxxxxxxxxxxx>
List-Help: <mailto:user-help@xxxxxxxxxxxxxxxxxxx>
List-Unsubscribe: <mailto:user-unsubscribe@xxxxxxxxxxxxxxxxxxx>
List-Subscribe: <mailto:user-subscribe@xxxxxxxxxxxxxxxxxxx>
Delivered-To: mailing list user@xxxxxxxxxxxxxxxxxxx
X-ASF-Spam-Status: No, hits=0.1 required=10.0tests=FORGED_RCVD_HELO
X-Spam-Check-By: apache.org
X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0
Content-class: urn:content-classes:message
X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Trailing blank space / Whitespace is not preserved : XmlObject.newDomNode
Thread-Index: AcUD39WEThHov/AnSmSlWLxXuoXNhQAADqEg
X-OriginalArrivalTime: 26 Jan 2005 19:53:53.0880 (UTC) FILETIME=[C394E580:01C503E0]
X-Virus-Checked: Checked
Return-Path: user-return-1702-jeegarshah=hotmail.com@xxxxxxxxxxxxxxxxxxx

My experience with it has been as the following

MyTypeDocument doc = MyTypeDocument.Factory.newInstance();
MyType type = doc.addNewMyType();
type.setMyValue("abcd ");

doc.toString();
prints
<myValue>abcd</myValue>

doc.xmlText(); //note without xmlOptions
prints
<myValue>abcd </myValue>

Apparently there is a difference between toString() and xmlText()
methods. I did not look at the source code yet. But I think the issues
are related.


Thanks,

Dogan Atay

-----Original Message-----
From: Jeegar Shah [mailto:jeegarshah@xxxxxxxxxxx]
Sent: Wednesday, January 26, 2005 2:46 PM
To: user@xxxxxxxxxxxxxxxxxxx
Subject: Re: Trailing blank space / Whitespace is not preserved :
XmlObject.newDomNode

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" <eric@xxxxxxxxxxx>
>Reply-To: eric@xxxxxxxxxxx
>To: user@xxxxxxxxxxxxxxxxxxx
>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
><user@xxxxxxxxxxxxxxxxxxx>; 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
><user@xxxxxxxxxxxxxxxxxxx>; 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@xxxxxxxxxxxxxxxxxxx; run by ezmlm
>Precedence: bulk
>List-Post: <mailto:user@xxxxxxxxxxxxxxxxxxx>
>List-Help: <mailto:user-help@xxxxxxxxxxxxxxxxxxx>
>List-Unsubscribe: <mailto:user-unsubscribe@xxxxxxxxxxxxxxxxxxx>
>List-Subscribe: <mailto:user-subscribe@xxxxxxxxxxxxxxxxxxx>
>Delivered-To: mailing list user@xxxxxxxxxxxxxxxxxxx
>X-ASF-Spam-Status: No, hits=0.0 required=10.0tests=
>X-Spam-Check-By: apache.org
>References: <BAY102-F4AAFD194A23287F2BB55EC3870@xxxxxxx>
>User-Agent: SquirrelMail/1.4.2
>X-Virus-Checked: Checked
>Return-Path:
user-return-1700-jeegarshah=hotmail.com@xxxxxxxxxxxxxxxxxxx
>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@xxxxxxxxxxxxxxxxxxx
> > For additional commands, e-mail: user-help@xxxxxxxxxxxxxxxxxxx
> >
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@xxxxxxxxxxxxxxxxxxx
>For additional commands, e-mail: user-help@xxxxxxxxxxxxxxxxxxx
>



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xxxxxxxxxxxxxxxxxxx
For additional commands, e-mail: user-help@xxxxxxxxxxxxxxxxxxx

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xxxxxxxxxxxxxxxxxxx
For additional commands, e-mail: user-help@xxxxxxxxxxxxxxxxxxx



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise