internal void CheckWhitespaceFacets(ref string s, SimpleTypeValidator type, Xml.Schema.Linq.XmlSchemaWhiteSpace wsPattern)
 {
     Xml.Schema.Linq.RestrictionFacets restriction = type.RestrictionFacets;
     if (type.Variety == XmlSchemaDatatypeVariety.List)
     {
         s = s.Trim();
     }
     else if (type.Variety == XmlSchemaDatatypeVariety.Atomic)
     {
         XmlSchemaDatatype datatype = type.DataType;
         if (datatype.GetBuiltInWSFacet() == Xml.Schema.Linq.XmlSchemaWhiteSpace.Collapse)
         {
             s = Xml.Schema.Linq.XmlComplianceUtil.NonCDataNormalize(s);
         }
         else if (datatype.GetBuiltInWSFacet() == Xml.Schema.Linq.XmlSchemaWhiteSpace.Replace)
         {
             s = Xml.Schema.Linq.XmlComplianceUtil.CDataNormalize(s);
         }
         else if (restriction != null & (int)(restriction.Flags & Xml.Schema.Linq.RestrictionFlags.WhiteSpace) != 0)
         {
             if (restriction.WhiteSpace == Xml.Schema.Linq.XmlSchemaWhiteSpace.Replace)
             {
                 s = Xml.Schema.Linq.XmlComplianceUtil.CDataNormalize(s);
             }
             else if (restriction.WhiteSpace == Xml.Schema.Linq.XmlSchemaWhiteSpace.Collapse)
             {
                 s = Xml.Schema.Linq.XmlComplianceUtil.NonCDataNormalize(s);
             }
         }
     }
 }
示例#2
0
        internal void CheckWhitespaceFacets(ref string s,
                                            SimpleTypeValidator type,
                                            XmlSchemaWhiteSpace wsPattern)
        {
            // before parsing, check whitespace facet
            RestrictionFacets restriction = type.RestrictionFacets;

            if (type.Variety == XmlSchemaDatatypeVariety.List)
            {
                s = s.Trim();
                return;
            }
            else if (type.Variety == XmlSchemaDatatypeVariety.Atomic)
            {
                XmlSchemaDatatype datatype = type.DataType;
                if (datatype.GetBuiltInWSFacet() == XmlSchemaWhiteSpace.Collapse)
                {
                    s = XmlComplianceUtil.NonCDataNormalize(s);
                }
                else if (datatype.GetBuiltInWSFacet() == XmlSchemaWhiteSpace.Replace)
                {
                    s = XmlComplianceUtil.CDataNormalize(s);
                }
                else if (restriction != null & (restriction.Flags & RestrictionFlags.WhiteSpace) != 0)
                {
                    //Restriction has whitespace facet specified
                    if (restriction.WhiteSpace == XmlSchemaWhiteSpace.Replace)
                    {
                        s = XmlComplianceUtil.CDataNormalize(s);
                    }
                    else if (restriction.WhiteSpace == XmlSchemaWhiteSpace.Collapse)
                    {
                        s = XmlComplianceUtil.NonCDataNormalize(s);
                    }
                }
            }

            return;
        }
示例#3
0
 public CompiledFacets(XmlSchemaDatatype dt)
 {
     whiteSpace = dt.GetBuiltInWSFacet();
 }
示例#4
0
 public CompiledFacets(XmlSchemaDatatype dt)
 {
     whiteSpace = dt.GetBuiltInWSFacet();
 }