本文整理汇总了C#中System.Xml.XmlQualifiedName.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# XmlQualifiedName.ToString方法的具体用法?C# XmlQualifiedName.ToString怎么用?C# XmlQualifiedName.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlQualifiedName
的用法示例。
在下文中一共展示了XmlQualifiedName.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddItem
internal XmlSchemaObject AddItem(XmlSchemaObject item, XmlQualifiedName qname, XmlSchemas schemas)
{
if (item == null)
{
return null;
}
if ((qname == null) || qname.IsEmpty)
{
return null;
}
string str = item.GetType().Name + ":" + qname.ToString();
ArrayList list = (ArrayList) this.ObjectCache[str];
if (list == null)
{
list = new ArrayList();
this.ObjectCache[str] = list;
}
for (int i = 0; i < list.Count; i++)
{
XmlSchemaObject obj2 = (XmlSchemaObject) list[i];
if (obj2 == item)
{
return obj2;
}
if (this.Match(obj2, item, true))
{
return obj2;
}
this.Warnings.Add(Res.GetString("XmlMismatchSchemaObjects", new object[] { item.GetType().Name, qname.Name, qname.Namespace }));
this.Warnings.Add("DEBUG:Cached item key:\r\n" + ((string) this.looks[obj2]) + "\r\nnew item key:\r\n" + ((string) this.looks[item]));
}
list.Add(item);
return item;
}
示例2: CheckValueFacets
internal override Exception CheckValueFacets(XmlQualifiedName value, XmlSchemaDatatype datatype)
{
RestrictionFacets restriction = datatype.Restriction;
RestrictionFlags flags = (restriction != null) ? restriction.Flags : ((RestrictionFlags) 0);
if (flags != 0)
{
int length = value.ToString().Length;
if (((flags & RestrictionFlags.Length) != 0) && (restriction.Length != length))
{
return new XmlSchemaException("Sch_LengthConstraintFailed", string.Empty);
}
if (((flags & RestrictionFlags.MinLength) != 0) && (length < restriction.MinLength))
{
return new XmlSchemaException("Sch_MinLengthConstraintFailed", string.Empty);
}
if (((flags & RestrictionFlags.MaxLength) != 0) && (restriction.MaxLength < length))
{
return new XmlSchemaException("Sch_MaxLengthConstraintFailed", string.Empty);
}
if (((flags & RestrictionFlags.Enumeration) != 0) && !this.MatchEnumeration(value, restriction.Enumeration))
{
return new XmlSchemaException("Sch_EnumerationConstraintFailed", string.Empty);
}
}
return null;
}
示例3: GetAttributeSet
internal AttributeSetAction GetAttributeSet(XmlQualifiedName name) {
AttributeSetAction action = (AttributeSetAction) this.attributeSetTable[name];
if(action == null) {
throw new XsltException(Res.Xslt_NoAttributeSet, name.ToString());
}
return action;
}
示例4: ResolveVariable
// --------------------------- XsltContext -------------------
// Resolving variables and functions
/// <include file='doc\XsltCompileContext.uex' path='docs/doc[@for="XsltCompileContext.ResolveVariable"]/*' />
public override IXsltContextVariable ResolveVariable(string prefix, string name) {
string namespaceURI = this.LookupNamespace(prefix);
XmlQualifiedName qname = new XmlQualifiedName(name, namespaceURI);
IXsltContextVariable variable = this.manager.VariableScope.ResolveVariable(qname);
if (variable == null) {
throw new XPathException(Res.Xslt_InvalidVariable, qname.ToString());
}
return variable;
}
示例5: CreateRootElement
/// <summary>
/// Gets the root element metadata for the reader's current XML node</summary>
/// <param name="reader">XML reader</param>
/// <param name="rootUri">URI of XML data</param>
/// <returns>Root element metadata for the reader's current XML node</returns>
protected override ChildInfo CreateRootElement(XmlReader reader, Uri rootUri)
{
ColladaSchemaTypeLoader colladaSchemaTypeLoader = TypeLoader as ColladaSchemaTypeLoader;
if (colladaSchemaTypeLoader == null)
return base.CreateRootElement(reader, rootUri);
XmlQualifiedName rootElementName =
new XmlQualifiedName(reader.LocalName, colladaSchemaTypeLoader.Namespace);
return TypeLoader.GetRootElement(rootElementName.ToString());
}
示例6: SelectOperation
/// <summary>
/// Associates a local operation with the incoming method.
/// </summary>
/// <returns>
/// The name of the operation to be associated with the <paramref name="message"/>.
/// </returns>
/// <param name="message">
/// The incoming <see cref="T:System.ServiceModel.Channels.Message"/> to be associated with an
/// operation.
/// </param>
public string SelectOperation(ref Message message)
{
XmlDictionaryReader bodyReader = message.GetReaderAtBodyContents();
var lookupQName = new XmlQualifiedName(bodyReader.LocalName, bodyReader.NamespaceURI);
message = CreateMessageCopy(message, bodyReader);
if (this._dispatchDictionary.ContainsKey(lookupQName))
{
return this._dispatchDictionary[lookupQName];
}
if (this._defaultOperationName == null)
{
throw new WebFaultException<string>(lookupQName.ToString(), HttpStatusCode.BadRequest);
}
return this._defaultOperationName;
}
示例7: CreateRootElement
/// <summary>
/// Gets the root element metadata for the reader's current XML node</summary>
/// <param name="reader">XML reader</param>
/// <param name="rootUri">URI of XML data</param>
/// <returns>Root element metadata for the reader's current XML node</returns>
protected override ChildInfo CreateRootElement(XmlReader reader, Uri rootUri)
{
// ignore the ATGI version in the document, and use the loaded ATGI schema instead
AtgiSchemaTypeLoader atgiSchemaTypeLoader = TypeLoader as AtgiSchemaTypeLoader;
if (atgiSchemaTypeLoader != null)
{
XmlQualifiedName rootElementName =
new XmlQualifiedName(reader.LocalName, atgiSchemaTypeLoader.Namespace);
ChildInfo rootElement = TypeLoader.GetRootElement(rootElementName.ToString());
// ID passed to TypeLoader.GetRootElement must be same format as in XmlSchemaTypeLoader.Load(XmlSchemaSet)
// In XmlSchemaTypeLoader.cs look for "string name = element.QualifiedName.ToString();"
return rootElement;
}
else
{
return base.CreateRootElement(reader, rootUri);
}
}
示例8: FindDataType
private XmlSchemaSimpleType FindDataType(XmlQualifiedName name)
{
TypeDesc typeDesc = base.Scope.GetTypeDesc(name.Name, name.Namespace);
if ((typeDesc != null) && (typeDesc.DataType is XmlSchemaSimpleType))
{
return (XmlSchemaSimpleType) typeDesc.DataType;
}
XmlSchemaSimpleType type = (XmlSchemaSimpleType) base.Schemas.Find(name, typeof(XmlSchemaSimpleType));
if (type != null)
{
return type;
}
if (name.Namespace != "http://www.w3.org/2001/XMLSchema")
{
throw new InvalidOperationException(Res.GetString("XmlMissingDataType", new object[] { name.ToString() }));
}
return (XmlSchemaSimpleType) base.Scope.GetTypeDesc(typeof(string)).DataType;
}
示例9: InitializeServiceHost
//.........这里部分代码省略.........
{
ServiceEndpoint endpoint = stuff.Value.Endpoints[i];
string viaString = listenUri.AbsoluteUri;
// ensure all endpoints with this ListenUriInfo have same binding
if (endpoint.Binding != binding)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.ABindingInstanceHasAlreadyBeenAssociatedTo1, viaString)));
}
// ensure all endpoints with this ListenUriInfo have same identity
if (!object.Equals(endpoint.Address.Identity, identity))
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(
SR.GetString(SR.SFxWhenMultipleEndpointsShareAListenUriTheyMustHaveSameIdentity, viaString)));
}
// add binding parameters (endpoint scope and below)
AddMsmqIntegrationContractInformation(endpoint);
SecurityContractInformationEndpointBehavior.ServerInstance.AddBindingParameters(endpoint, parameters);
AddBindingParameters(endpoint, parameters);
}
// build IChannelListener and ChannelDispatcher
IChannelListener listener;
Type channelType = this.BuildChannelListener(stuff.Value,
serviceHost,
listenUri,
listenUriMode,
supportContextSession,
out listener);
XmlQualifiedName bindingQname = new XmlQualifiedName(binding.Name, binding.Namespace);
ChannelDispatcher channelDispatcher = new ChannelDispatcher(listener, bindingQname.ToString(), binding);
channelDispatcher.SetEndpointAddressTable(endpointAddressTable);
stuff.Value.ChannelDispatcher = channelDispatcher;
bool canReceiveInTransaction = false; // at least one operation is TransactionScopeRequired
int transactedBatchSize = int.MaxValue;
for (int i = 0; i < stuff.Value.Endpoints.Count; i++)
{
ServiceEndpoint endpoint = stuff.Value.Endpoints[i];
string viaString = listenUri.AbsoluteUri;
EndpointFilterProvider provider = new EndpointFilterProvider();
EndpointDispatcher dispatcher = DispatcherBuilder.BuildDispatcher(serviceHost, description, endpoint, endpoint.Contract, provider);
for (int j = 0; j < endpoint.Contract.Operations.Count; j++)
{
OperationDescription operation = endpoint.Contract.Operations[j];
OperationBehaviorAttribute operationBehavior = operation.Behaviors.Find<OperationBehaviorAttribute>();
if (null != operationBehavior && operationBehavior.TransactionScopeRequired)
{
canReceiveInTransaction = true;
break;
}
}
if (!endpointInfosPerEndpointAddress.ContainsKey(endpoint.Address))
{
endpointInfosPerEndpointAddress.Add(endpoint.Address, new Collection<EndpointInfo>());
}
endpointInfosPerEndpointAddress[endpoint.Address].Add(new EndpointInfo(endpoint, dispatcher, provider));
channelDispatcher.Endpoints.Add(dispatcher);
示例10: DefineModuleType
/// <summary>
/// Prepare metadata for the module type, to be used by the palette and circuit drawing engine</summary>
/// <param name="name"> Schema full name of the DomNodeType for the module type</param>
/// <param name="displayName">Display name for the module type</param>
/// <param name="description"></param>
/// <param name="imageName">Image name </param>
/// <param name="inputs">Define input pins for the module type</param>
/// <param name="outputs">Define output pins for the module type</param>
/// <param name="loader">XML schema loader </param>
/// <param name="domNodeType">optional DomNode type for the module type</param>
/// <returns>DomNodeType that was created (or the domNodeType parameter, if it wasn't null)</returns>
protected DomNodeType DefineModuleType(
XmlQualifiedName name,
string displayName,
string description,
string imageName,
ElementType.Pin[] inputs,
ElementType.Pin[] outputs,
SchemaLoader loader,
DomNodeType domNodeType = null)
{
if (domNodeType == null)
// create the type
domNodeType = new DomNodeType(
name.ToString(),
Schema.moduleType.Type,
EmptyArray<AttributeInfo>.Instance,
EmptyArray<ChildInfo>.Instance,
EmptyArray<ExtensionInfo>.Instance);
DefineCircuitType(domNodeType, displayName, imageName, inputs, outputs);
// add it to the schema-defined types
loader.AddNodeType(name.ToString(), domNodeType);
// add the type to the palette
m_paletteService.AddItem(
new NodeTypePaletteItem(
domNodeType,
displayName,
description,
imageName),
PaletteCategory,
this);
return domNodeType;
}
示例11: FastGetElementDecl
private SchemaElementDecl FastGetElementDecl(XmlQualifiedName elementName, object particle)
{
SchemaElementDecl elementDecl = null;
if (particle != null)
{
XmlSchemaElement element = particle as XmlSchemaElement;
if (element != null)
{
elementDecl = element.ElementDecl;
}
else
{
XmlSchemaAny any = (XmlSchemaAny) particle;
this.processContents = any.ProcessContentsCorrect;
}
}
if ((elementDecl != null) || (this.processContents == XmlSchemaContentProcessing.Skip))
{
return elementDecl;
}
if (this.isRoot && (this.partialValidationType != null))
{
if (this.partialValidationType is XmlSchemaElement)
{
XmlSchemaElement partialValidationType = (XmlSchemaElement) this.partialValidationType;
if (elementName.Equals(partialValidationType.QualifiedName))
{
return partialValidationType.ElementDecl;
}
this.SendValidationEvent("Sch_SchemaElementNameMismatch", elementName.ToString(), partialValidationType.QualifiedName.ToString());
return elementDecl;
}
if (this.partialValidationType is XmlSchemaType)
{
XmlSchemaType type = (XmlSchemaType) this.partialValidationType;
return type.ElementDecl;
}
this.SendValidationEvent("Sch_ValidateElementInvalidCall", string.Empty);
return elementDecl;
}
return this.compiledSchemaInfo.GetElementDecl(elementName);
}
示例12: ValidateElementContext
private object ValidateElementContext(XmlQualifiedName elementName, out bool invalidElementInContext)
{
object element = null;
int errorCode = 0;
XmlSchemaElement substitutionGroupHead = null;
invalidElementInContext = false;
if (!this.context.NeedValidateChildren)
{
return element;
}
if (this.context.IsNill)
{
this.SendValidationEvent("Sch_ContentInNill", QNameString(this.context.LocalName, this.context.Namespace));
return null;
}
if ((this.context.ElementDecl.ContentValidator.ContentType == XmlSchemaContentType.Mixed) && (this.context.ElementDecl.Presence == SchemaDeclBase.Use.Fixed))
{
this.SendValidationEvent("Sch_ElementInMixedWithFixed", QNameString(this.context.LocalName, this.context.Namespace));
return null;
}
XmlQualifiedName qualifiedName = elementName;
bool flag = false;
Label_00AA:
element = this.context.ElementDecl.ContentValidator.ValidateElement(qualifiedName, this.context, out errorCode);
if (element == null)
{
if (errorCode == -2)
{
this.SendValidationEvent("Sch_AllElement", elementName.ToString());
invalidElementInContext = true;
this.processContents = this.context.ProcessContents = XmlSchemaContentProcessing.Skip;
return null;
}
flag = true;
substitutionGroupHead = this.GetSubstitutionGroupHead(qualifiedName);
if (substitutionGroupHead != null)
{
qualifiedName = substitutionGroupHead.QualifiedName;
goto Label_00AA;
}
}
if (flag)
{
XmlSchemaElement element2 = element as XmlSchemaElement;
if (element2 == null)
{
element = null;
}
else if (element2.RefName.IsEmpty)
{
this.SendValidationEvent("Sch_InvalidElementSubstitution", BuildElementName(elementName), BuildElementName(element2.QualifiedName));
invalidElementInContext = true;
this.processContents = this.context.ProcessContents = XmlSchemaContentProcessing.Skip;
}
else
{
element = this.compiledSchemaInfo.GetElement(elementName);
this.context.NeedValidateChildren = true;
}
}
if (element == null)
{
ElementValidationError(elementName, this.context, this.eventHandler, this.nsResolver, this.sourceUriString, this.positionInfo.LineNumber, this.positionInfo.LinePosition, this.schemaSet);
invalidElementInContext = true;
this.processContents = this.context.ProcessContents = XmlSchemaContentProcessing.Skip;
}
return element;
}
示例13: CheckValueFacets
internal override Exception CheckValueFacets(XmlQualifiedName value, SimpleTypeValidator type)
{
RestrictionFacets facets = type.RestrictionFacets;
if (facets == null || !facets.HasValueFacets) {
return null;
}
if (facets == null)
{
return null;
}
RestrictionFlags flags = facets.Flags;
XmlSchemaDatatype datatype = type.DataType;
if ((flags & RestrictionFlags.Enumeration) != 0)
{
ArrayList enums = facets.Enumeration;
if (!MatchEnumeration(value, enums, datatype))
{
return new LinqToXsdFacetException(RestrictionFlags.Enumeration,
facets.Enumeration,
value);
}
}
string strValue = value.ToString();
int length = strValue.Length;
if ((flags & RestrictionFlags.Length) != 0)
{
if (length != facets.Length)
{
return new LinqToXsdFacetException(RestrictionFlags.Length, facets.Length, value);
}
}
if ((flags & RestrictionFlags.MaxLength) != 0)
{
if (length > facets.MaxLength)
{
return new LinqToXsdFacetException(RestrictionFlags.MaxLength, facets.MaxLength, value);
}
}
if ((flags & RestrictionFlags.MinLength) != 0)
{
if (length < facets.MinLength)
{
return new LinqToXsdFacetException(RestrictionFlags.MinLength, facets.MinLength, value);
}
}
return null;
}
示例14: ValidateAttribute
private object ValidateAttribute(string lName, string ns, XmlValueGetter attributeValueGetter, string attributeStringValue, XmlSchemaInfo schemaInfo) {
if (lName == null) {
throw new ArgumentNullException("localName");
}
if (ns == null) {
throw new ArgumentNullException("namespaceUri");
}
ValidatorState toState = validationStack.Length > 1 ? ValidatorState.Attribute : ValidatorState.TopLevelAttribute;
CheckStateTransition(toState, MethodNames[(int)toState]);
object typedVal = null;
attrValid = true;
XmlSchemaValidity localValidity = XmlSchemaValidity.NotKnown;
XmlSchemaAttribute localAttribute = null;
XmlSchemaSimpleType localMemberType = null;
ns = nameTable.Add(ns);
if(Ref.Equal(ns,NsXmlNs)) {
return null;
}
SchemaAttDef attributeDef = null;
SchemaElementDecl currentElementDecl = context.ElementDecl;
XmlQualifiedName attQName = new XmlQualifiedName(lName, ns);
if (attPresence[attQName] != null) { //this attribute already checked as it is duplicate;
SendValidationEvent(Res.Sch_DuplicateAttribute, attQName.ToString());
if (schemaInfo != null) {
schemaInfo.Clear();
}
return null;
}
if (!Ref.Equal(ns,NsXsi)) { //
XmlSchemaObject pvtAttribute = currentState == ValidatorState.TopLevelAttribute ? partialValidationType : null;
AttributeMatchState attributeMatchState;
attributeDef = compiledSchemaInfo.GetAttributeXsd(currentElementDecl, attQName, pvtAttribute, out attributeMatchState);
switch (attributeMatchState) {
case AttributeMatchState.UndeclaredElementAndAttribute:
if((attributeDef = CheckIsXmlAttribute(attQName)) != null) { //Try for xml attribute
goto case AttributeMatchState.AttributeFound;
}
if (currentElementDecl == null
&& processContents == XmlSchemaContentProcessing.Strict
&& attQName.Namespace.Length != 0
&& compiledSchemaInfo.Contains(attQName.Namespace)
) {
attrValid = false;
SendValidationEvent(Res.Sch_UndeclaredAttribute, attQName.ToString());
}
else if (processContents != XmlSchemaContentProcessing.Skip) {
SendValidationEvent(Res.Sch_NoAttributeSchemaFound, attQName.ToString(), XmlSeverityType.Warning);
}
break;
case AttributeMatchState.UndeclaredAttribute:
if((attributeDef = CheckIsXmlAttribute(attQName)) != null) {
goto case AttributeMatchState.AttributeFound;
}
else {
attrValid = false;
SendValidationEvent(Res.Sch_UndeclaredAttribute, attQName.ToString());
}
break;
case AttributeMatchState.ProhibitedAnyAttribute:
if((attributeDef = CheckIsXmlAttribute(attQName)) != null) {
goto case AttributeMatchState.AttributeFound;
}
else {
attrValid = false;
SendValidationEvent(Res.Sch_ProhibitedAttribute, attQName.ToString());
}
break;
case AttributeMatchState.ProhibitedAttribute:
attrValid = false;
SendValidationEvent(Res.Sch_ProhibitedAttribute, attQName.ToString());
break;
case AttributeMatchState.AttributeNameMismatch:
attrValid = false;
SendValidationEvent(Res.Sch_SchemaAttributeNameMismatch, new string[] { attQName.ToString(), ((XmlSchemaAttribute)pvtAttribute).QualifiedName.ToString()});
break;
case AttributeMatchState.ValidateAttributeInvalidCall:
Debug.Assert(currentState == ValidatorState.TopLevelAttribute); //Re-set state back to start on error with partial validation type
currentState = ValidatorState.Start;
attrValid = false;
SendValidationEvent(Res.Sch_ValidateAttributeInvalidCall, string.Empty);
break;
case AttributeMatchState.AnyIdAttributeFound:
if (wildID == null) {
wildID = attributeDef;
Debug.Assert(currentElementDecl != null);
XmlSchemaComplexType ct = currentElementDecl.SchemaType as XmlSchemaComplexType;
Debug.Assert(ct != null);
if (ct.ContainsIdAttribute(false)) {
//.........这里部分代码省略.........
示例15: CheckElementReference
//Check the <element .. > in a sequence
void CheckElementReference (XmlSchemaObject obj, string name, QName schema_type, bool nillable)
{
XmlSchemaElement element = obj as XmlSchemaElement;
Assert.IsNotNull (element, "XmlSchemaElement not found for " + schema_type.ToString ());
Assert.AreEqual (name, element.Name, "#v1, Element name did not match");
//FIXME: Assert.AreEqual (0, element.MinOccurs, "#v0, MinOccurs should be 0 for element '" + name + "'");
Assert.AreEqual (schema_type, element.SchemaTypeName, "#v2, SchemaTypeName for element '" + element.Name + "' did not match.");
Assert.AreEqual (nillable, element.IsNillable, "#v3, Element '" + element.Name + "', schema type = '" + schema_type + "' should have nillable = " + nillable);
}