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); } } } }
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; }
public CompiledFacets(XmlSchemaDatatype dt) { whiteSpace = dt.GetBuiltInWSFacet(); }