Note that there are some explanatory texts on larger screens.

plurals
  1. POC# XmlDocument is not being updated with respective XSD default attributes
    primarykey
    data
    text
    <p>Here is an example from a xsd and a xml</p> <p>XML</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;config test2="true"&gt; &lt;/config&gt; </code></pre> <p>XSD</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;xs:schema targetNamespace="rules.xsd" xmlns="rules.xsd" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msprop="urn:schemas-microsoft-com:xml-msprop"&gt; &lt;xs:element name="config"&gt; &lt;xs:complexType&gt; &lt;xs:attribute name="test1" type="xs:boolean" default="false" /&gt; &lt;xs:attribute name="test2" type="xs:string" default="mary123" /&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; &lt;/xs:schema&gt; </code></pre> <p>I can use this xsd to validate this xml in C# using this block of code</p> <pre><code>XmlDocument doc = new XmlDocument(); XmlTextReader schemaReader = new XmlTextReader(System.IO.Path.GetFullPath("Mi_XSD_here.xsd")); XmlSchema schema = XmlSchema.Read(schemaReader, ValidationCallBack); doc.Schemas.Add(schema); doc.Load("Mi_XML_here.xml"); doc.Validate(ValidationCallBack); </code></pre> <p>The problem is: I have two default attributes in xsd, but when i run this code he doesn't insert the attributes in XmlDocument, the result is the same xml that i passed to the system. </p> <p>The default attributes are not working and i cant figure why they aren't working, i do believe that exists other forms to solve this problem, i did find this but didn't worked</p> <p><a href="http://msdn.microsoft.com/en-us/library/bb354954.aspx" rel="nofollow noreferrer">Extensions.Validate Method</a></p> <p>obs: ValidationCallBack is some return on error function that i think isn't related to the problems</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload