Skip to main content
Inspiring
December 6, 2013
Answered

Creating XML with Code - 1086: Syntax error for Version

  • December 6, 2013
  • 1 reply
  • 1098 views

Hi All,

I am using AS3 CS6 Flash Pro.

I am trying to create a XML file that I can append child data from other similar XML files. It is the XLIFF format that the Strings Panel uses to manage translation data.

The file is by design backward compatiable to AS2. I don't really want to import the XML as a file.

var TEMP:XML = <?xml version="1.0" encoding="UTF-8"?>

<xliff version="1.0" xml:lang="en">

  <file datatype="plaintext" original="ZMP_en.fla" source-language="EN">
    <header></header>
    <body>
    </body>
  </file>

</xliff>

trace(TEMP);

1086: syntax error expecting semicolon before version -- for line 2 of code

I will be appending the other XML snippets as children of <body>.

Thanks

This topic has been closed for replies.
Correct answer kglad

try:

var TEMP:XML = <xliff version="1.0" xml:lang="en">
  <file datatype="plaintext" original="ZMP_en.fla" source-language="EN">
    <header></header>
    <body>
    </body>
  </file>
</xliff>
trace(TEMP);

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
December 6, 2013

try:

var TEMP:XML = <xliff version="1.0" xml:lang="en">
  <file datatype="plaintext" original="ZMP_en.fla" source-language="EN">
    <header></header>
    <body>
    </body>
  </file>
</xliff>
trace(TEMP);

Jim WileyAuthor
Inspiring
December 6, 2013

So this was a 'Cut'N'Paste' induced error when copying from an XML editor.

Well, another good reason for me to make this utility.

Thanks kglad !!

kglad
Community Expert
Community Expert
December 6, 2013

you're welcome.