xml file validating in notepad++ but not in C# -


मेरे पास निम्न xsd स्निपेट है:

  & lt; xs: element name = "TR "टाइप =" टीएनएस: ब्लाह "/ & gt; & Lt; x: जटिल टाइप नाम = "ब्लाह" & gt; & LT; XS: अनुक्रम & gt; & Lt; xs: तत्व minOccurs = "1" maxOccurs = "1" name = "Res" प्रकार = "tns: Res" / & gt; & Lt; xs: तत्व minOccurs = "0" maxOccurs = "1" नाम = "SNotifications" type = "tns: ArrayOfSNotification" / & gt; & Lt; xs: तत्व minOccurs = "0" maxOccurs = "1" नाम = "अनन्येशन" प्रकार = "टीएनएस: अर्रेउफनोटिफिकेशन" / & gt; & Lt; xs: तत्व minOccurs = "0" maxOccurs = "1" नाम = "TNotifications" type = "tns: ArrayOfTNotification" / & gt; & Lt; / XS: अनुक्रम & gt; & Lt; / XS: complexType & gt;  

और मेरे पास निम्न XML है:

  & lt; टीआर xmlns: xsi = "http://www.w3.org/2001/XMLSchema- उदाहरण "xmlns: xsd =" http://www.w3.org/2001/XMLSchema "xmlns =" ​​http://something.com/something "& gt; & LT; रेस & gt; & LT; सीसी & gt; सीएमजी & lt; / सीसी & gt; & LT; सीटी & gt; 2014-07-24T14: 10: ०३.८४ & lt; / सीटी & gt; & LT; बी एन & gt; 994,807 & lt; / बी एन & gt; & Lt; / रेस & gt; & Lt; SNotifications xmlns = "http://something.com/something" / & gt; & Lt; UNotifications xmlns = "http://something.com/something" / & gt; & Lt; TNotifications xmlns = "http://something.com/something" / & gt; & Lt; / टीआर & gt;  

मुझे नोटपैड ++ में कोई त्रुटि मान्यता नहीं मिली।

लेकिन सी # का उपयोग करते समय मुझे एक त्रुटि मिलती है।

त्रुटि: अपवाद: System.Xml.Schema.XmlSchemaValidationException: तत्व 'TR' नामस्थान '' में अमान्य बाल तत्व 'एसनोटिफिकेशन' है अपेक्षित संभावित तत्वों की सूची: 'एस नोटिफिकेशन्स, टी एनोटिफिकेशन्स, यूनोटेक्शंस'

मैं सी # कोड का उपयोग करता हूं:

  xmlDocument.Schemas.Add ("http: // www। कुछ चीज़ / कुछ "," पथ xsd फ़ाइल "); स्ट्रिंग परिणाम = स्ट्रिंग। खाली; XmlDocument.Validate ((s, e) = & gt; परिणाम = स्ट्रिंग। फ़ॉर्मेट ("अपवाद: {0}, अपवाद: {1}", e.exception, e.Message));  

मैंने पहले से ही xml दस्तावेज़ लोड किया है।

किसी भी मदद की बहुत सराहना की जाएगी।

धन्यवाद अग्रिम में, gmat

कृपया इसे आज़माएं।

  सार्वजनिक स्टेटिक बूल isValidXml (स्ट्रिंग xmlFilePath, string xsdFilePath ) {Var xdoc = XDocument.Load (xmlFilePath); Var स्कीमा = नया XmlSchemaSet (); स्कीमा। जोड़ें (नाम स्थान का नाम, xsdFilePath); बूलियन परिणाम = सच; Xdoc.Validate (स्कीमास, (प्रेषक, ई) = & gt; {परिणाम = गलत;}); वापसी परिणाम; }  

Comments

Popular posts from this blog

Folder list php -

objective c - How to open front/back camera at the same time in iOS developing? -

GO: Serve static pages -