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 8668965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T18:20:47+00:00 2026-06-12T18:20:47+00:00

The project I am working on requires alot of work with somewhat complex XML

  • 0

The project I am working on requires alot of work with somewhat complex XML files, so I convert them into SimpleXML array, JSON Encode it and pass it to Knockout via Ajax.

The problem is that pretty much each property has attributes, which SimpleXML shoves into an object called @attributes. When I try to bind to it like myObject().@attributes.Name, I get an error

Message: SyntaxError: Unexpected token ILLEGAL;
Bindings value: text: alertObj().@attributes.Name 

I have tried '@attributes', ['@attributes'], [@attributes] but nothing is working. I have also tried various escape characters and unicode escapes.

This is what json looks like:

        var alertObject =
            {
                "@attributes":
                    {
                        "DescriptionContentType":"text\/plain",
                        "Description":"",
                        "IsActive":"true",
                        "Name":"Apache Requests Per Interval"
                    },
                "Frequency":
                    {
                        "PeriodInSeconds":"60"
                    },
                "MetricLevelNotification":"false",
                "AlertTriggerMode":"2",
                "CautionActionDelay":"0",
                "DangerActionDelay":"0",
                "CautionActionList":
                    {
                        "ActionID":
                            {
                                "ManagementModuleName":"Base Module",
                                "ConstructName":"Base SMTP Mail Action"
                            }
                    },
                "DangerActionList":
                    {
                        "ActionID":
                            {
                                "ManagementModuleName":"Base Module",
                                "ConstructName":"Base SMTP Mail Action"
                            }
                    },
                "MetricGroupingID":
                    {
                        "ManagementModuleName":"Base Module",
                        "ConstructName":"Apache Requests Per Interval"
                    },
                "AlertCombineOperator":"1",
                "AlertCompareOperator":"2",
                "CautionTargetValue":"2000",
                "DangerTargetValue":"15000",
                "CautionMinNumPerPeriod":"3",
                "CautionAlertPeriod":"6",
                "DangerMinNumPerPeriod":"1",
                "DangerAlertPeriod":"1"
            };

I would like to avoid altering structure and names in any way.

How can I get this to work??

  • 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-06-12T18:20:48+00:00Added an answer on June 12, 2026 at 6:20 pm

    That is because it is not a valid javascript variable name:

    An identifier must start with $, _, or any character in the Unicode
    categories “Uppercase letter (Lu)”, “Lowercase letter (Ll)”,
    “Titlecase letter (Lt)”, “Modifier letter (Lm)”, “Other letter (Lo)”,
    or “Letter number (Nl)”.

    from http://mathiasbynens.be/notes/javascript-identifiers

    A variable name cannot begin with a @ and hence you see the error. There is no point in appending single quotes, brackets or anything else. The variable name simply isn’t valid and you need to change the way the data is returned from server.

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

Sidebar

Related Questions

I'm working on a project that requires to convert html email into text. Below
Currently am working on a project that requires me to create some XML for
I am working on a project that requires reading text files, extracting data from
A project I'm working on needs avro, which requires python-snappy, which requires snappy. I
I am working on a project report which requires some tricky output from a
I am working on a project that requires me to define a DSL. Since
I am working on a project with FusionCharts that requires me to update a
I'm working on a project that requires a fair bit of inserting/updating rows in
I am working on a project that requires some image processing. The front end
I'm working on a C# XNA project that requires me to display information based

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.