Issue with line 450 of an XSD file doesn't let me convert it to XML

106 Views Asked by At

I've been trying to convert an XSD file to XML. It is a formulary provided by a government agency in order to be able to report some required data.

The XML schema says it was created by LiquidStudio, which is the reason I'm here. I've tried using the online converting tool by the same company but it marks two errors on line 450. I'm totally lost, please help.

Here's the line that marks the errors:

450:

<xs:pattern value="[A-ZÑ&]{3,4}[0-9]{2}[0-1][0-9][0-3][0-9][A-Z0-9]?[A-Z0-9]?[0-9A-Z]"/>

The message for the two errors are as follow: "The entity name must immediately follow the '&' in the entity reference." and "The reference to entity "null" must end with the ';' delimiter."

Here's the link to the XSD file I need to convert: http://formulario.cre.gob.mx/Content/templates/514/v1/volumenesExpendio.xsd

2

There are 2 best solutions below

0
On

The line in question should be as follows:

<xs:pattern value="[A-ZÑ&amp;]{3,4}[0-9]{2}[0-1][0-9][0-3][0-9][A-Z0-9]?[A-Z0-9]?[0-9A-Z]"/>

XML sample

<?xml version="1.0" encoding="UTF-8"?>
<ReporteVolumenes xsi:noNamespaceSchemaLocation="volumenesExpendio.xsd"
                  FechaReporteEstadistico="30/11/2085" Version="ABCD"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <EstacionesServicioVolumen>
        <EstacionServicioVolumen numeroPermisoCRE="PL/666/EXP/ESA/2014"
                                 RFC="YWÑ050939XNX" ImagenComercialId="2854"
                                 EstatusESId="9914">
            <EstacionServicioVolumenesComprados>
                <EstacionServicioVolumenComprado ProductoId="3079"
                                                 SubProductoId="4723"
                                                 SubproductoMarcaId="2636"
                                                 TipoCompra="0"
                                                 VolumenComprado="4127"
                                                 RecibioDescuento="1"
                                                 PagoServicioFlete="0"
                                                 PermisoTransportistaCRE="PL/663/TRA/TM/2070"/>
                <EstacionServicioVolumenComprado ProductoId="4579"
                                                 SubProductoId="876"
                                                 SubproductoMarcaId="7305"
                                                 TipoCompra="1"
                                                 VolumenComprado="2201"
                                                 RecibioDescuento="0"
                                                 PagoServicioFlete="1"
                                                 PermisoTransportistaCRE="PL/80693/TRA/DUC/2063"/>
            </EstacionServicioVolumenesComprados>
            <EstacionServicioVolumenesVendidosInventarios>
                <EstacionServicioVolumenVendidoInventarios ProductoId="7041"
                                                           SubProductoId="173"
                                                           SubproductoMarcaId="490"
                                                           InventarioInicial="9084"
                                                           VolumenVendido="7767"
                                                           InventarioFinal="4104"
                                                           ExportaProducto="1"/>
                <EstacionServicioVolumenVendidoInventarios ProductoId="7439"
                                                           SubProductoId="5851"
                                                           SubproductoMarcaId="2174"
                                                           InventarioInicial="7093"
                                                           VolumenVendido="9005"
                                                           InventarioFinal="8482"
                                                           ExportaProducto="0"/>
                <EstacionServicioVolumenVendidoInventarios ProductoId="827"
                                                           SubProductoId="3085"
                                                           SubproductoMarcaId="4152"
                                                           InventarioInicial="1720"
                                                           VolumenVendido="3187"
                                                           InventarioFinal="9462"
                                                           ExportaProducto="1"/>
                <EstacionServicioVolumenVendidoInventarios ProductoId="3475"
                                                           SubProductoId="2117"
                                                           SubproductoMarcaId="2495"
                                                           InventarioInicial="2705"
                                                           VolumenVendido="1519"
                                                           InventarioFinal="4202"
                                                           ExportaProducto="1"/>
            </EstacionServicioVolumenesVendidosInventarios>
        </EstacionServicioVolumen>
        <EstacionServicioVolumen numeroPermisoCRE="PL/468/EXP/ESA/2080"
                                 RFC="QN&amp;Ñ2010196LH" ImagenComercialId="4270"
                                 EstatusESId="793">
            <EstacionServicioVolumenesComprados>
                <EstacionServicioVolumenComprado ProductoId="8986"
                                                 SubProductoId="6206"
                                                 SubproductoMarcaId="499"
                                                 TipoCompra="false"
                                                 VolumenComprado="3047"
                                                 RecibioDescuento="true"
                                                 PagoServicioFlete="1"
                                                 PermisoTransportistaCRE="PL/1210/TRA/OM/2072"/>
                <EstacionServicioVolumenComprado ProductoId="3413"
                                                 SubProductoId="6159"
                                                 SubproductoMarcaId="2534"
                                                 TipoCompra="0"
                                                 VolumenComprado="7995"
                                                 RecibioDescuento="true"
                                                 PagoServicioFlete="0"
                                                 PermisoTransportistaCRE="PL/1771254/TRA/TM/2045"/>
                <EstacionServicioVolumenComprado ProductoId="8592"
                                                 SubProductoId="4656"
                                                 SubproductoMarcaId="4122"
                                                 TipoCompra="1"
                                                 VolumenComprado="4038"
                                                 RecibioDescuento="1"
                                                 PagoServicioFlete="1"
                                                 PermisoTransportistaCRE="PL/4790/DIS/OM/2024"/>
                <EstacionServicioVolumenComprado ProductoId="2437"
                                                 SubProductoId="9476"
                                                 SubproductoMarcaId="3529"
                                                 TipoCompra="1"
                                                 VolumenComprado="5831"
                                                 RecibioDescuento="0"
                                                 PagoServicioFlete="1"
                                                 PermisoTransportistaCRE="PL/99990/TRA/TM/2012"/>
            </EstacionServicioVolumenesComprados>
            <EstacionServicioVolumenesVendidosInventarios>
                <EstacionServicioVolumenVendidoInventarios ProductoId="6074"
                                                           SubProductoId="1437"
                                                           SubproductoMarcaId="1676"
                                                           InventarioInicial="5462"
                                                           VolumenVendido="156"
                                                           InventarioFinal="5433"
                                                           ExportaProducto="false"/>
            </EstacionServicioVolumenesVendidosInventarios>
        </EstacionServicioVolumen>
        <EstacionServicioVolumen numeroPermisoCRE="PL/13282/EXP/ESA/2091"
                                 RFC="ÑJI78180251X" ImagenComercialId="8469"
                                 EstatusESId="24">
            <EstacionServicioVolumenesComprados>
                <EstacionServicioVolumenComprado ProductoId="3338"
                                                 SubProductoId="1523"
                                                 SubproductoMarcaId="8254"
                                                 TipoCompra="0"
                                                 VolumenComprado="309"
                                                 RecibioDescuento="1"
                                                 PagoServicioFlete="1"
                                                 PermisoTransportistaCRE="PL/19136/TRA/DUC/2068"/>
                <EstacionServicioVolumenComprado ProductoId="198"
                                                 SubProductoId="6649"
                                                 SubproductoMarcaId="350"
                                                 TipoCompra="false"
                                                 VolumenComprado="7443"
                                                 RecibioDescuento="false"
                                                 PagoServicioFlete="1"
                                                 PermisoTransportistaCRE="PL/661/TRA/DUC/2019"/>
            </EstacionServicioVolumenesComprados>
            <EstacionServicioVolumenesVendidosInventarios>
                <EstacionServicioVolumenVendidoInventarios ProductoId="290"
                                                           SubProductoId="5926"
                                                           SubproductoMarcaId="8277"
                                                           InventarioInicial="3685"
                                                           VolumenVendido="9058"
                                                           InventarioFinal="8364"
                                                           ExportaProducto="0"/>
            </EstacionServicioVolumenesVendidosInventarios>
        </EstacionServicioVolumen>
    </EstacionesServicioVolumen>
</ReporteVolumenes>
0
On

I don't see an issue when using the XSD with our online XSD to XML converter?

I assume the issue is that you are copying incorrect XSD data as described in Yitzhak Khabinsky's answer above?