本文整理汇总了C#中QName类的典型用法代码示例。如果您正苦于以下问题:C# QName类的具体用法?C# QName怎么用?C# QName使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
QName类属于命名空间,在下文中一共展示了QName类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FastConstants
static FastConstants()
{
ANY_TYPE = new QName("any");
ERROR = FastAlertSeverity.ERROR;
WARN = FastAlertSeverity.WARN;
FATAL = FastAlertSeverity.FATAL;
DYNAMIC = new ErrorType("Dynamic");
STATIC = new ErrorType("Static");
REPORTABLE = new ErrorType("Reportable");
S1_INVALID_XML = new ErrorCode(STATIC, 1, "ERR S1", "Invalid XML", ERROR);
S2_OPERATOR_TYPE_INCOMP = new ErrorCode(STATIC, 2, "ERR S2", "Incompatible operator and type", ERROR);
S3_INITIAL_VALUE_INCOMP = new ErrorCode(STATIC, 3, "ERR S3", "Incompatible initial value", ERROR);
S4_NO_INITIAL_VALUE_FOR_CONST = new ErrorCode(STATIC, 4, "ERR S4", "Fields with constant operators must have a default value defined.", ERROR);
S5_NO_INITVAL_MNDTRY_DFALT = new ErrorCode(STATIC, 5, "ERR S5", "No initial value for mandatory field with default operator", ERROR);
D1_FIELD_APP_INCOMP = new ErrorCode(DYNAMIC, 1, "ERR D1", "Field cannot be converted to type of application field", ERROR);
D2_INT_OUT_OF_RANGE = new ErrorCode(DYNAMIC, 2, "ERR D2", "The integer value is out of range for the specified integer type.", WARN);
D3_CANT_ENCODE_VALUE = new ErrorCode(DYNAMIC, 3, "ERR D3", "The value cannot be encoded for the given operator.", ERROR);
D4_INVALID_TYPE = new ErrorCode(DYNAMIC, 4, "ERR D4", "The previous value is not the same type as the type of the current field.", ERROR);
D5_NO_DEFAULT_VALUE = new ErrorCode(DYNAMIC, 5, "ERR D5", "If no prior value is set and the field is not present, there must be a default value or the optional flag must be set.", ERROR);
D6_MNDTRY_FIELD_NOT_PRESENT = new ErrorCode(DYNAMIC, 6, "ERR D6", "A mandatory field must have a value", ERROR);
D7_SUBTRCTN_LEN_LONG = new ErrorCode(DYNAMIC, 7, "ERR D7", "The subtraction length is longer than the base value.", ERROR);
D8_TEMPLATE_NOT_EXIST = new ErrorCode(DYNAMIC, 8, "ERR D8", "The referenced template does not exist.", ERROR);
D9_TEMPLATE_NOT_REGISTERED = new ErrorCode(DYNAMIC, 9, "ERR D9", "The template has not been registered.", ERROR);
R1_LARGE_DECIMAL = new ErrorCode(REPORTABLE, 1, "ERR R1", "Decimal exponent does not fit into range -63...63", WARN);
R4_NUMERIC_VALUE_TOO_LARGE = new ErrorCode(REPORTABLE, 4, "ERR R4", "The value is too large.", WARN);
R5_DECIMAL_CANT_CONVERT_TO_INT = new ErrorCode(REPORTABLE, 5, "ERR R5", "The decimal value cannot convert to an integer because of trailing decimal part.", WARN);
R7_PMAP_OVERLONG = new ErrorCode(REPORTABLE, 7, "ERR R7", "The presence map is overlong.", WARN);
R8_PMAP_TOO_MANY_BITS = new ErrorCode(REPORTABLE, 8, "ERR R8", "The presence map has too many bits.", WARN);
R9_STRING_OVERLONG = new ErrorCode(REPORTABLE, 9, "ERR R9", "The string is overlong.", ERROR);
GENERAL_ERROR = new ErrorCode(DYNAMIC, 100, "GENERAL", "An error has occurred.", ERROR);
IMPOSSIBLE_EXCEPTION = new ErrorCode(DYNAMIC, 101, "IMPOSSIBLE", "This should never happen.", ERROR);
IO_ERROR = new ErrorCode(DYNAMIC, 102, "IOERROR", "An IO error occurred.", FATAL);
PARSE_ERROR = new ErrorCode(DYNAMIC, 103, "PARSEERR", "An exception occurred while parsing.", ERROR);
LENGTH_FIELD = new QName("length", TEMPLATE_DEFINITION_1_1);
}
示例2: Convert
public override Field Convert(GroupValue fieldDef, ITemplateRegistry templateRegistry, ConversionContext context)
{
var name = new QName(fieldDef.GetString("Name"), fieldDef.GetString("Ns"));
bool optional = fieldDef.GetBool("Optional");
GroupValue exponentDef = fieldDef.GetGroup("Exponent");
GroupValue exponentOperatorDef = exponentDef.GetGroup("Operator").GetGroup(0);
Operator exponentOperator = GetOperator(exponentOperatorDef.Group);
ScalarValue exponentDefaultValue = ScalarValue.Undefined;
if (exponentDef.IsDefined("InitialValue"))
exponentDefaultValue = new IntegerValue(exponentDef.GetInt("InitialValue"));
GroupValue mantissaDef = fieldDef.GetGroup("Mantissa");
GroupValue mantissaOperatorDef = mantissaDef.GetGroup("Operator").GetGroup(0);
Operator mantissaOperator = GetOperator(mantissaOperatorDef.Group);
ScalarValue mantissaDefaultValue = ScalarValue.Undefined;
if (mantissaDef.IsDefined("InitialValue"))
mantissaDefaultValue = new LongValue(mantissaDef.GetInt("InitialValue"));
ComposedScalar composedDecimal = Util.ComposedDecimal(name, exponentOperator, exponentDefaultValue,
mantissaOperator, mantissaDefaultValue, optional);
IFieldValue retAuxId;
if (fieldDef.TryGetValue("AuxId", out retAuxId) && retAuxId!=null)
{
composedDecimal.Id = retAuxId.ToString();
}
return composedDecimal;
}
示例3: Field
protected Field(string name, string key, bool optional, string id)
{
this.name = new QName(name);
this.key = new QName(key);
this.optional = optional;
this.id = id;
}
示例4: Group
public Group(QName name, Field[] fields, bool optional)
: base(name, optional)
{
var expandedFields = new List<Field>();
var references = new List<StaticTemplateReference>();
for (int i = 0; i < fields.Length; i++)
{
if (fields[i] is StaticTemplateReference)
{
var currentTemplate = (StaticTemplateReference)fields[i];
Field[] referenceFields = currentTemplate.Template.Fields;
for (int j = 1; j < referenceFields.Length; j++)
expandedFields.Add(referenceFields[j]);
references.Add(currentTemplate);
}
else
{
expandedFields.Add(fields[i]);
}
}
this.fields = expandedFields.ToArray();
fieldDefinitions = fields;
fieldIndexMap = ConstructFieldIndexMap(this.fields);
fieldNameMap = ConstructFieldNameMap(this.fields);
fieldIdMap = ConstructFieldIdMap(this.fields);
introspectiveFieldMap = ConstructInstrospectiveFields(this.fields);
usesPresenceMap_Renamed_Field = DeterminePresenceMapUsage(this.fields);
staticTemplateReferences = references.ToArray();
}
示例5: Convert
public override Field Convert(GroupValue fieldDef, TemplateRegistry templateRegistry, ConversionContext context)
{
string name = fieldDef.GetString("Name");
string ns = fieldDef.GetString("Ns");
var qname = new QName(name, ns);
var fields = GroupConverter.ParseFieldInstructions(fieldDef, templateRegistry, context);
bool optional = fieldDef.GetBool("Optional");
Scalar length = null;
if (fieldDef.IsDefined("Length"))
{
var lengthDef = fieldDef.GetGroup("Length");
QName lengthName;
string id = null;
if (lengthDef.IsDefined("Name"))
{
var nameDef = lengthDef.GetGroup("Name");
lengthName = new QName(nameDef.GetString("Name"), nameDef.GetString("Ns"));
if (nameDef.IsDefined("AuxId"))
id = nameDef.GetString("AuxId");
}
else
lengthName = Global.CreateImplicitName(qname);
var operator_Renamed = Operator.NONE;
if (lengthDef.IsDefined("Operator"))
operator_Renamed = GetOperator(lengthDef.GetGroup("Operator").GetGroup(0).GetGroup());
var initialValue = ScalarValue.UNDEFINED;
if (lengthDef.IsDefined("InitialValue"))
initialValue = (ScalarValue) lengthDef.GetValue("InitialValue");
length = new Scalar(lengthName, Type.U32, operator_Renamed, initialValue, optional) {Id = id};
}
return new Sequence(qname, length, fields, optional);
}
示例6: ComposedScalar
public ComposedScalar(QName name, FASTType type, Scalar[] fields, bool optional, ComposedValueConverter valueConverter)
: base(name, optional)
{
this.fields = fields;
this.valueConverter = valueConverter;
this.type = type;
}
示例7: GetId
public override int GetId(QName name)
{
MessageTemplate template = nameMap[name];
if (template == null || !templateMap.ContainsKey(template))
return - 1;
return templateMap[template];
}
示例8: createComposedDecimal
private static Field createComposedDecimal(System.Xml.XmlElement fieldNode, QName name, bool optional, System.Xml.XmlNode mantissaNode, System.Xml.XmlNode exponentNode, ParsingContext context)
{
string mantissaOperator = "none";
string exponentOperator = "none";
ScalarValue mantissaDefaultValue = ScalarValue.UNDEFINED;
ScalarValue exponentDefaultValue = ScalarValue.UNDEFINED;
QName mantissaKey = null;
QName exponentKey = null;
string mantissaDictionary = context.Dictionary;
string exponentDictionary = context.Dictionary;
string mantissaNamespace = context.Namespace;
string exponentNamespace = context.Namespace;
if ((mantissaNode != null) && mantissaNode.HasChildNodes)
{
System.Xml.XmlElement operatorElement = GetElement((System.Xml.XmlElement) mantissaNode, 1);
mantissaOperator = operatorElement.Name;
if (operatorElement.HasAttribute("value"))
mantissaDefaultValue = FASTType.I64.GetValue(operatorElement.GetAttribute("value"));
if (operatorElement.HasAttribute("ns"))
mantissaNamespace = operatorElement.GetAttribute("ns");
if (operatorElement.HasAttribute("key"))
mantissaKey = new QName(operatorElement.GetAttribute("key"), mantissaNamespace);
if (operatorElement.HasAttribute("dictionary"))
mantissaDictionary = operatorElement.GetAttribute("dictionary");
}
if ((exponentNode != null) && exponentNode.HasChildNodes)
{
System.Xml.XmlElement operatorElement = GetElement((System.Xml.XmlElement) exponentNode, 1);
exponentOperator = operatorElement.Name;
if (operatorElement.HasAttribute("value"))
exponentDefaultValue = FASTType.I32.GetValue(operatorElement.GetAttribute("value"));
if (operatorElement.HasAttribute("ns"))
exponentNamespace = operatorElement.GetAttribute("ns");
if (operatorElement.HasAttribute("key"))
exponentKey = new QName(operatorElement.GetAttribute("key"), exponentNamespace);
if (operatorElement.HasAttribute("dictionary"))
exponentDictionary = operatorElement.GetAttribute("dictionary");
}
ComposedScalar scalar = Util.ComposedDecimal(name, Operator.Operator.GetOperator(exponentOperator), exponentDefaultValue, Operator.Operator.GetOperator(mantissaOperator), mantissaDefaultValue, optional);
Scalar exponent = scalar.Fields[0];
exponent.Dictionary = exponentDictionary;
if (exponentKey != null)
exponent.Key = exponentKey;
Scalar mantissa = scalar.Fields[1];
mantissa.Dictionary = mantissaDictionary;
if (mantissaKey != null)
mantissa.Key = mantissaKey;
if (fieldNode.HasAttribute("id"))
scalar.Id = fieldNode.GetAttribute("id");
return scalar;
}
示例9: ComposedScalar
public ComposedScalar(QName name, FastType fastType, Scalar[] fields, bool optional,
IComposedValueConverter valueConverter)
: base(name, optional)
{
_fields = fields;
_valueConverter = valueConverter;
_fastType = fastType;
}
示例10: Group
public Group(QName name, string childNamespace, Field[] fields, bool optional)
: base(name, optional)
{
_childNamespace = childNamespace;
Init(fields,
out _fieldDefinitions, out _fields, out _fieldIndexMap, out _fieldNameMap,
out _introspectiveFieldMap, out _usesPresenceMapRenamedField, out _staticTemplateReferences);
}
示例11: Convert
public override Field Convert(GroupValue fieldDef, TemplateRegistry templateRegistry, ConversionContext context)
{
var name = new QName(fieldDef.GetString("Name"), fieldDef.GetString("Ns"));
if (!templateRegistry.IsDefined(name))
{
throw new System.SystemException("Referenced template " + name + " not defined.");
}
return new StaticTemplateReference(templateRegistry.get_Renamed(name));
}
示例12: Convert
public override Field Convert(GroupValue fieldDef, ITemplateRegistry templateRegistry, ConversionContext context)
{
var name = new QName(fieldDef.GetString("Name"), fieldDef.GetString("Ns"));
MessageTemplate template;
if (templateRegistry.TryGetTemplate(name, out template))
return new StaticTemplateReference(template);
throw new ArgumentOutOfRangeException("fieldDef", name, "Referenced template name not defined.");
}
示例13: Add
public override void Add(int templateId, QName templateName)
{
MessageTemplate template;
if (!_defNameMap.TryGetValue(templateName, out template))
throw new ArgumentOutOfRangeException("templateName", templateName, "The template is not defined.");
_regTemplateMap[template] = templateId;
_regIdMap[templateId] = template;
NotifyTemplateRegistered(template, templateId);
}
示例14: ParsingContext
public ParsingContext(XmlElement node, ParsingContext parent)
{
_parent = parent;
if (node.HasAttribute("templateNs"))
TemplateNamespace = node.GetAttribute("templateNs");
if (node.HasAttribute("ns"))
Namespace = node.GetAttribute("ns");
if (node.HasAttribute("dictionary"))
Dictionary = node.GetAttribute("dictionary");
if (node.HasAttribute("name"))
_name = new QName(node.GetAttribute("name"), Namespace);
}
示例15: Sequence
public Sequence(QName name, Scalar length, Field[] fields, bool optional)
: base(name, optional)
{
_group = new Group(name, fields, optional);
if (length == null)
{
_length = CreateLength(name, optional);
_implicitLength = true;
}
else
_length = length;
}