Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attribute is a node #29

Closed
gpyshenko opened this issue Jul 8, 2020 · 0 comments
Closed

Attribute is a node #29

gpyshenko opened this issue Jul 8, 2020 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@gpyshenko
Copy link

Input XML

<resources>
 <string name="countdown">
    <xliff:g id="count" example="2 days">%1$s</xliff:g>
    until holiday
    <xliff:g id="time" example="5 days">%1$s</xliff:g>
    anything
 </string>
</resources>

Run convert({encoding: 'UTF-8', convert: {text: 'value'}}, input, {format: 'object'}) method

Expected output

{
  "resources": {
    "string": {
      "@name": "countdown",
      "value": [
        {
          "xliff:g": {
            "@id": "count",
            "@example": "2 days",
            "value": "%1$s"
          }
        },
        {
          "value": "\r\n        until holiday\r\n        "
        },
        {
          "xliff:g": {
            "@id": "time",
            "@example": "5 days",
            "value": "%1$s"
          }
        },
        {
          "value": "\r\n        weew\r\n"
		}
	  ]
	}
  }
}

Output

{
  "resources": {
    "string": {
      "value": [
        {
          "@name": "countdown"
        },
        {
          "xliff:g": {
            "@id": "count",
            "@example": "2 days",
            "value": "%1$s"
          }
        },
        {
          "value": "\r\n        until holiday\r\n        "
        },
        {
          "xliff:g": {
            "@id": "time",
            "@example": "5 days",
            "value": "%1$s"
          }
        },
        {
          "value": "\r\n        weew\r\n"
		}
	  ]
	}
  }
}

Attribute @name is included in array like child node, but this attribute must be located in object value.

@gpyshenko gpyshenko added the bug Something isn't working label Jul 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants