New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

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

Package Overview
Dependencies
Maintainers
0
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Converter for OData annotations in XML format.

  • 0.3.2
  • latest
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

@sap-ux/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.

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.

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

FAQs

Package last updated on 04 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc