[{"data":1,"prerenderedAt":1118},["ShallowReactive",2],{"guide-xml-schema-validation-guide":3},{"id":4,"title":5,"body":6,"date":391,"description":1111,"extension":1112,"meta":1113,"navigation":143,"path":1114,"readingTime":159,"seo":1115,"stem":1116,"__hash__":1117},"guides\u002Fguides\u002Fxml-schema-validation-guide.md","XML Schema Validation Guide",{"type":7,"value":8,"toc":1094},"minimark",[9,14,23,30,34,94,97,101,121,252,255,303,307,310,452,456,459,575,579,634,691,695,739,769,773,778,836,840,903,907,970,974,1046,1050,1078,1082,1090],[10,11,13],"h2",{"id":12},"what-is-xml-schema-validation","What Is XML Schema Validation?",[15,16,17,18,22],"p",{},"Well-formed XML follows syntax rules — tags close properly, attributes are quoted, and one root element wraps everything. Valid XML goes further: it conforms to a ",[19,20,21],"strong",{},"schema"," that defines what elements and attributes are allowed, in what order, with what data types.",[15,24,25,26,29],{},"The most common schema language is ",[19,27,28],{},"XSD (XML Schema Definition)",". An XSD file describes the blueprint your XML must follow.",[10,31,33],{"id":32},"why-validate-against-a-schema","Why Validate Against a Schema?",[35,36,37,50],"table",{},[38,39,40],"thead",{},[41,42,43,47],"tr",{},[44,45,46],"th",{},"Without Schema",[44,48,49],{},"With Schema",[51,52,53,62,70,78,86],"tbody",{},[41,54,55,59],{},[56,57,58],"td",{},"Any element name works",[56,60,61],{},"Only declared elements allowed",[41,63,64,67],{},[56,65,66],{},"Text appears anywhere",[56,68,69],{},"Content restricted to defined types",[41,71,72,75],{},[56,73,74],{},"Attributes are unconstrained",[56,76,77],{},"Attributes must match declared types",[41,79,80,83],{},[56,81,82],{},"Optional\u002Frequired is ambiguous",[56,84,85],{},"minOccurs\u002FmaxOccurs enforce cardinality",[41,87,88,91],{},[56,89,90],{},"Errors surface at parsing time",[56,92,93],{},"Errors caught at validation time — earlier and clearer",[15,95,96],{},"Schema validation catches data problems before they reach your application logic.",[10,98,100],{"id":99},"basic-xsd-structure","Basic XSD Structure",[15,102,103,104,108,109,112,113,116,117,120],{},"An XSD defines types using ",[105,106,107],"code",{},"\u003Celement>",", ",[105,110,111],{},"\u003Cattribute>",", and ",[105,114,115],{},"\u003CsimpleType>","\u002F",[105,118,119],{},"\u003CcomplexType>",":",[122,123,128],"pre",{"className":124,"code":125,"language":126,"meta":127,"style":127},"language-xml shiki shiki-themes github-light github-dark","\u003Cxs:schema xmlns:xs=\"http:\u002F\u002Fwww.w3.org\u002F2001\u002FXMLSchema\">\n\n  \u003Cxs:element name=\"bookstore\">\n    \u003Cxs:complexType>\n      \u003Cxs:sequence>\n        \u003Cxs:element name=\"book\" maxOccurs=\"unbounded\">\n          \u003Cxs:complexType>\n            \u003Cxs:sequence>\n              \u003Cxs:element name=\"title\" type=\"xs:string\"\u002F>\n              \u003Cxs:element name=\"author\" type=\"xs:string\"\u002F>\n              \u003Cxs:element name=\"price\" type=\"xs:decimal\"\u002F>\n            \u003C\u002Fxs:sequence>\n            \u003Cxs:attribute name=\"id\" type=\"xs:integer\" use=\"required\"\u002F>\n          \u003C\u002Fxs:complexType>\n        \u003C\u002Fxs:element>\n      \u003C\u002Fxs:sequence>\n    \u003C\u002Fxs:complexType>\n  \u003C\u002Fxs:element>\n\n\u003C\u002Fxs:schema>\n","xml","",[105,129,130,138,145,151,157,163,169,175,181,187,193,199,205,211,217,223,229,235,241,246],{"__ignoreMap":127},[131,132,135],"span",{"class":133,"line":134},"line",1,[131,136,137],{},"\u003Cxs:schema xmlns:xs=\"http:\u002F\u002Fwww.w3.org\u002F2001\u002FXMLSchema\">\n",[131,139,141],{"class":133,"line":140},2,[131,142,144],{"emptyLinePlaceholder":143},true,"\n",[131,146,148],{"class":133,"line":147},3,[131,149,150],{},"  \u003Cxs:element name=\"bookstore\">\n",[131,152,154],{"class":133,"line":153},4,[131,155,156],{},"    \u003Cxs:complexType>\n",[131,158,160],{"class":133,"line":159},5,[131,161,162],{},"      \u003Cxs:sequence>\n",[131,164,166],{"class":133,"line":165},6,[131,167,168],{},"        \u003Cxs:element name=\"book\" maxOccurs=\"unbounded\">\n",[131,170,172],{"class":133,"line":171},7,[131,173,174],{},"          \u003Cxs:complexType>\n",[131,176,178],{"class":133,"line":177},8,[131,179,180],{},"            \u003Cxs:sequence>\n",[131,182,184],{"class":133,"line":183},9,[131,185,186],{},"              \u003Cxs:element name=\"title\" type=\"xs:string\"\u002F>\n",[131,188,190],{"class":133,"line":189},10,[131,191,192],{},"              \u003Cxs:element name=\"author\" type=\"xs:string\"\u002F>\n",[131,194,196],{"class":133,"line":195},11,[131,197,198],{},"              \u003Cxs:element name=\"price\" type=\"xs:decimal\"\u002F>\n",[131,200,202],{"class":133,"line":201},12,[131,203,204],{},"            \u003C\u002Fxs:sequence>\n",[131,206,208],{"class":133,"line":207},13,[131,209,210],{},"            \u003Cxs:attribute name=\"id\" type=\"xs:integer\" use=\"required\"\u002F>\n",[131,212,214],{"class":133,"line":213},14,[131,215,216],{},"          \u003C\u002Fxs:complexType>\n",[131,218,220],{"class":133,"line":219},15,[131,221,222],{},"        \u003C\u002Fxs:element>\n",[131,224,226],{"class":133,"line":225},16,[131,227,228],{},"      \u003C\u002Fxs:sequence>\n",[131,230,232],{"class":133,"line":231},17,[131,233,234],{},"    \u003C\u002Fxs:complexType>\n",[131,236,238],{"class":133,"line":237},18,[131,239,240],{},"  \u003C\u002Fxs:element>\n",[131,242,244],{"class":133,"line":243},19,[131,245,144],{"emptyLinePlaceholder":143},[131,247,249],{"class":133,"line":248},20,[131,250,251],{},"\u003C\u002Fxs:schema>\n",[15,253,254],{},"This schema requires:",[256,257,258,266,273,289,298],"ul",{},[259,260,261,262,265],"li",{},"A root ",[105,263,264],{},"\u003Cbookstore>"," element",[259,267,268,269,272],{},"One or more ",[105,270,271],{},"\u003Cbook>"," children (maxOccurs=\"unbounded\")",[259,274,275,276,278,279,108,282,108,285,288],{},"Each ",[105,277,271],{}," has ",[105,280,281],{},"\u003Ctitle>",[105,283,284],{},"\u003Cauthor>",[105,286,287],{},"\u003Cprice>"," in that order",[259,290,275,291,293,294,297],{},[105,292,271],{}," has a required integer ",[105,295,296],{},"id"," attribute",[259,299,300,302],{},[105,301,287],{}," must be a decimal number",[10,304,306],{"id":305},"xsd-data-types","XSD Data Types",[15,308,309],{},"XSD provides built-in types for precise validation:",[35,311,312,325],{},[38,313,314],{},[41,315,316,319,322],{},[44,317,318],{},"Type",[44,320,321],{},"Description",[44,323,324],{},"Example",[51,326,327,340,353,366,379,392,405,422,439],{},[41,328,329,334,337],{},[56,330,331],{},[105,332,333],{},"xs:string",[56,335,336],{},"Text",[56,338,339],{},"\"Hello\"",[41,341,342,347,350],{},[56,343,344],{},[105,345,346],{},"xs:integer",[56,348,349],{},"Whole number",[56,351,352],{},"42",[41,354,355,360,363],{},[56,356,357],{},[105,358,359],{},"xs:decimal",[56,361,362],{},"Fixed-point number",[56,364,365],{},"29.99",[41,367,368,373,376],{},[56,369,370],{},[105,371,372],{},"xs:boolean",[56,374,375],{},"True\u002Ffalse",[56,377,378],{},"true",[41,380,381,386,389],{},[56,382,383],{},[105,384,385],{},"xs:date",[56,387,388],{},"Date (YYYY-MM-DD)",[56,390,391],{},"2026-05-28",[41,393,394,399,402],{},[56,395,396],{},[105,397,398],{},"xs:dateTime",[56,400,401],{},"Date and time",[56,403,404],{},"2026-05-28T14:30:00",[41,406,407,412,415],{},[56,408,409],{},[105,410,411],{},"xs:email",[56,413,414],{},"Email format (via pattern)",[56,416,417],{},[418,419,421],"a",{"href":420},"mailto:user@example.com","user@example.com",[41,423,424,429,432],{},[56,425,426],{},[105,427,428],{},"xs:anyURI",[56,430,431],{},"URI reference",[56,433,434],{},[418,435,436],{"href":436,"rel":437},"https:\u002F\u002Fexample.com",[438],"nofollow",[41,440,441,446,449],{},[56,442,443],{},[105,444,445],{},"xs:token",[56,447,448],{},"Whitespace-normalized string",[56,450,451],{},"\"hello world\"",[10,453,455],{"id":454},"restricting-values-with-simpletype","Restricting Values with simpleType",[15,457,458],{},"Custom types add constraints beyond built-in types:",[122,460,462],{"className":124,"code":461,"language":126,"meta":127,"style":127},"\u003C!-- Enum: only specific values allowed -->\n\u003Cxs:simpleType name=\"genreType\">\n  \u003Cxs:restriction base=\"xs:string\">\n    \u003Cxs:enumeration value=\"fiction\"\u002F>\n    \u003Cxs:enumeration value=\"nonfiction\"\u002F>\n    \u003Cxs:enumeration value=\"biography\"\u002F>\n  \u003C\u002Fxs:restriction>\n\u003C\u002Fxs:simpleType>\n\n\u003C!-- Pattern: regex constraint -->\n\u003Cxs:simpleType name=\"isbnType\">\n  \u003Cxs:restriction base=\"xs:string\">\n    \u003Cxs:pattern value=\"\\d{3}-\\d{1,5}-\\d{1,7}-\\d{1}\"\u002F>\n  \u003C\u002Fxs:restriction>\n\u003C\u002Fxs:simpleType>\n\n\u003C!-- Range: numeric bounds -->\n\u003Cxs:simpleType name=\"priceType\">\n  \u003Cxs:restriction base=\"xs:decimal\">\n    \u003Cxs:minInclusive value=\"0.01\"\u002F>\n    \u003Cxs:maxExclusive value=\"999.99\"\u002F>\n  \u003C\u002Fxs:restriction>\n\u003C\u002Fxs:simpleType>\n",[105,463,464,469,474,479,484,489,494,499,504,508,513,518,522,527,531,535,539,544,549,554,559,565,570],{"__ignoreMap":127},[131,465,466],{"class":133,"line":134},[131,467,468],{},"\u003C!-- Enum: only specific values allowed -->\n",[131,470,471],{"class":133,"line":140},[131,472,473],{},"\u003Cxs:simpleType name=\"genreType\">\n",[131,475,476],{"class":133,"line":147},[131,477,478],{},"  \u003Cxs:restriction base=\"xs:string\">\n",[131,480,481],{"class":133,"line":153},[131,482,483],{},"    \u003Cxs:enumeration value=\"fiction\"\u002F>\n",[131,485,486],{"class":133,"line":159},[131,487,488],{},"    \u003Cxs:enumeration value=\"nonfiction\"\u002F>\n",[131,490,491],{"class":133,"line":165},[131,492,493],{},"    \u003Cxs:enumeration value=\"biography\"\u002F>\n",[131,495,496],{"class":133,"line":171},[131,497,498],{},"  \u003C\u002Fxs:restriction>\n",[131,500,501],{"class":133,"line":177},[131,502,503],{},"\u003C\u002Fxs:simpleType>\n",[131,505,506],{"class":133,"line":183},[131,507,144],{"emptyLinePlaceholder":143},[131,509,510],{"class":133,"line":189},[131,511,512],{},"\u003C!-- Pattern: regex constraint -->\n",[131,514,515],{"class":133,"line":195},[131,516,517],{},"\u003Cxs:simpleType name=\"isbnType\">\n",[131,519,520],{"class":133,"line":201},[131,521,478],{},[131,523,524],{"class":133,"line":207},[131,525,526],{},"    \u003Cxs:pattern value=\"\\d{3}-\\d{1,5}-\\d{1,7}-\\d{1}\"\u002F>\n",[131,528,529],{"class":133,"line":213},[131,530,498],{},[131,532,533],{"class":133,"line":219},[131,534,503],{},[131,536,537],{"class":133,"line":225},[131,538,144],{"emptyLinePlaceholder":143},[131,540,541],{"class":133,"line":231},[131,542,543],{},"\u003C!-- Range: numeric bounds -->\n",[131,545,546],{"class":133,"line":237},[131,547,548],{},"\u003Cxs:simpleType name=\"priceType\">\n",[131,550,551],{"class":133,"line":243},[131,552,553],{},"  \u003Cxs:restriction base=\"xs:decimal\">\n",[131,555,556],{"class":133,"line":248},[131,557,558],{},"    \u003Cxs:minInclusive value=\"0.01\"\u002F>\n",[131,560,562],{"class":133,"line":561},21,[131,563,564],{},"    \u003Cxs:maxExclusive value=\"999.99\"\u002F>\n",[131,566,568],{"class":133,"line":567},22,[131,569,498],{},[131,571,573],{"class":133,"line":572},23,[131,574,503],{},[10,576,578],{"id":577},"cardinality-control","Cardinality Control",[35,580,581,594],{},[38,582,583],{},[41,584,585,588,591],{},[44,586,587],{},"Attribute",[44,589,590],{},"Meaning",[44,592,593],{},"Default",[51,595,596,609,621],{},[41,597,598,603,606],{},[56,599,600],{},[105,601,602],{},"minOccurs",[56,604,605],{},"Minimum occurrences",[56,607,608],{},"1",[41,610,611,616,619],{},[56,612,613],{},[105,614,615],{},"maxOccurs",[56,617,618],{},"Maximum occurrences",[56,620,608],{},[41,622,623,628,631],{},[56,624,625],{},[105,626,627],{},"maxOccurs=\"unbounded\"",[56,629,630],{},"No upper limit",[56,632,633],{},"—",[122,635,637],{"className":124,"code":636,"language":126,"meta":127,"style":127},"\u003C!-- Required element, exactly one -->\n\u003Cxs:element name=\"title\" type=\"xs:string\"\u002F>\n\n\u003C!-- Optional element, zero or one -->\n\u003Cxs:element name=\"subtitle\" type=\"xs:string\" minOccurs=\"0\"\u002F>\n\n\u003C!-- One to five authors -->\n\u003Cxs:element name=\"author\" type=\"xs:string\" maxOccurs=\"5\"\u002F>\n\n\u003C!-- Unlimited reviews -->\n\u003Cxs:element name=\"review\" type=\"xs:string\" minOccurs=\"0\" maxOccurs=\"unbounded\"\u002F>\n",[105,638,639,644,649,653,658,663,667,672,677,681,686],{"__ignoreMap":127},[131,640,641],{"class":133,"line":134},[131,642,643],{},"\u003C!-- Required element, exactly one -->\n",[131,645,646],{"class":133,"line":140},[131,647,648],{},"\u003Cxs:element name=\"title\" type=\"xs:string\"\u002F>\n",[131,650,651],{"class":133,"line":147},[131,652,144],{"emptyLinePlaceholder":143},[131,654,655],{"class":133,"line":153},[131,656,657],{},"\u003C!-- Optional element, zero or one -->\n",[131,659,660],{"class":133,"line":159},[131,661,662],{},"\u003Cxs:element name=\"subtitle\" type=\"xs:string\" minOccurs=\"0\"\u002F>\n",[131,664,665],{"class":133,"line":165},[131,666,144],{"emptyLinePlaceholder":143},[131,668,669],{"class":133,"line":171},[131,670,671],{},"\u003C!-- One to five authors -->\n",[131,673,674],{"class":133,"line":177},[131,675,676],{},"\u003Cxs:element name=\"author\" type=\"xs:string\" maxOccurs=\"5\"\u002F>\n",[131,678,679],{"class":133,"line":183},[131,680,144],{"emptyLinePlaceholder":143},[131,682,683],{"class":133,"line":189},[131,684,685],{},"\u003C!-- Unlimited reviews -->\n",[131,687,688],{"class":133,"line":195},[131,689,690],{},"\u003Cxs:element name=\"review\" type=\"xs:string\" minOccurs=\"0\" maxOccurs=\"unbounded\"\u002F>\n",[10,692,694],{"id":693},"sequence-vs-choice-vs-all","Sequence vs Choice vs All",[35,696,697,707],{},[38,698,699],{},[41,700,701,704],{},[44,702,703],{},"Compositor",[44,705,706],{},"Behavior",[51,708,709,719,729],{},[41,710,711,716],{},[56,712,713],{},[105,714,715],{},"\u003Cxs:sequence>",[56,717,718],{},"Elements must appear in order",[41,720,721,726],{},[56,722,723],{},[105,724,725],{},"\u003Cxs:choice>",[56,727,728],{},"Exactly one of the listed elements",[41,730,731,736],{},[56,732,733],{},[105,734,735],{},"\u003Cxs:all>",[56,737,738],{},"Elements appear in any order, each at most once",[122,740,742],{"className":124,"code":741,"language":126,"meta":127,"style":127},"\u003C!-- Either a book or a magazine, not both -->\n\u003Cxs:choice>\n  \u003Cxs:element name=\"book\" type=\"bookType\"\u002F>\n  \u003Cxs:element name=\"magazine\" type=\"magazineType\"\u002F>\n\u003C\u002Fxs:choice>\n",[105,743,744,749,754,759,764],{"__ignoreMap":127},[131,745,746],{"class":133,"line":134},[131,747,748],{},"\u003C!-- Either a book or a magazine, not both -->\n",[131,750,751],{"class":133,"line":140},[131,752,753],{},"\u003Cxs:choice>\n",[131,755,756],{"class":133,"line":147},[131,757,758],{},"  \u003Cxs:element name=\"book\" type=\"bookType\"\u002F>\n",[131,760,761],{"class":133,"line":153},[131,762,763],{},"  \u003Cxs:element name=\"magazine\" type=\"magazineType\"\u002F>\n",[131,765,766],{"class":133,"line":159},[131,767,768],{},"\u003C\u002Fxs:choice>\n",[10,770,772],{"id":771},"validating-xml-against-xsd","Validating XML Against XSD",[774,775,777],"h3",{"id":776},"command-line","Command Line",[122,779,783],{"className":780,"code":781,"language":782,"meta":127,"style":127},"language-bash shiki shiki-themes github-light github-dark","# Using xmllint\nxmllint --schema books.xsd books.xml --noout\n\n# Using Java\njava -jar jing.jar books.xsd books.xml\n","bash",[105,784,785,791,811,815,820],{"__ignoreMap":127},[131,786,787],{"class":133,"line":134},[131,788,790],{"class":789},"sJ8bj","# Using xmllint\n",[131,792,793,797,801,805,808],{"class":133,"line":140},[131,794,796],{"class":795},"sScJk","xmllint",[131,798,800],{"class":799},"sj4cs"," --schema",[131,802,804],{"class":803},"sZZnC"," books.xsd",[131,806,807],{"class":803}," books.xml",[131,809,810],{"class":799}," --noout\n",[131,812,813],{"class":133,"line":147},[131,814,144],{"emptyLinePlaceholder":143},[131,816,817],{"class":133,"line":153},[131,818,819],{"class":789},"# Using Java\n",[131,821,822,825,828,831,833],{"class":133,"line":159},[131,823,824],{"class":795},"java",[131,826,827],{"class":799}," -jar",[131,829,830],{"class":803}," jing.jar",[131,832,804],{"class":803},[131,834,835],{"class":803}," books.xml\n",[774,837,839],{"id":838},"javascript-browser","JavaScript (Browser)",[122,841,845],{"className":842,"code":843,"language":844,"meta":127,"style":127},"language-javascript shiki shiki-themes github-light github-dark","const parser = new DOMParser();\nconst doc = parser.parseFromString(xmlString, 'application\u002Fxml');\n\u002F\u002F Browser validators check well-formedness only —\n\u002F\u002F Full XSD validation requires a server-side tool\n","javascript",[105,846,847,869,893,898],{"__ignoreMap":127},[131,848,849,853,856,859,862,865],{"class":133,"line":134},[131,850,852],{"class":851},"szBVR","const",[131,854,855],{"class":799}," parser",[131,857,858],{"class":851}," =",[131,860,861],{"class":851}," new",[131,863,864],{"class":795}," DOMParser",[131,866,868],{"class":867},"sVt8B","();\n",[131,870,871,873,876,878,881,884,887,890],{"class":133,"line":140},[131,872,852],{"class":851},[131,874,875],{"class":799}," doc",[131,877,858],{"class":851},[131,879,880],{"class":867}," parser.",[131,882,883],{"class":795},"parseFromString",[131,885,886],{"class":867},"(xmlString, ",[131,888,889],{"class":803},"'application\u002Fxml'",[131,891,892],{"class":867},");\n",[131,894,895],{"class":133,"line":147},[131,896,897],{"class":789},"\u002F\u002F Browser validators check well-formedness only —\n",[131,899,900],{"class":133,"line":153},[131,901,902],{"class":789},"\u002F\u002F Full XSD validation requires a server-side tool\n",[774,904,906],{"id":905},"python","Python",[122,908,911],{"className":909,"code":910,"language":905,"meta":127,"style":127},"language-python shiki shiki-themes github-light github-dark","from lxml import etree\n\nschema_root = etree.parse('books.xsd')\nschema = etree.XMLSchema(schema_root)\n\ndoc = etree.parse('books.xml')\nis_valid = schema.validate(doc)\n# True or False\n\nif not is_valid:\n    for error in schema.error_log:\n        print(f\"Line {error.line}: {error.message}\")\n",[105,912,913,918,922,927,932,936,941,946,951,955,960,965],{"__ignoreMap":127},[131,914,915],{"class":133,"line":134},[131,916,917],{},"from lxml import etree\n",[131,919,920],{"class":133,"line":140},[131,921,144],{"emptyLinePlaceholder":143},[131,923,924],{"class":133,"line":147},[131,925,926],{},"schema_root = etree.parse('books.xsd')\n",[131,928,929],{"class":133,"line":153},[131,930,931],{},"schema = etree.XMLSchema(schema_root)\n",[131,933,934],{"class":133,"line":159},[131,935,144],{"emptyLinePlaceholder":143},[131,937,938],{"class":133,"line":165},[131,939,940],{},"doc = etree.parse('books.xml')\n",[131,942,943],{"class":133,"line":171},[131,944,945],{},"is_valid = schema.validate(doc)\n",[131,947,948],{"class":133,"line":177},[131,949,950],{},"# True or False\n",[131,952,953],{"class":133,"line":183},[131,954,144],{"emptyLinePlaceholder":143},[131,956,957],{"class":133,"line":189},[131,958,959],{},"if not is_valid:\n",[131,961,962],{"class":133,"line":195},[131,963,964],{},"    for error in schema.error_log:\n",[131,966,967],{"class":133,"line":201},[131,968,969],{},"        print(f\"Line {error.line}: {error.message}\")\n",[10,971,973],{"id":972},"common-validation-errors","Common Validation Errors",[35,975,976,989],{},[38,977,978],{},[41,979,980,983,986],{},[44,981,982],{},"Error",[44,984,985],{},"Cause",[44,987,988],{},"Fix",[51,990,991,1002,1013,1024,1035],{},[41,992,993,996,999],{},[56,994,995],{},"\"Element not expected\"",[56,997,998],{},"Undeclared element",[56,1000,1001],{},"Add element to schema",[41,1003,1004,1007,1010],{},[56,1005,1006],{},"\"Attribute not allowed\"",[56,1008,1009],{},"Undeclared attribute",[56,1011,1012],{},"Add attribute to complexType",[41,1014,1015,1018,1021],{},[56,1016,1017],{},"\"Text not allowed\"",[56,1019,1020],{},"Text in element-only content",[56,1022,1023],{},"Wrap text in a child element",[41,1025,1026,1029,1032],{},[56,1027,1028],{},"\"Value not valid\"",[56,1030,1031],{},"Wrong data type",[56,1033,1034],{},"Match the declared type",[41,1036,1037,1040,1043],{},[56,1038,1039],{},"\"Missing required attribute\"",[56,1041,1042],{},"use=\"required\" not satisfied",[56,1044,1045],{},"Add the attribute to XML",[10,1047,1049],{"id":1048},"key-takeaways","Key Takeaways",[256,1051,1052,1055,1058,1064,1072,1075],{},[259,1053,1054],{},"Schema validation catches structural and type errors that well-formedness checks miss",[259,1056,1057],{},"XSD defines allowed elements, attributes, order, cardinality, and data types",[259,1059,1060,1063],{},[105,1061,1062],{},"simpleType"," with restrictions enforces enums, patterns, and numeric ranges",[259,1065,1066,1068,1069,1071],{},[105,1067,602],{}," and ",[105,1070,615],{}," control element frequency",[259,1073,1074],{},"Use command-line tools or language libraries to validate XML against XSD before processing",[259,1076,1077],{},"Always validate XML from external sources — never trust structure",[10,1079,1081],{"id":1080},"try-it-yourself","Try It Yourself",[15,1083,1084,1085,1089],{},"Format and validate your XML documents with our ",[418,1086,1088],{"href":1087},"\u002Ftools\u002Fxml-formatter","XML Formatter",". Paste messy XML, format it for readability, and check well-formedness instantly.",[1091,1092,1093],"style",{},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sJ8bj, html code.shiki .sJ8bj{--shiki-default:#6A737D;--shiki-dark:#6A737D}html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .szBVR, html code.shiki .szBVR{--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}",{"title":127,"searchDepth":140,"depth":140,"links":1095},[1096,1097,1098,1099,1100,1101,1102,1103,1108,1109,1110],{"id":12,"depth":140,"text":13},{"id":32,"depth":140,"text":33},{"id":99,"depth":140,"text":100},{"id":305,"depth":140,"text":306},{"id":454,"depth":140,"text":455},{"id":577,"depth":140,"text":578},{"id":693,"depth":140,"text":694},{"id":771,"depth":140,"text":772,"children":1104},[1105,1106,1107],{"id":776,"depth":147,"text":777},{"id":838,"depth":147,"text":839},{"id":905,"depth":147,"text":906},{"id":972,"depth":140,"text":973},{"id":1048,"depth":140,"text":1049},{"id":1080,"depth":140,"text":1081},"Learn how to validate XML documents against XSD schemas — define allowed elements, attributes, data types, and structure for reliable data interchange.","md",{"immutable":143},"\u002Fguides\u002Fxml-schema-validation-guide",{"title":5,"description":1111},"guides\u002Fxml-schema-validation-guide","uDb8TU5edAm0jZAVpFJTJlwwvlEdKKDY1VXRXdJ_MDk",1780401338446]