tazok
26-01-2007, 17:57
allora..ho un file xml da validare:
<?xml version="1.0"?>
<adNewHomes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="schema.xsd">
<adDetail>
<property>University Square</property>
<area>San Mateo County</area>
<developer>Summer Hill Homes</developer>
<location>Exit University, off 101. Right on Donahoe </location>
<price>from the high $500's</price>
<adText>Ponderosa Series. 3 and 4 BR homes with Craftsman details from 1,761 to 2,024 sq ft.</adText>
<hours>11-5 Thurs-Sun</hours>
<phone>650 466 8700M</phone>
</adDetail>
<adDetail>
<property>Sonsara</property>
<area>Contra Costa County</area>
<developer>Taylor Woodrow Homes</developer>
<location>Moraga. Camino Ricardo and Morago Way </location>
<price>from the high $800's</price>
<adText>3 to 5 BR homes with great views. Luxury Homes in a great location.</adText>
<hours>10-5 Daily</hours>
<phone>925/431-2800</phone>
</adDetail>
<adDetail>
<property>Vintners Green</property>
<area>Alameda County</area>
<developer>Greystone Homes</developer>
<location>I-680 to 84. Rt on 84, go several mi. 84 turns into Holmes. Left on Alden Lane.</location>
<price>from the mid $600's</price>
<adText>bedroom single-family homes.</adText>
<hours>11-5 Daily</hours>
<phone>925/442-3200</phone>
</adDetail>
<adDetail>
<property>Dublin Ranch</property>
<area>Alameda County</area>
<developer>Shore Homes</developer>
<location>680 at Dublin Canyon</location>
<price>from the $400-700's</price>
<adText>Master planned community, 3-6 BR Shore Home.</adText>
<hours>11-7 Tues-Sun</hours>
<phone>925/779-9000</phone>
</adDetail>
</adNewHomes>
e il successivo xml schema
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="adNewHomes" type="adDetail"/>
<xsd:complexType name="adDetail">
<xsd:sequence>
<xsd:element name="property" type="xsd:string"/>
<xsd:element name="area" type="xsd:string"/>
<xsd:element name="developer" type="xsd:string"/>
<xsd:element name="location" type="xsd:string"/>
<xsd:element name="price" type="xsd:string"/>
<xsd:element name="adText" type="xsd:string"/>
<xsd:element name="hours" type="xsd:string"/>
<xsd:element name="phone" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
validando mi viene un errore:
Element 'adDetail' is not valid for content model: '((property,area,developer,location,price,adText,hours),phone)'
a parte le parentesi sballate...ma non dovrebbe validarlo??a me pare corretto.
con il dtd invece funziona.
:muro: :muro:
EDIT:bene,riguardando dopo 4 giorni di xml mi sono reso conto di aver provato a istanziare un complextype senza definire un elemento.bravo tazok bravo :clap:
<?xml version="1.0"?>
<adNewHomes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="schema.xsd">
<adDetail>
<property>University Square</property>
<area>San Mateo County</area>
<developer>Summer Hill Homes</developer>
<location>Exit University, off 101. Right on Donahoe </location>
<price>from the high $500's</price>
<adText>Ponderosa Series. 3 and 4 BR homes with Craftsman details from 1,761 to 2,024 sq ft.</adText>
<hours>11-5 Thurs-Sun</hours>
<phone>650 466 8700M</phone>
</adDetail>
<adDetail>
<property>Sonsara</property>
<area>Contra Costa County</area>
<developer>Taylor Woodrow Homes</developer>
<location>Moraga. Camino Ricardo and Morago Way </location>
<price>from the high $800's</price>
<adText>3 to 5 BR homes with great views. Luxury Homes in a great location.</adText>
<hours>10-5 Daily</hours>
<phone>925/431-2800</phone>
</adDetail>
<adDetail>
<property>Vintners Green</property>
<area>Alameda County</area>
<developer>Greystone Homes</developer>
<location>I-680 to 84. Rt on 84, go several mi. 84 turns into Holmes. Left on Alden Lane.</location>
<price>from the mid $600's</price>
<adText>bedroom single-family homes.</adText>
<hours>11-5 Daily</hours>
<phone>925/442-3200</phone>
</adDetail>
<adDetail>
<property>Dublin Ranch</property>
<area>Alameda County</area>
<developer>Shore Homes</developer>
<location>680 at Dublin Canyon</location>
<price>from the $400-700's</price>
<adText>Master planned community, 3-6 BR Shore Home.</adText>
<hours>11-7 Tues-Sun</hours>
<phone>925/779-9000</phone>
</adDetail>
</adNewHomes>
e il successivo xml schema
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="adNewHomes" type="adDetail"/>
<xsd:complexType name="adDetail">
<xsd:sequence>
<xsd:element name="property" type="xsd:string"/>
<xsd:element name="area" type="xsd:string"/>
<xsd:element name="developer" type="xsd:string"/>
<xsd:element name="location" type="xsd:string"/>
<xsd:element name="price" type="xsd:string"/>
<xsd:element name="adText" type="xsd:string"/>
<xsd:element name="hours" type="xsd:string"/>
<xsd:element name="phone" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
validando mi viene un errore:
Element 'adDetail' is not valid for content model: '((property,area,developer,location,price,adText,hours),phone)'
a parte le parentesi sballate...ma non dovrebbe validarlo??a me pare corretto.
con il dtd invece funziona.
:muro: :muro:
EDIT:bene,riguardando dopo 4 giorni di xml mi sono reso conto di aver provato a istanziare un complextype senza definire un elemento.bravo tazok bravo :clap: