# @sap-ux/xml-odata-annotation-converter

> Converter for OData annotations in XML format.

Latest version **1.0.4** (published 2026-09-22) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @sap-ux/xml-odata-annotation-converter
pnpm add @sap-ux/xml-odata-annotation-converter
yarn add @sap-ux/xml-odata-annotation-converter
bun add @sap-ux/xml-odata-annotation-converter
```

## Health

**Score 55/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2026-09-22 |
| First published | 2023-12-04 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 158 |
| Author | SAP SE |
| Maintainers | tqueck, kranthie.sap, sap_extncrepos, sap-ospo-admin, devinea |

## Links

- npm: https://www.npmjs.com/package/@sap-ux/xml-odata-annotation-converter
- Repository: https://github.com/SAP/open-ux-tools
- npm.io page: https://npm.io/package/@sap-ux/xml-odata-annotation-converter

## Recent versions

- 1.0.4 (latest) — 2026-09-22
- 1.0.3 — 2026-08-25
- 1.0.2 — 2026-07-03
- 1.0.1 — 2026-06-04
- 1.0.0 — 2026-05-30
- 0.6.0 — 2026-05-20
- 0.5.0 — 2026-05-15
- 0.4.13 — 2026-04-30
- 0.4.12 — 2026-03-30
- 0.4.11 — 2026-03-16
- 0.4.10 — 2026-03-04
- 0.4.9 — 2026-02-23
- 0.4.8 — 2026-02-10
- 0.4.7 — 2026-01-29
- 0.4.6 — 2026-01-12
- … 20 more at https://npm.io/package/@sap-ux/xml-odata-annotation-converter/versions

## README

[![Changelog](https://img.shields.io/badge/changelog-8A2BE2)](https://github.com/SAP/open-ux-tools/blob/main/packages/xml-odata-annotation-converter/CHANGELOG.md) [![Github repo](https://img.shields.io/badge/github-repo-blue)](https://github.com/SAP/open-ux-tools/tree/main/packages/xml-odata-annotation-converter)

# [`@sap-ux/xml-odata-annotation-converter`](https://github.com/SAP/open-ux-tools/tree/main/packages/xml-odata-annotation-converter)

## Installation
Npm
`npm install --save @sap-ux/xml-odata-annotation-converter`

Yarn
`yarn add @sap-ux/xml-odata-annotation-converter `

Pnpm
`pnpm add @sap-ux/xml-odata-annotation-converter `

## Usage

Convert XML ast generated by `@xml-tools/ast` package to annotation document.

```Typescript
import { readFile } from 'fs/promises';
import { buildAst } from '@xml-tools/ast';
import { parse } from '@xml-tools/parser';

import { convertDocument } from '@sap-ux/xml-odata-annotation-converter';

// read annotation file
const text = await readFile('annotations.xml', 'utf8');
// parse XML
const { cst, tokenVector } = parse(text);
// build AST
const ast = buildAst(cst, tokenVector);
// convert to annotation document format
const annotationDocument = convertDocument(ast);
```


Convert metadata (data model) defined in an XML file to an array of `MetadataElement`.

```Typescript
import { readFile } from 'fs/promises';
import { buildAst } from '@xml-tools/ast';
import { parse } from '@xml-tools/parser';

import { convertMetadataDocument } from '@sap-ux/xml-odata-annotation-converter';

// read annotation file
const text = await readFile('metadata.xml', 'utf8');
// parse XML
const { cst, tokenVector } = parse(text);
// build AST
const ast = buildAst(cst, tokenVector);
// convert to annotation document format
const metadata = convertMetadataDocument(ast);
```

## Keywords
OData annotations

---
_Source: https://npm.io/package/@sap-ux/xml-odata-annotation-converter · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
