从xsd文件的命名空间中删除前缀

本文关键字:删除 前缀 命名空间 xsd 文件 | 更新日期: 2023-09-27 17:59:44

我是XSD的新手。

<xs:schema id="test"
    targetNamespace="http://tempuri.org/test.xsd"
    elementFormDefault="qualified"
    xmlns:bb="http://tempuri.org/test.xsd"        
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
>

字段如下

bb:名称

bb:年龄

bb:位置

我需要从命名空间中删除"bb",这样它就变成xmlns="……",我也需要使用C#从字段名中删除"bb:"。

从xsd文件的命名空间中删除前缀

xsdString.Replace("xmlns:bb=", "xmlns=").Replace("<bb:", "<").Replace("</bb:", "</")