本文整理汇总了C#中System.Xml.Schema.XmlSchemaObjectCollection类的典型用法代码示例。如果您正苦于以下问题:C# XmlSchemaObjectCollection类的具体用法?C# XmlSchemaObjectCollection怎么用?C# XmlSchemaObjectCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XmlSchemaObjectCollection类属于System.Xml.Schema命名空间,在下文中一共展示了XmlSchemaObjectCollection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddAttributes
void AddAttributes(ClassInfo classInfo, XmlSchemaObjectCollection attributes)
{
foreach (XmlSchemaAttribute attribute in attributes)
{
classInfo.Attributes.Add(PropertyFromAttribute(classInfo, attribute));
}
}
示例2: XmlSchemaRedefine
public XmlSchemaRedefine()
{
attributeGroups = new XmlSchemaObjectTable();
groups = new XmlSchemaObjectTable();
items = new XmlSchemaObjectCollection(this);
schemaTypes = new XmlSchemaObjectTable();
}
示例3: WriteConstraintsSection
public static void WriteConstraintsSection(this MamlWriter writer, Context context, XmlSchemaObjectCollection constraints)
{
if (!context.Configuration.DocumentConstraints)
return;
writer.StartSection("Constraints", "constraints");
writer.WriteConstraintTable(context, constraints);
writer.EndSection();
}
示例4: ReadDocumentationFromAnnotation
void ReadDocumentationFromAnnotation(XmlSchemaObjectCollection annotationItems)
{
foreach (XmlSchemaObject schemaObject in annotationItems) {
XmlSchemaDocumentation schemaDocumentation = schemaObject as XmlSchemaDocumentation;
if (schemaDocumentation != null) {
ReadSchemaDocumentationFromMarkup(schemaDocumentation.Markup);
}
}
RemoveWhitespaceFromDocumentation();
}
示例5: XmlSchemaElement
public XmlSchemaElement()
{
block = XmlSchemaDerivationMethod.None;
final = XmlSchemaDerivationMethod.None;
constraints = new XmlSchemaObjectCollection();
refName = XmlQualifiedName.Empty;
schemaTypeName = XmlQualifiedName.Empty;
substitutionGroup = XmlQualifiedName.Empty;
InitPostCompileInformations ();
}
示例6: EnumerateDocumentedItems
private static void EnumerateDocumentedItems(XmlSchemaObjectCollection schemaItems, Dictionary<string, string> documentedItems)
{
foreach (XmlSchemaObject schemaObj in schemaItems)
{
string documentation = GetDocumenation(schemaObj);
if (documentation != null)
{
string uniqueName = GetUniqueName(schemaObj);
documentedItems[uniqueName] = documentation;
}
EnumerateDocumentedItems(schemaObj, documentedItems);
}
}
示例7: XmlSchema
public XmlSchema ()
{
attributeFormDefault= XmlSchemaForm.None;
blockDefault = XmlSchemaDerivationMethod.None;
elementFormDefault = XmlSchemaForm.None;
finalDefault = XmlSchemaDerivationMethod.None;
includes = new XmlSchemaObjectCollection();
isCompiled = false;
items = new XmlSchemaObjectCollection();
attributeGroups = new XmlSchemaObjectTable();
attributes = new XmlSchemaObjectTable();
elements = new XmlSchemaObjectTable();
groups = new XmlSchemaObjectTable();
notations = new XmlSchemaObjectTable();
schemaTypes = new XmlSchemaObjectTable();
}
示例8: Process
private static string Process(XmlSchemaObjectCollection collection)
{
StringBuilder result = new StringBuilder();
foreach (XmlSchemaObject schemaObject in collection)
{
if (schemaObject is XmlSchemaDocumentation)
result.Append(ProcessDocumentation((XmlSchemaDocumentation)schemaObject));
else if (schemaObject is XmlSchemaElement)
result.Append(ProcessElement((XmlSchemaElement)schemaObject));
else if (schemaObject is XmlSchemaAnnotation)
result.Append(ProcessAnnotation((XmlSchemaAnnotation)schemaObject));
else if (schemaObject is XmlSchemaAttribute)
result.Append(ProcessAttribute((XmlSchemaAttribute)schemaObject));
else if (schemaObject is XmlSchemaSimpleType)
result.Append(ProcessSchemaSimpleType((XmlSchemaSimpleType)schemaObject));
else
result.AppendLine(string.Format("Unsupported type: {0}", schemaObject));
}
return result.ToString();
}
示例9: WriteConstraintFieldList
private static void WriteConstraintFieldList(this MamlWriter writer, XmlSchemaObjectCollection fields)
{
if (fields.Count == 1)
{
var field = (XmlSchemaXPath)fields[0];
writer.WriteString(field.XPath);
return;
}
writer.StartList(ListClass.Ordered);
foreach (XmlSchemaXPath field in fields)
{
writer.StartListItem();
writer.StartParagraph();
writer.WriteString(field.XPath);
writer.EndParagraph();
writer.EndListItem();
}
writer.EndList();
}
示例10: WriteConstraintTable
public static void WriteConstraintTable(this MamlWriter writer, Context context, XmlSchemaObjectCollection constraints)
{
if (constraints.Count == 0)
return;
writer.StartTable();
writer.StartTableHeader();
writer.StartTableRow();
writer.StartTableRowEntry();
writer.EndTableRowEntry();
writer.StartTableRowEntry();
writer.WriteString("Type");
writer.EndTableRowEntry();
writer.StartTableRowEntry();
writer.WriteString("Description");
writer.EndTableRowEntry();
writer.StartTableRowEntry();
writer.WriteString("Selector");
writer.EndTableRowEntry();
writer.StartTableRowEntry();
writer.WriteString("Fields");
writer.EndTableRowEntry();
writer.EndTableRow();
writer.EndTableHeader();
var rowBuilder = new ConstraintRowWriter(writer, context);
rowBuilder.Traverse(constraints);
writer.EndTable();
}
示例11: SetItems
internal override void SetItems(XmlSchemaObjectCollection newItems)
{
this.items = newItems;
}
示例12: ConstructRestriction
//Compile-time Facet Checking
internal virtual RestrictionFacets ConstructRestriction(DatatypeImplementation datatype, XmlSchemaObjectCollection facets, XmlNameTable nameTable) {
//Datatype is the type on which this method is called
RestrictionFacets derivedRestriction = new RestrictionFacets();
FacetsCompiler facetCompiler = new FacetsCompiler(datatype, derivedRestriction);
for (int i = 0; i < facets.Count; ++i) {
XmlSchemaFacet facet = (XmlSchemaFacet)facets[i];
if (facet.Value == null) {
throw new XmlSchemaException(Res.Sch_InvalidFacet, facet);
}
IXmlNamespaceResolver nsmgr = new SchemaNamespaceManager(facet);
switch(facet.FacetType) {
case FacetType.Length:
facetCompiler.CompileLengthFacet(facet);
break;
case FacetType.MinLength:
facetCompiler.CompileMinLengthFacet(facet);
break;
case FacetType.MaxLength:
facetCompiler.CompileMaxLengthFacet(facet);
break;
case FacetType.Pattern:
facetCompiler.CompilePatternFacet(facet as XmlSchemaPatternFacet);
break;
case FacetType.Enumeration:
facetCompiler.CompileEnumerationFacet(facet, nsmgr, nameTable);
break;
case FacetType.Whitespace:
facetCompiler.CompileWhitespaceFacet(facet);
break;
case FacetType.MinInclusive:
facetCompiler.CompileMinInclusiveFacet(facet);
break;
case FacetType.MinExclusive:
facetCompiler.CompileMinExclusiveFacet(facet);
break;
case FacetType.MaxInclusive:
facetCompiler.CompileMaxInclusiveFacet(facet);
break;
case FacetType.MaxExclusive:
facetCompiler.CompileMaxExclusiveFacet(facet);
break;
case FacetType.TotalDigits:
facetCompiler.CompileTotalDigitsFacet(facet);
break;
case FacetType.FractionDigits:
facetCompiler.CompileFractionDigitsFacet(facet);
break;
default:
throw new XmlSchemaException(Res.Sch_UnknownFacet, facet);
}
}
facetCompiler.FinishFacetCompile();
facetCompiler.CompileFacetCombinations();
return derivedRestriction;
}
示例13: CountGroupSelfReference
private int CountGroupSelfReference(XmlSchemaObjectCollection items, XmlQualifiedName name, XmlSchemaGroup redefined)
{
int num = 0;
for (int i = 0; i < items.Count; i++)
{
XmlSchemaGroupRef source = items[i] as XmlSchemaGroupRef;
if (source != null)
{
if (source.RefName == name)
{
source.Redefined = redefined;
if ((source.MinOccurs != 1M) || (source.MaxOccurs != 1M))
{
base.SendValidationEvent("Sch_MinMaxGroupRedefine", source);
}
num++;
}
}
else if (items[i] is XmlSchemaGroupBase)
{
num += this.CountGroupSelfReference(((XmlSchemaGroupBase) items[i]).Items, name, redefined);
}
if (num > 1)
{
return num;
}
}
return num;
}
示例14: AddAttribute
private XmlSchemaAttribute AddAttribute(string localName, string prefix, string childURI, string attrValue, bool bCreatingNewType, XmlSchema parentSchema, XmlSchemaObjectCollection addLocation, XmlSchemaObjectTable compiledAttributes)
{
if (childURI == XmlSchema.Namespace)
{
throw new XmlSchemaInferenceException(Res.SchInf_schema, 0, 0);
}
XmlSchemaAttribute xsa = null;
int AttributeType = -1;
XmlSchemaAttribute returnedAttribute = null; //this value will change to attributeReference if childURI!= parentURI
XmlSchema xs = null;
bool add = true;
Debug.Assert(compiledAttributes != null); //AttributeUses is never null
// First we need to look into the already compiled attributes
// (they come from the schemaset which we got on input)
// If there are none or we don't find it there, then we must search the list of attributes
// where we are going to add a new one (if it doesn't exist).
// This is necessary to avoid adding duplicate attribute declarations.
ICollection searchCollectionPrimary, searchCollectionSecondary;
if (compiledAttributes.Count > 0) {
searchCollectionPrimary = compiledAttributes.Values;
searchCollectionSecondary = addLocation;
}
else {
searchCollectionPrimary = addLocation;
searchCollectionSecondary = null;
}
if (childURI == XmlReservedNs.NsXml)
{
XmlSchemaAttribute attributeReference = null;
//see if the reference exists
attributeReference = FindAttributeRef(searchCollectionPrimary, localName, childURI);
if (attributeReference == null && searchCollectionSecondary != null) {
attributeReference = FindAttributeRef(searchCollectionSecondary, localName, childURI);
}
if (attributeReference == null)
{
attributeReference = new XmlSchemaAttribute();
attributeReference.RefName = new XmlQualifiedName(localName, childURI);
if (bCreatingNewType && this.Occurrence == InferenceOption.Restricted)
{
attributeReference.Use = XmlSchemaUse.Required;
}
else
{
attributeReference.Use = XmlSchemaUse.Optional;
}
addLocation.Add(attributeReference);
}
returnedAttribute = attributeReference;
}
else
{
if (childURI.Length == 0)
{
xs = parentSchema;
add = false;
}
else if (childURI != null && !schemaSet.Contains(childURI))
{
/*if (parentSchema.AttributeFormDefault = XmlSchemaForm.Unqualified && childURI.Length == 0)
{
xs = parentSchema;
add = false;
break;
}*/
xs = new XmlSchema();
xs.AttributeFormDefault = XmlSchemaForm.Unqualified;
xs.ElementFormDefault = XmlSchemaForm.Qualified;
if (childURI.Length != 0)
xs.TargetNamespace = childURI;
//schemas.Add(childURI, xs);
this.schemaSet.Add(xs);
if (prefix.Length != 0 && String.Compare(prefix, "xml", StringComparison.OrdinalIgnoreCase) != 0)
NamespaceManager.AddNamespace(prefix, childURI);
}
else
{
ArrayList col = this.schemaSet.Schemas(childURI) as ArrayList;
if (col != null && col.Count > 0)
{
xs = col[0] as XmlSchema;
}
}
if (childURI.Length != 0) //
{
XmlSchemaAttribute attributeReference = null;
//see if the reference exists
attributeReference = FindAttributeRef(searchCollectionPrimary, localName, childURI);
if (attributeReference == null & searchCollectionSecondary != null) {
attributeReference = FindAttributeRef(searchCollectionSecondary, localName, childURI);
}
if (attributeReference == null)
{
attributeReference = new XmlSchemaAttribute();
attributeReference.RefName = new XmlQualifiedName(localName, childURI);
if (bCreatingNewType && this.Occurrence == InferenceOption.Restricted)
//.........这里部分代码省略.........
示例15: MakeExistingAttributesOptional
internal void MakeExistingAttributesOptional(XmlSchemaComplexType ct, XmlSchemaObjectCollection attributesInInstance) {
if (ct == null) {
throw new XmlSchemaInferenceException(Res.SchInf_noct, 0, 0);
}
if (ct.ContentModel != null) {
XmlSchemaSimpleContentExtension xssce = CheckSimpleContentExtension(ct);
SwitchUseToOptional(xssce.Attributes, attributesInInstance);
}
else { //either <xs:attribute> as child of xs:complexType or the attributes are within the content model
SwitchUseToOptional(ct.Attributes, attributesInInstance);
}
}