Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XML
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old May 3rd, 2007, 09:12 AM
Registered User
 
Join Date: May 2007
Location: , , Australia.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alz6z
Default XML validation error

XML CODEs
<- - - - - - - - -- - - - - - - - -- - - - - - - - -- - - - - - - - -- - - >
<?xml version="1.0"?>
<?xml:stylesheet type="text/xsl" href="test.xsl"?>
<insurance xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="test.xsd">
<quote>
        <DriverDetails>
            <fullname>
                <LastName>Law</LastName>
                <FirstName>Alan</FirstName>
            </fullname>
        <DOB>04/04/2007</DOB>
        <gender>male</gender>
        <contact>0420308669</contact>
        <address>george st</address>
        <postcode>2144</postcode>
        <previous_insured>Yes</previous_insured>
        </DriverDetails>
        <cardetails>
            <insurancetype>comprehensive</insurancetype>
            <carmaker>benz</carmaker>
            <year>2001</year>
            <transmissiontype>manual</transmissiontype>
            <carmodel>b2500</carmodel>
            <Bodytype>D25</Bodytype>
            <cylinders>6</cylinders>
            <additionalaccessories>car alarm</additionalaccessories>
        </cardetails>
    <Driverhistory>
            <license>2</license>
            <licenseaccured>2004</licenseaccured>
            <accidents>0</accidents>
            <suspension>0</suspension>
            <theft>1</theft>
            <claims>1</claims>
        </Driverhistory>

<quoteno>00001</quoteno>
<Date>12/04/2007</Date>
<time>21:22</time>
    <price>
        <insuredprice>500</insuredprice>
        <extras>50</extras>
        <discounts>2000</discounts>
        <total>2050</total>
    </price>
</quote>
</insurance>

===============================================
XML schema

<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.w3schools.com"
elementFormDefault="qualified">

<xs:element name= "insurance">
    <xs:complexType>
        <xs:sequence>

            <xs:element name="quote" maxOccurs ="unbounded">
                <xs:complexType>
                    <xs:sequence>

                        <xs:element name="DriverDetails">
                            <xs:complexType>
                                <xs:sequence>

                                    <xs:element name="fullname">
                                        <xs:complexType>
                                            <xs:sequence>
                                                <xs:element name="LastName" type="xs:string"/>
                                                <xs:element name="FirstName" type="xs:string"/>
                                            </xs:sequence>
                                        </xs:complexType>
                                    </xs:element>

                                    <xs:element name="DOB" type="xs:string"/>
                                    <xs:element name="gender" type="xs:string"/>
                                    <xs:element name="contact" type="xs:integer"/>
                                    <xs:element name="address" type="xs:string"/>
                                    <xs:element name="postcode" type="xs:integer"/>
                                    <xs:element name="previous_insured" type="xs:string"/>

                                </xs:sequence>
                            </xs:complexType>
                        </xs:element>

                    <xs:element name="cardetails">
                        <xs:complexType>
                            <xs:sequence>
                                <xs:element name="insurancetype" type="xs:string"/>
                                <xs:element name="carmaker" type="xs:string"/>
                                <xs:element name="year" type="xs:string"/>
                                <xs:element name="transmissiontype" type="xs:string"/>
                                <xs:element name="carmodel" type="xs:string"/>
                                <xs:element name="Bodytype" type="xs:string"/>
                                <xs:element name="cylinders" type="xs:string"/>
                                <xs:element name="additionalaccessories" type="xs:string"/>
                            </xs:sequence>
                        </xs:complexType>
                    </xs:element>

                    <xs:element name="Driverhistory">
                        <xs:complexType>
                            <xs:sequence>
                                <xs:element name="license" type="xs:integer"/>
                                <xs:element name="licenseaccured" type="xs:integer"/>
                                <xs:element name="accidents" type="xs:integer"/>
                                <xs:element name="suspension" type="xs:yesnostring"/>
                                <xs:element name="theft" type="xs:yesnostring"/>
                                <xs:element name="claims" type="xs:yesnostring"/>
                            </xs:sequence>
                        </xs:complexType>
                    </xs:element>



            <xs:element name = "quoteno" type="xs:integer"/>
            <xs:element name = "Date" type="xs:string"/>
            <xs:element name = "time" type="time"/>

                    <xs:element name="price">
                        <xs:complexType>
                            <xs:sequence>
                                <xs:element name="insuredprice" type="xs:float"/>
                                <xs:element name="extras" type="xs:float"/>
                                <xs:element name="discounts" type="xs:float"/>
                                <xs:element name="total" type="xs:float"/>
                            </xs:sequence>
                        </xs:complexType>
                    </xs:element>

                </xs:sequence>
            </xs:complexType>
        </xs:element>

        </xs:sequence>
    </xs:complexType>
</xs:element>

===============================================
hi guys, i am new in this forum
i need help with my xml...i keep getting the error msgs "the element 'insurance' is used but not declared in th dtd/schema"
my xml is well formed but i still dont know what the problem is...please help me.

Reply With Quote
  #2 (permalink)  
Old May 3rd, 2007, 12:06 PM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Well the XML you've shown is referring to a no-namespace schema although the schema shown is targeting the http://www.w3schools.com namespace.

--

Joe (Microsoft MVP - XML)
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
XML validation error message breithauptj XML 3 March 19th, 2008 02:40 PM
XML validation with XSD ksskumar XML 0 October 12th, 2007 05:46 AM
XML Validation AdamPengelly C# 4 September 8th, 2006 07:36 AM
XML Validation June XML 5 February 17th, 2004 11:41 AM
xml validation error kreddy XML 0 August 20th, 2003 01:16 AM



All times are GMT -4. The time now is 10:02 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.