|
RE: Trailing blank space / Whitespace is not preserved : XmlObject.newDomNo: msg#00149text.xml.xmlbeans.user
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 |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Trailing blank space / Whitespace is not preserved : XmlObject.newDomNode: 00149, Jeegar Shah |
|---|---|
| Next by Date: | RE: [XmlBeans V2] [BUG ?] Unexpected element: CDATA: 00149, Radu Preotiuc-Pietro |
| Previous by Thread: | Re: Trailing blank space / Whitespace is not preserved : XmlObject.newDomNodei: 00149, Jeegar Shah |
| Next by Thread: | RE: Trailing blank space / Whitespace is not preserved : XmlObject.newDomNode: 00149, Jeegar Shah |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |