Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 13th, 2004, 03:40 AM
Registered User
 
Join Date: Sep 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default element is not declared. An error occurred...

hi everybody.

I have an XML that looks like this
Code:
<InterOpMessage xmlns="http://www.apl.ro/interop">
    <EnvelopeVersion>1.0</EnvelopeVersion>
    <Header>
        <MessageDetails>
            <Class>ITL_DECC_01</Class>
            <Timestamp></Timestamp>
        </MessageDetails>
        <SenderDetails>
            <IDAuthentication>
                <SenderID>1547</SenderID>
            </IDAuthentication>
        </SenderDetails>
    </Header>
    <InterOpDetails />
    <Body />
</InterOpMessage>
and an xsd schema that I want to validate the xml. the schema is
Code:
<?xml version="1.0" ?>
<xsd:schema targetNamespace="http://www.apl.ro/interop" xmlns:xsd="http://www.w3.org/2001/XMLSchema" 

xmlns="http://www.apl.ro/interop"
    xmlns:gt="http://www.apl.ro/interop" attributeFormDefault="unqualified" elementFormDefault="qualified" version="2.0" 

id="interOpMessage_Envelope">
    <xsd:element name="interOpMessage">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="EnvelopeVersion" type="xsd:string" />
                <xsd:element name="Header">
                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:element name="MessageDetails">
                                <xsd:complexType>
                                    <xsd:sequence>
                                        <xsd:element name="Class">
                                            <xsd:simpleType>
                                                <xsd:restriction 

base="gt:UnicodeNameString">
                                                    <xsd:maxLength value="32" />
                                                    <xsd:minLength value="4" />
                                                </xsd:restriction>
                                            </xsd:simpleType>
                                        </xsd:element>
                                        <xsd:element name="Timestamp" type="xsd:dateTime" 

minOccurs="0" />
                                    </xsd:sequence>
                                </xsd:complexType>
                            </xsd:element>
                            <xsd:element name="SenderDetails" minOccurs="0">
                                <xsd:complexType>
                                    <xsd:sequence>
                                        <xsd:element ref="gt:IDAuthentication" minOccurs="0" 

/>
                                    </xsd:sequence>
                                </xsd:complexType>
                            </xsd:element>
                        </xsd:sequence>
                    </xsd:complexType>
                </xsd:element>
                <xsd:element name="InterOpDetails">
                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:element name="Keys" minOccurs="0">
                                <xsd:complexType>
                                    <xsd:sequence>
                                        <xsd:element name="Key" minOccurs="0" 

maxOccurs="unbounded">
                                            <xsd:complexType>
                                                <xsd:simpleContent>
                                                    <xsd:extension 

base="gt:UnicodeNameString">
                                                        <xsd:attribute 

name="Type" type="gt:UnicodeNameString" use="required" />
                                                    </xsd:extension>
                                                </xsd:simpleContent>
                                            </xsd:complexType>
                                        </xsd:element>
                                    </xsd:sequence>
                                </xsd:complexType>
                            </xsd:element>
                        </xsd:sequence>
                    </xsd:complexType>
                </xsd:element>
                <xsd:element name="Body" minOccurs="0">
                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:element name="Data" minOccurs="0">
                                <xsd:complexType>
                                    <xsd:sequence>
                                        <xsd:any namespace="##any" processContents="lax" 

minOccurs="0" maxOccurs="unbounded" />
                                    </xsd:sequence>
                                    <xsd:anyAttribute namespace="##any" />
                                </xsd:complexType>
                            </xsd:element>
                        </xsd:sequence>
                    </xsd:complexType>
                </xsd:element>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="IDAuthentication">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="SenderID" type="xsd:string" minOccurs="0" />
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
    <xsd:simpleType name="UnicodeNameString">
        <xsd:restriction base="xsd:string">
            <xsd:pattern value="[\p{L}\p{Nd}_\-\(\)\{\}]*" />
        </xsd:restriction>
    </xsd:simpleType>
</xsd:schema>
i'm using VS 2003 and when I try to validate the xml I get the following error:

The 'http://www.apl.ro/interop:InterOpMessage' element is not declared. An error occurred at , (1, 2).


 
Old September 13th, 2004, 04:02 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Your schema has the element name spelt with a lowercase 'i'.
InterOpMessage != interOpMessage



--

Joe (Co-author Beginning XML, 3rd edition)
 
Old September 13th, 2004, 04:30 AM
Registered User
 
Join Date: Sep 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hmmm... i searched and searched but that I didn't find... thank you very much!

one more question please. inside the body element i have an element called data that contains a long string of data that might contain almost any character. what's the correct definition for it?

thank you again!

 
Old September 13th, 2004, 04:55 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Well if can contain any characters, including those dis-allowed by xml such as 0x00 (null) then you'll need to use either hexBinary or base64Binary, if it's characters above 0x20, save for standard whitespace then string should be okay.

--

Joe (Co-author Beginning XML, 3rd edition)





Similar Threads
Thread Thread Starter Forum Replies Last Post
error occurred... craft Dreamweaver (all versions) 1 November 1st, 2008 04:31 AM
unexpected error has occurred tworkman BOOK: ASP.NET Website Programming Problem-Design-Solution 20 July 1st, 2007 09:49 PM
"Name My " not declared error ajkumar Visual Basic 2005 Basics 0 April 19th, 2007 11:29 PM
error:Exception occurred hastikeyvan Classic ASP Professional 1 September 13th, 2006 04:40 AM
Error occurred during initialization of VM elisabeth Java Espanol 2 October 8th, 2004 09:50 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.