JAN
JAN

Reputation: 21875

XML file won't get validated

Given the following xml file :

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Clients SYSTEM "bank.dtd">
<Clients>
    <account>
        <number>323</number>

        <client>
            <address>
                <street>Sliders</street>
                <city>Tokyo</city>
            </address>
            <identity>1212</identity>
        </client>

        <client>           // HERE IS THE PROBLEM
            <address>
                <street>Jason</street>
                <city>Paris</city>
            </address>
            <identity>1313</identity>
        </client>

        <totoalSum>43333</totoalSum>
    </account>
</Clients>

and its DTD file :

<?xml version="1.0" encoding="utf-8"?>
<!ELEMENT Clients (account+)>
<!ELEMENT account (number,client,totoalSum)>
<!ELEMENT client (address,identity)>
<!ELEMENT address (street,city)>
<!ELEMENT number (#PCDATA)>
<!ELEMENT street (#PCDATA)>
<!ELEMENT city (#PCDATA)>
<!ELEMENT identity (#PCDATA)>
<!ELEMENT totoalSum (#PCDATA)>

I can't get it validated . XMLspy says :

Content model of element 'account' disallows element 'client' at this position.

where by this , the problematic line is marked above by "HERE" .

Any idea what's might cause this ?

Regards

Upvotes: 1

Views: 64

Answers (1)

Leniel Maccaferri
Leniel Maccaferri

Reputation: 102438

You have 2 client elements within an account element. That's the problem!

Try changing the DTD with this:

<!ELEMENT account (number,client+,totoalSum)>

Upvotes: 2

Related Questions