Error: Cannot find the declaration of element 'Receivers'

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mlb5000
    New Member
    • Feb 2008
    • 2

    Error: Cannot find the declaration of element 'Receivers'

    I seem to be having issues validating an XML document using my schema. Both are below:

    The Schema:
    [code=xml]
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="Receivers " >
    <xs:complexType >
    <xs:choice maxOccurs="unbo unded">
    <xs:element ref="MulticastR eceiver"/>
    <xs:element ref="SocketHubR eceiver"/>
    <xs:element ref="SocketRece iver"/>
    <xs:element ref="UDPReceive r"/>
    <xs:element ref="XMLSocketR eceiver"/>
    <xs:element ref="LogFilePat ternReceiver"/>
    </xs:choice>
    </xs:complexType>
    </xs:element>
    <xs:element name="Multicast Receiver">
    <xs:complexType >
    <xs:all>
    <xs:element ref="address"/>
    <xs:element ref="decoder"/>
    <xs:element ref="port"/>
    <xs:element ref="threshold"/>
    </xs:all>
    <xs:attribute name="name" use="required" type="xs:NCName "/>
    </xs:complexType>
    </xs:element>
    <xs:element name="address">
    <xs:complexType >
    <xs:attribute name="value" use="required" type="xs:string "/>
    </xs:complexType>
    </xs:element>
    <xs:element name="SocketHub Receiver">
    <xs:complexType >
    <xs:all>
    <xs:element ref="host"/>
    <xs:element ref="port"/>
    <xs:element ref="reconnecti onDelay"/>
    <xs:element ref="threshold"/>
    </xs:all>
    <xs:attribute name="name" use="required" type="xs:NCName "/>
    </xs:complexType>
    </xs:element>
    <xs:element name="host">
    <xs:complexType >
    <xs:attribute name="value" use="required" type="xs:string "/>
    </xs:complexType>
    </xs:element>
    <xs:element name="reconnect ionDelay">
    <xs:complexType >
    <xs:attribute name="value" use="required" type="xs:intege r"/>
    </xs:complexType>
    </xs:element>
    <xs:element name="SocketRec eiver">
    <xs:complexType >
    <xs:all>
    <xs:element ref="loggerRepo sitory"/>
    <xs:element ref="paused"/>
    <xs:element ref="port"/>
    <xs:element ref="threshold"/>
    </xs:all>
    <xs:attribute name="name" use="required" type="xs:NCName "/>
    </xs:complexType>
    </xs:element>
    <xs:element name="listener" >
    <xs:complexType >
    <xs:attribute name="value" use="required" type="xs:string "/>
    </xs:complexType>
    </xs:element>
    <xs:element name="UDPReceiv er">
    <xs:complexType >
    <xs:all>
    <xs:element ref="decoder"/>
    <xs:element ref="encoding"/>
    <xs:element ref="loggerRepo sitory"/>
    <xs:element ref="paused"/>
    <xs:element ref="port"/>
    <xs:element ref="threshold"/>
    </xs:all>
    <xs:attribute name="name" use="required" type="xs:NCName "/>
    </xs:complexType>
    </xs:element>
    <xs:element name="encoding" >
    <xs:complexType >
    <xs:attribute name="value" use="required" type="xs:string "/>
    </xs:complexType>
    </xs:element>
    <xs:element name="XMLSocket Receiver">
    <xs:complexType >
    <xs:all>
    <xs:element ref="decoder"/>
    <xs:element ref="loggerRepo sitory"/>
    <xs:element ref="paused"/>
    <xs:element ref="port"/>
    <xs:element ref="threshold"/>
    </xs:all>
    <xs:attribute name="name" use="required" type="xs:NCName "/>
    </xs:complexType>
    </xs:element>
    <xs:element name="LogFilePa tternReceiver">
    <xs:complexType >
    <xs:all>
    <xs:element ref="fileURL"/>
    <xs:element ref="filterExpr ession"/>
    <xs:element ref="logFormat"/>
    <xs:element ref="tailing"/>
    <xs:element ref="timeStampF ormat"/>
    </xs:all>
    <xs:attribute name="name" use="required" type="xs:NCName "/>
    </xs:complexType>
    </xs:element>
    <xs:element name="fileURL">
    <xs:complexType >
    <xs:attribute name="value" use="required" type="xs:string "/>
    </xs:complexType>
    </xs:element>
    <xs:element name="filterExp ression">
    <xs:complexType >
    <xs:attribute name="value" use="required" type="xs:string "/>
    </xs:complexType>
    </xs:element>
    <xs:element name="logFormat ">
    <xs:complexType >
    <xs:attribute name="value" use="required" type="xs:string "/>
    </xs:complexType>
    </xs:element>
    <xs:element name="tailing">
    <xs:complexType >
    <xs:attribute name="value" use="required" type="xs:boolea n"/>
    </xs:complexType>
    </xs:element>
    <xs:element name="timeStamp Format">
    <xs:complexType >
    <xs:attribute name="value" use="required" type="xs:string "/>
    </xs:complexType>
    </xs:element>
    <xs:element name="decoder">
    <xs:complexType >
    <xs:attribute name="value" use="required" type="xs:string "/>
    </xs:complexType>
    </xs:element>
    <xs:element name="port">
    <xs:complexType >
    <xs:attribute name="value" use="required" type="xs:intege r"/>
    </xs:complexType>
    </xs:element>
    <xs:element name="threshold ">
    <xs:complexType >
    <xs:attribute name="value" use="required" type="xs:string "/>
    </xs:complexType>
    </xs:element>
    <xs:element name="active">
    <xs:complexType >
    <xs:attribute name="value" use="required" type="xs:boolea n"/>
    </xs:complexType>
    </xs:element>
    <xs:element name="class">
    <xs:complexType >
    <xs:attribute name="value" use="required" type="xs:string "/>
    </xs:complexType>
    </xs:element>
    <xs:element name="loggerRep ository">
    <xs:complexType >
    <xs:attribute name="value" use="required" type="xs:string "/>
    </xs:complexType>
    </xs:element>
    <xs:element name="paused">
    <xs:complexType >
    <xs:attribute name="value" use="required" type="xs:boolea n"/>
    </xs:complexType>
    </xs:element>
    </xs:schema>
    [/code]
    The Document:
    [code=xml]
    <?xml version="1.0" encoding="utf-8"?>
    <Receivers xmlns="receiver Schema.xsd" >
    <LogFilePattern Receiver name="Receiver1 ">
    <fileURL value="file:\\\ C:\LogMonitorLo gs\currentlog.l og"/>
    <filterExpressi on value=""/>
    <logFormat value="TIMESTAM P LEVEL LOGGER [THREAD]: MESSAGE"/>
    <tailing value="true"/>
    <timeStampForma t value="dd MMM yyyy HH:mm:ss,SSS"/>
    </LogFilePatternR eceiver>
    <LogFilePattern Receiver name="Receiver2 ">
    <fileURL value="file:\\\ C:\LogMonitorLo gs\currentlog2. log"/>
    <filterExpressi on value=""/>
    <logFormat value="TIMESTAM P LEVEL LOGGER [THREAD]: MESSAGE"/>
    <tailing value="true"/>
    <timeStampForma t value="dd MMM yyyy HH:mm:ss,SSS"/>
    </LogFilePatternR eceiver>
    </Receivers>
    [/code]
    It tells me "Cannot find the declaration of element 'Receivers'". Can anyone help me out?

    Thanks,
    Matt
    Last edited by jkmyoung; Feb 29 '08, 04:07 PM. Reason: code tags
  • jkmyoung
    Recognized Expert Top Contributor
    • Mar 2006
    • 2057

    #2
    The problem is in assigning your schema. It should be like:
    [code=xml]
    <Receivers xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance" xsi:noNamespace SchemaLocation= "receiverSchema .xsd">
    [/code]

    Comment

    • mlb5000
      New Member
      • Feb 2008
      • 2

      #3
      Originally posted by jkmyoung
      The problem is in assigning your schema. It should be like:
      [code=xml]
      <Receivers xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance" xsi:noNamespace SchemaLocation= "receiverSchema .xsd">
      [/code]
      It sure is, thanks for the help.

      Matt

      Comment

      Working...