Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
postgrsql xml架构xsd未能编译_Xml_Postgresql_Xsd - Fatal编程技术网

postgrsql xml架构xsd未能编译

postgrsql xml架构xsd未能编译,xml,postgresql,xsd,Xml,Postgresql,Xsd,数据库:pruebadb CREATE DOMAIN public.cod_pk AS bigint; CREATE DOMAIN public.text_entidad AS character varying(100); create table prueba ( cod_prueba cod_pk not null, prueba text_entidad not null, primary key(cod_prueba), unique(prueba)

数据库:pruebadb

CREATE DOMAIN public.cod_pk AS bigint;
CREATE DOMAIN public.text_entidad AS character varying(100);

create table prueba (
    cod_prueba cod_pk not null,
    prueba text_entidad not null,
    primary key(cod_prueba),
    unique(prueba)
);
insert into prueba (cod_prueba, prueba) values (1,'prueba1');
insert into prueba (cod_prueba, prueba) values (2,'prueba2');

select table_to_xmlschema('prueba', true, false, '')
prueba.xsd 选择表格至xml'prueba',true,false

prueba.xml
xmllint-schema prueba.xsd prueba.xml-noout

prueba.xsd:8:element simpleType:Schemas解析器错误:简单类型“Domain.pruebadb.public.text_entidad”,属性“base”:QName值“VARCHAR_100”未解析为简单类型定义。 WXS架构prueba.xsd未能编译

我只想检查xml文件,有什么问题吗? 提前感谢

这是一个正确的XSD

无需定义新的数据类型:

<xsd:simpleType name="VARCHAR">
XSD2


xmllint-schema prueba.xsd prueba.xml-noout prueba.xsd:8:element simpleType:Schemas解析器错误:simple type???@Arcadio,在发布答案之前,我用Saxon 9.8.0.12检查了它。这绝对是合法的XSD。@Arcadio,我在Stylus Studio中运行它。因此不涉及任何命令行。请在LinkedIn上与我联系。你的解决方案不适合我,我要的是xmllint或我可以从命令行运行的东西,我可以自动执行。@Arcadio,这样不行。合法XSD是基于w3c标准的合法XSD,应该在任何地方都可以使用。正如我前面提到的,您的XSD可以简化。检查一下,XSD2没有定义VARCHAR_100。这正是错误消息所说的。
<prueba xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<row>
  <cod_prueba>1</cod_prueba>
  <prueba>prueba1</prueba>
</row>

<row>
  <cod_prueba>2</cod_prueba>
  <prueba>prueba2</prueba>
</row>

<row>
  <cod_prueba>3</cod_prueba>
  <prueba>prueba3</prueba>
</row>

</prueba>
<xsd:simpleType name="VARCHAR">
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <xsd:simpleType name="Domain.pruebadb.public.cod_pk">
        <xsd:restriction base="BIGINT"/>
    </xsd:simpleType>

    <xsd:simpleType name="Domain.pruebadb.public.text_entidad">
        <xsd:restriction base="xsd:string">
            <xsd:maxLength value="100"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="BIGINT">
        <xsd:restriction base="xsd:long">
            <xsd:maxInclusive value="9223372036854775807"/>
            <xsd:minInclusive value="-9223372036854775808"/>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="VARCHAR">
        <xsd:restriction base="xsd:string">
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:complexType name="RowType.pruebadb.public.prueba">
        <xsd:sequence>
            <xsd:element name="cod_prueba" type="Domain.pruebadb.public.cod_pk"
                         nillable="true"></xsd:element>
            <xsd:element name="prueba"
                         type="Domain.pruebadb.public.text_entidad"
                         nillable="true"></xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="TableType.pruebadb.public.prueba">
        <xsd:sequence>
            <xsd:element name="row" type="RowType.pruebadb.public.prueba"
                         minOccurs="0" maxOccurs="unbounded"/>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:element name="prueba" type="TableType.pruebadb.public.prueba"/>
</xsd:schema>
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
  <xs:element name="prueba">
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="0" maxOccurs="unbounded" ref="row"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="row">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="cod_prueba" type="xs:integer"/>
        <xs:element name="prueba" type="xs:string"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>