Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Creating XML with Code - 1086: Syntax error for Version

Contributor ,
Dec 06, 2013 Dec 06, 2013

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

TOPICS
ActionScript
1.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Dec 06, 2013 Dec 06, 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);

Translate
Community Expert ,
Dec 06, 2013 Dec 06, 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);

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Dec 06, 2013 Dec 06, 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 !!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 06, 2013 Dec 06, 2013

you're welcome.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Dec 06, 2013 Dec 06, 2013

I didn't notice before that the version Kglad gave to me was missing the first line of the XML.

I put this in and it errors again - any ideal why?? I though it was a whitespace issue

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 07, 2013 Dec 07, 2013
LATEST

you can't use document declaration like that with the xml class.

if you're transmitting xml elsewhere that must have a declaration, use:

XML.ignoreProcessingInstructions=false;

var TEMP:XML = 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>');

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines