Skip to main content
Participant
November 12, 2008
Question

Requesting for your kind help...(want to preserve Leading & trailing spaces)

  • November 12, 2008
  • 3 replies
  • 637 views
Hello Team,<br /><br />Can you please help in the following issue:<br />I am trying to preserve white space(leading and trailing L&T) as is on the User Interface. We have built our UI using Flex 3.0 SDK. <br /><br />From Java side, I am able to carry the value with L&T spaces till the call goes to Flex .mxml and here response object assigning as <br /><br /> var metaConfig:XML = event.result as XML;<br />But here L&T spaces are not visible along with value of ID.<br />I used to see it by using Alert.show(event.result.toString());<br /> <br />Flex Output is as:<br /><br /> <allScalarMetadataFields><br /> <id>TEST</id><br /> <name>test name</name> <br />.<br /><br />But from java[in Servlet/in service] side I can see the output as:<br /><br /> <allScalarMetadataFields><br /> <id> TEST </id><br /> <name> test name </name><br />.<br /><br />Java(Servlet) code is as follows:<br /> OutputStream writer = response.getOutputStream();<br /> OutputStreamWriter outputStreamWriter = new OutputStreamWriter(writer,"UTF-8");<br />JAXBContext context = JAXBContext.newInstance(object.getClass(), object.getClass());<br /> Marshaller m = context.createMarshaller();<br /> m.marshal(object, writer);<br />.Here marshal follow a standard structure for XML to map it into writer same as what Flex XML follows.....<br /><br />Note, there is no any other issue/fault with Flex and java except this white spaces.<br /> <br />Flex .mxml code is as:<br /><br />protected var _fieldXml:XML;<br /> public function MetadataFieldWrapper(xml:XML = null)<br /> {<br /> if (xml == null)<br /> {<br /> xml = <allScalarMetadataFields xml:space="preserve"><br /> <id /><br /> <name /><br /><br />...<br /><br /> Servlet is getting called as :<br /><br /> _webService = new HTTPService();<br /> _webService.url = serviceUrl;<br /> _webService.method = "POST";<br /> _webService.resultFormat = "e4x";<br /> _webService.contentType = "application/xml";<br /><br />.<br />_webService.headers = { "serviceName":serviceName, "serviceMethod":serviceMethod };<br /> _webService.send(param);<br /><br />I want to preserve the L&T spaces along with ID/name .<br />Please help me how to allow these L& T spaces in Flex XML object?<br /><br /> <br />Thanks in Advance.<br />Regards,<br />Venu.
This topic has been closed for replies.

3 replies

Participant
November 18, 2008
By Using XML.ignoreWhitespace = false; <br />I am able to Store/Carry/Save L&T white spaces in XML and i can retrive values with whitespaces...<br /><br />It is in case of loading from Java<DB> to Flex.<br /><br />But the actual problem is with xmlObject.toString()/toXMLString()<br />is not able to carry whitespace, while it should carry as parameter to Java Servlet..so that it can be get using request.getParameter() [..then it is serializing/deserializing]<br /><br />So, how i can preserve the L&T whiteSpaces on XML.toString()/toXMLString() method.
Participant
November 12, 2008
My question is not about preserving L&T spaces into XML element value.
But more about Flex event, which one is returning as-on result.
var metaConfig:XML = event.result as XML;
I used to see it by using Alert.show(event.result.toString());
Participating Frequently
November 12, 2008
In the future this type of question should be asked on flexcoders as<br />it doesn't relate to the development of the Flex SDK.<br /><br />To preserve whitespace look at the documentation for XML.ignoreWhitespace.<br /><br />-- Daniel R. <danielr@neophi.com> [http://danielr.neophi.com/]<br /><br />On Wed, Nov 12, 2008 at 8:19 AM, venubwal <member@adobeforums.com> wrote:<br />> A new discussion was started by venubwal in<br />><br />> Developers --<br />> Requesting for your kind help...(want to preserve Leading & trailing<br />> spaces)<br />><br />> Hello Team,<br />><br />> Can you please help in the following issue:<br />> I am trying to preserve white space(leading and trailing L&T) as is on the<br />> User Interface. We have built our UI using Flex 3.0 SDK.<br />><br />> From Java side, I am able to carry the value with L&T spaces till the call<br />> goes to Flex .mxml and here response object assigning as