XML Schema redefine అంశం
నిర్వచనం మరియు వినియోగం
redefine అంశం ప్రస్తుత స్కీమాలో బాహ్య స్కీమా ఫైల్లు నుండి పొందబడిన సరళ మరియు క్లిష్ట రకాలను, గుంపులను మరియు అమ్మేల గుంపులను పునఃనిర్వచించడానికి అనుమతిస్తుంది.
అంశం సమాచారం
ప్రకటన సంఖ్య | ఎక్కువ లేదా తక్కువ పరిమితి లేదు |
పై అంశం | schema |
కంటెంట్ | annotation、attributeGroup、complexType、group、simpleType |
వినియోగం
<redefine id=ID schemaLocation=anyURI ఏదైనా అమ్మేలు > (annotation|(simpleType|complexType|group|attributeGroup))* </redefine>
అమ్మేలు | వివరణ |
---|---|
id | ఎంపికాబడిన. ఈ అంశం యొక్క ప్రత్యేకమైన ID నిర్వచించు. |
schemaLocation | అనివార్యం. స్కీమా పత్రం స్థానాన్ని ఉల్లేఖించే URI ప్రతిపాదన. |
ఏదైనా అమ్మేలు | ఎంపికాబడిన. నాణ్యమైన స్కీమా నామకంచేసిన ఏ ఇతర అమ్మేలను నిర్వచించు. |
ప్రత్యామ్నాయం
ఉదాహరణ 1
ఈ ఉదాహరణ ఒక స్కీమాను ప్రదర్శిస్తుంది మైస్కీమా2.xsd అనే, ఇది మైస్కీమా1.xsd ద్వారా నిర్వచించబడిన అంశాలను కలిగి ఉంటుంది. pname రకం పునఃనిర్వచించబడింది. ఈ స్కీమా ప్రకారం, pname పరిమితిలో ఉన్న అంశాలు "country" అంశంతో ముగిసినవి ఉండాలి:
Myschema1.xsd:
<?xml version="1.0"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:complexType name="pname"> <xs:sequence> <xs:element name="firstname"/> <xs:element name="lastname"/> </xs:sequence> </xs:complexType> <xs:element name="customer" type="pname"/> </xs:schema>
Myschema2.xsd:
<?xml version="1.0"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:redefine schemaLocation="Myschema1.xsd"> <xs:complexType name="pname"> <xs:complexContent> <xs:extension base="pname"> <xs:sequence> <xs:element name="country"/> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType> </xs:redefine> <xs:element name="author" type="pname"/> </xs:schema>