How to declare element

前端 未结 1 786
悲哀的现实
悲哀的现实 2021-01-25 19:38

I\'m looking for validate an XML document with xrm prefix as you can read here :

I wrote the following XML Schema :

     

        
相关标签:
1条回答
  • 2021-01-25 20:14

    xrm is a namespace prefix, an abbreviation for the namespace. As the syntax error indicates, a namespace prefix is not declared via xsd:element/@name. Instead, declare only the local name (plugin) and handle the namespace prefix declaration at the XSD level...

    Here is a simplified set of your XML and XSD where the XML validates successfully against the XSD:

    XML

    <?xml version="1.0" encoding="UTF-8"?>
    <xrm:plugin xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xsi:schemaLocation="http://www.moss.fr/2011/connecteur_xrm result.xsd"
                xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                xmlns:xrm="http://www.moss.fr/2011/connecteur_xrm">
      <xrm:header>
        <xrm:tracabilite>
          <xrm:reference_moss>MPD_4.1.1.0</xrm:reference_moss>
          <xrm:document_lie> </xrm:document_lie>
          <xrm:document_interface>SC-DIF-OT3402-0002-MOSS 1.8 - DIF COSCA Inc.2.doc</xrm:document_interface>
          <xrm:intervention>
            <xrm:auteur>Générateur de mapping v1.0</xrm:auteur>
            <xrm:date>14/01/2013</xrm:date>
            <xrm:commentaire>Génération du fichier de mapping</xrm:commentaire>
          </xrm:intervention>
        </xrm:tracabilite>
      </xrm:header>
    </xrm:plugin>
    

    XSD

    <?xml version="1.0" encoding="utf-8"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                xmlns:xrm="http://www.moss.fr/2011/connecteur_xrm"
                xmlns:SCCOAMCD="urn:SCCOA-schemaInfo"
                xmlns:SBEGestionZonesAeriennesSYSCA="urn:SBEGestionZonesAeriennesSYSCA-schema"
                SCCOAMCD:desc="  implémentation du MCD pivot du SCCOA 3.2.1ec  production par SCCOA mcd2mpd 4.1.1, le 11/12/2007  règles spécifiques production schémas 1.2  diagramme : A-SC.SBE GestionZonesAeriennes SYSCA  entité racine      : A-SC.ZoneAerienne "
                attributeFormDefault="unqualified"
                elementFormDefault="qualified"
                targetNamespace="http://www.moss.fr/2011/connecteur_xrm"
                version="3.2.1ec">
      <xsd:complexType name="header">
        <xsd:sequence>
          <xsd:any minOccurs="1" processContents="lax"/>
        </xsd:sequence>
      </xsd:complexType>
      <xsd:element name="plugin">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="header" type="xrm:header"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
    </xsd:schema>
    
    0 讨论(0)
提交回复
热议问题