npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

patent-xml-generator

v1.0.0

Published

将专利申请内容转为符合CNIPA DTD标准的XML文件

Readme

Patent XML Generator

将专利申请内容一键转为符合 CNIPA(国家知识产权局)DTD 标准的 XML 文件,可直接用于专利电子申请提交。

功能

  • 支持发明专利五书(权利要求书、说明书、说明书附图、说明书摘要、摘要附图)转换
  • 自动段落编号([0001][0002]...)
  • 自动权利要求编号,识别独立权利要求与从属权利要求
  • 输出符合 cn-application-body DTD 标准的 XML
  • 支持上标 <sup>、下标 <sub>、加粗 <b>、斜体 <i> 等行内格式
  • 支持 MathML 数学公式嵌入
  • 提供 XML 校验功能
  • TypeScript 编写,类型安全

安装

npm install patent-xml-generator

快速开始

import { PatentXMLGenerator } from 'patent-xml-generator';

const generator = new PatentXMLGenerator();

const xml = generator.generate({
  title: '一种制冷压缩机排气过热度控制方法和系统',
  claims: [
    {
      text: '一种制冷压缩机排气过热度控制方法,其特征在于,包括以下步骤:步骤S1:实时采集制冷系统运行参数;步骤S2:计算当前排气过热度;步骤S3:采用模糊自适应PID控制算法计算频率修正量。',
      type: 'independent'
    },
    {
      text: '根据权利要求1所述的方法,其特征在于,所述步骤S1中的运行参数包括压缩机排气温度、排气压力、吸气温度、吸气压力和环境温度。',
      type: 'dependent',
      dependsOn: 1
    }
  ],
  description: {
    technicalField: [
      '本发明涉及制冷空调技术领域,具体涉及一种制冷压缩机排气过热度控制方法和系统。'
    ],
    backgroundArt: [
      '在制冷空调系统中,压缩机排气温度是衡量系统运行状态的关键参数。',
      '现有的排气过热度控制方法主要包括基于电子膨胀阀的开度调节、简单的频率限制法等方案。'
    ],
    disclosure: [
      '为解决上述技术问题,本发明提供一种制冷压缩机排气过热度控制方法。'
    ],
    drawingsDescription: [
      '图1为本发明控制方法的流程示意图;',
      '图2为模糊自适应PID控制器的结构框图。'
    ],
    embodiments: [
      '下面结合附图和具体实施例对本发明作进一步详细描述。'
    ]
  },
  abstract: '本发明公开了一种制冷压缩机排气过热度控制方法和系统,通过模糊自适应PID控制算法动态调整压缩机运行频率,实现排气过热度的精确控制。'
});

console.log(xml);

输出示例

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE cn-application-body SYSTEM "cn-application-body.dtd">
<cn-application-body lang="zh" country="CN" dtd-version="1.0">
  <cn-claims>
    <claim num="1" claim-type="independent">
      <claim-text>一种制冷压缩机排气过热度控制方法,其特征在于...</claim-text>
    </claim>
    <claim num="2" claim-type="dependent">
      <claim-text>根据权利要求1所述的方法,其特征在于...</claim-text>
    </claim>
  </cn-claims>
  <description>
    <invention-title lang="zh">一种制冷压缩机排气过热度控制方法和系统</invention-title>
    <technical-field>
      <heading level="1">技术领域</heading>
      <p num="0001" Italic="0">本发明涉及制冷空调技术领域...</p>
    </technical-field>
    <background-art>
      <heading level="1">背景技术</heading>
      <p num="0002" Italic="0">在制冷空调系统中...</p>
    </background-art>
    ...
  </description>
  <cn-abstract>
    <p num="0001" Italic="0">本发明公开了一种...</p>
  </cn-abstract>
</cn-application-body>

API

PatentXMLGenerator

constructor(options?)

| 参数 | 类型 | 默认值 | 说明 | |------|------|--------|------| | lang | string | 'zh' | 语言代码 | | country | string | 'CN' | 国家代码 | | dtdVersion | string | '1.0' | DTD 版本 | | indent | boolean | true | 是否格式化输出 |

generate(patent: PatentInput): string

生成完整的专利申请 XML 字符串。

generateClaims(claims: ClaimInput[]): string

仅生成权利要求书 XML 片段。

generateDescription(title: string, desc: DescriptionInput): string

仅生成说明书 XML 片段。

generateAbstract(text: string): string

仅生成摘要 XML 片段。

validate(xml: string): ValidationResult

校验 XML 是否符合 DTD 规范。

类型定义

interface PatentInput {
  title: string;
  claims: ClaimInput[];
  description: DescriptionInput;
  abstract: string;
  drawings?: DrawingInput[];
}

interface ClaimInput {
  text: string;
  type: 'independent' | 'dependent';
  dependsOn?: number;
}

interface DescriptionInput {
  technicalField: string[];
  backgroundArt: string[];
  disclosure: string[];
  drawingsDescription?: string[];
  embodiments: string[];
  sequenceList?: string[];
}

关于

本工具是 CNIPA.AI 专利智能服务平台的开源组件。

CNIPA.AI 是一个 AI 原生的知识产权智能服务平台,基于全球公开专利数据,提供专利导航、企业画像、侵权检测、价值评估、趋势预测、AI 辅助撰写六大服务。

License

MIT