Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7607695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T00:43:45+00:00 2026-05-31T00:43:45+00:00

I try to write an xml object via AIR with FileStream.writeObject I’m doing like

  • 0

I try to write an xml object via AIR with FileStream.writeObject

I’m doing like this:

var _file:File = File.applicationDirectory.resolvePath("test.xml");
var _xml:XML = new XML("<data><name>Testname</name><email>test@test.de</email><time>1331290186848</time></data>");

stream = new FileStream()
stream.open(_file, FileMode.WRITE);
stream.writeObject(xml);
stream.close();

unfortunately, this is the result

Å<data>
   <name>Testname</name>
   <email>test@test.de</email>
   <time>1331290186848</time>
</data>

since i don’t have any influence on the process, how can i prevent AIR to write those strange chars?

thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T00:43:47+00:00Added an answer on May 31, 2026 at 12:43 am

    You should write your XML to the file as a String. Right now you’re writing it as an XML object, which looks a lot like a String, but has some additional information. I think that strange character at the start represents the length of the String.

    Use writeUTFBytes() instead of writeObject().

    So replace

    stream.writeObject(xml);
    

    with

    stream.writeUTFBytes(xml.toXMLString());
    

    writeUTF() won’t do the trick either: if you read the docs, you’ll see that it writes the length of the String as the first character too.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try to write a XML<>Object Mapper for my Entity Framework Code First class.
I am trying to use the xmlEncoder to write to xml file in net-beans
I'm trying to build an object that looks something like this: public class MyObject
I would like to read/write encrypted XML files using LINQ to XML. Does anyone
I'm write a Air application that consumes a beta webservice API. Sometimes this APIreturns
i try to learn asp.net Profile management. But i added below xml firstName,LastName and
This is my first steps with XML and I must send a XML by
I am currently trying to write a very simple app that sends an object
This block of code essentially takes a JAXB Object and turns it into a
I've been trying to write a PHP script to parse an XML document using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.