本文整理汇总了C#中System.Xml.XmlAttributeCollection类的典型用法代码示例。如果您正苦于以下问题:C# XmlAttributeCollection类的具体用法?C# XmlAttributeCollection怎么用?C# XmlAttributeCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XmlAttributeCollection类属于System.Xml命名空间,在下文中一共展示了XmlAttributeCollection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetValue
public void SetValue(XmlAttributeCollection inValue)
{
constructList.Add(new ItemConstruct());
// 构造函数
ItemConstruct construct = new ItemConstruct(new List<string>() { "System.String" });
construct.Struct.Statements.Add(Line("string[] ss", "inArg0.Split(\'^\')"));
classer.CustomAttributes.Add(new CodeAttributeDeclaration("ProtoContract"));
for (int i = 0; i < inValue.Count; i++)
{
fieldList.Add(new ItemField(inValue[i].Name, inValue[i].Value, MemberAttributes.Private));
ItemProperty item = new ItemProperty(inValue[i].Name);
item.SetGetName();
item.SetSetName();
item.SetValueType(inValue[i].Value);
item.SetModifier(MemberAttributes.Public | MemberAttributes.Final);
item.SetField("ProtoMember", (i + 1).ToString());
propertyList.Add(item);
Type t = Stringer.ToType(inValue[i].Value);
string right = t == typeof(System.String) ? "ss[" + i + "]" :
t == typeof(System.UInt32) ? "uint.Parse(ss[" + i + "])" :
t == typeof(System.Single) ? "float.Parse(ss[" + i + "])" : "new " + t.ToString() + "(inValues[" + i + "])";
construct.Struct.Statements.Add(Line("_" + Stringer.FirstLetterLower(inValue[i].Name), right));
}
constructList.Add(construct);
Create();
}
示例2: CreateFromXML
public static void CreateFromXML(Scene scene, XmlAttributeCollection attributes)
{
int playerNumber = attributes.Int("player", 0);
Session playerSession;
Color color = Color.None;
if (playerNumber == 0)
{
playerSession = Global.PlayerOneSession;
color = Color.White;
}
else if (playerNumber == 1)
{
playerSession = Global.PlayerTwoSession;
color = Color.Yellow;
}
else if (playerNumber == 2)
{
playerSession = Global.PlayerThreeSession;
color = Color.Blue;
}
else
{
playerSession = Global.PlayerFourSession;
color = Color.Grey;
}
Bomberman player = new Bomberman(playerSession, color);
player.SetPosition(attributes.Int("x", 0), attributes.Int("y", 0));
scene.Add(player);
}
示例3: SetProperties
internal static void SetProperties(Object instance, XmlAttributeCollection attrs) {
// This is called from both XSD and XDR schemas.
// Do we realy need it in XSD ???
for (int i = 0; i < attrs.Count; i++) {
if (attrs[i].NamespaceURI == Keywords.MSDNS) {
string name = attrs[i].LocalName;
string value = attrs[i].Value;
if (name == "DefaultValue" || name == "RemotingFormat")
continue;
// Webdata 97925, skipp expressions, we will handle them after SetProperties (in xdrschema)
if (name == "Expression" && instance is DataColumn)
continue;
PropertyDescriptor pd = TypeDescriptor.GetProperties(instance)[name];
if (pd != null) {
// Standard property
Type type = pd.PropertyType;
TypeConverter converter = XMLSchema.GetConverter(type);
object propValue;
if (converter.CanConvertFrom(typeof(string))) {
propValue = converter.ConvertFromString(value);
}else if (type == typeof(Type)) {
propValue = DataStorage.GetType(value);
}else if (type == typeof(CultureInfo)) {
propValue = new CultureInfo(value);
}else {
throw ExceptionBuilder.CannotConvert(value,type.FullName);
}
pd.SetValue(instance, propValue);
}
}
}
}// SetProperties
示例4: GatewayProvider
public GatewayProvider(XmlAttributeCollection attributes)
{
if (attributes == null)
{
throw new ArgumentNullException("attributes");
}
this.name = attributes["name"].Value.ToLower();
this.requestType = attributes["requestType"].Value;
this.notifyType = attributes["notifyType"].Value;
this.displayName = attributes["displayName"].Value;
string[] strArray = attributes["supportedCurrency"].Value.Split(new char[] { ',' });
this.supportedCurrencys = new List<string>();
foreach (string str in strArray)
{
this.supportedCurrencys.Add(str);
}
this.providerAttributes = new NameValueCollection();
foreach (XmlAttribute attribute in attributes)
{
if ((((attribute.Name != "name") && (attribute.Name != "displayName")) && ((attribute.Name != "requestType") && (attribute.Name != "notifyType"))) && (attribute.Name != "supportedCurrency"))
{
this.providerAttributes.Add(attribute.Name, attribute.Value);
}
}
}
示例5: ReceiveStep
/// <summary>
/// Initializes a new instance of the ReceiveStep class
/// </summary>
/// <param name="attributes">Xml attributes from the BPEL file</param>
public ReceiveStep(XmlAttributeCollection attributes)
{
if (attributes != null)
{
foreach (XmlAttribute attrib in attributes)
{
if (attrib.LocalName == "name")
{
StepId = attrib.Value;
}
else if (attrib.LocalName == "variable")
{
this.variableName = attrib.Value;
}
}
}
if (this.variableName.Equals("subWorkflowComplete", StringComparison.OrdinalIgnoreCase))
{
}
else
{
// message name so use variableName in search criteria
this._messageName = this.variableName;
}
}
示例6: Rectangle
public Rectangle(XmlAttributeCollection fontAttrs, XmlAttributeCollection rectAttrs)
{
this._rectangleAttrs = rectAttrs;
FontAttributes = fontAttrs;
init();
}
示例7: AttributeValue
public static String AttributeValue( XmlAttributeCollection attrs, String name )
{
XmlNode n = attrs[name];
if( n != null )
return n.Value;
return null;
}
示例8: DefaultCustomElement
/// <summary>
/// Constructor
/// </summary>
/// <param name="fontAttrs"></param>
/// <param name="elementAttrs"></param>
/// <param name="vars"></param>
public DefaultCustomElement( XmlAttributeCollection fontAttrs, XmlAttributeCollection elementAttrs, List<Variable> vars):base(fontAttrs, elementAttrs, vars)
{
// FontAttributes = fontAttrs;
// // this._elementAttrs = elementAttrs;
// base.Attributes = elementAttrs;
// base.Vars = vars;
}
示例9: InvokeStep
/// <summary>
/// Initializes a new instance of the InvokeStep class
/// </summary>
/// <param name="attributes">Xml attributes from the BPEL file
/// when invoking execution of workflow activities</param>
public InvokeStep(XmlAttributeCollection attributes)
{
InvokeContext = new InvokeContextModel();
// this.type = InvokeType.Unknown;
foreach (XmlAttribute attrib in attributes)
{
switch (attrib.LocalName.ToLower())
{
case "operation":
InvokeContext.Operation = attrib.Value;
break;
case "name":
InvokeContext.Name = attrib.Value;
StepId = attrib.Value;
break;
case "partnerlink":
InvokeContext.PartnerLink = attrib.Value;
break;
case "porttype":
InvokeContext.PortType = attrib.Value;
break;
case "inputvariable":
InvokeContext.InputVariable = attrib.Value;
break;
default:
break;
}
}
}
示例10: IsEqual
private static bool IsEqual(XmlAttributeCollection left, XmlAttributeCollection right)
{
if (left == null)
{
return right == null;
}
if (right == null)
{
return false;
}
if (left.Count != right.Count)
{
return false;
}
foreach (XmlAttribute attr in left)
{
var rightAttrNode = right.GetNamedItem(attr.Name);
if (rightAttrNode == null)
{
return false;
}
if ((rightAttrNode as XmlAttribute).Value != attr.Value)
{
return false;
}
}
return true;
}
示例11: CEntityTransition
public CEntityTransition(CMap map, XmlAttributeCollection attributes, XmlNodeList properties)
{
m_map = map;
int l = Convert.ToInt16(attributes["x"].Value);
int t = Convert.ToInt16(attributes["y"].Value);
int w = Convert.ToInt16(attributes["width"].Value);
int h = Convert.ToInt16(attributes["height"].Value);
m_rect = new Rectangle(l, t, w, h);
foreach (XmlNode node in properties) {
switch (node.Attributes["name"].Value) {
case "Map":
newmap = node.InnerText.Trim();
break;
case "X":
newx = Convert.ToInt16(node.InnerText.Trim());
break;
case "Y":
newy = Convert.ToInt16(node.InnerText.Trim());
break;
}
}
map.Entities.AddLast(this);
}
示例12: PrepareHtmlClass
public PrepareHtmlClass(XmlAttributeCollection attributes, ref Dictionary<String, HtmlClass> liststylesheets, Dictionary<String, HtmlClass> listalreadystylesheets)
{
string csstext = string.Empty;
if (attributes["href"] != null)
{
string namefile = attributes["href"].Value;
if (namefile.StartsWith(@"https:/") || namefile.StartsWith(@"http:/"))
csstext = readcssfromnet(namefile);
else
{
//falta direfenciar si viene desde http, https, o sin dirección(solo el nombre o ruta del archivo)
}
if (csstext != string.Empty)
if (!liststylesheets.Keys.Contains(namefile))
{
if (listalreadystylesheets != null)
if (listalreadystylesheets.Keys.Contains(namefile))//style sheet has already been read before, no need to read it again
{
liststylesheets.Add(csstext, listalreadystylesheets[namefile]);
return;
}
HtmlClass css = new CssParser().Parser(csstext);
css.IdHtmlClass = namefile;
liststylesheets.Add(namefile, css);
}
}
}
示例13: OnEventStep
/// <summary>
/// Initializes a new instance of the OnMessageStep class
/// </summary>
/// <param name="attributes">Xml attributes from the BPEL file</param>
public OnEventStep(XmlAttributeCollection attributes)
{
// read attributes
foreach (XmlAttribute attrib in attributes)
{
switch (attrib.LocalName)
{
case "name":
StepId = attrib.Value;
break;
case "operation":
switch (attrib.Value)
{
case "messageTimeout":
// EventType = WorkflowEventType.Timeout;
break;
case "cancel":
// EventType = WorkflowEventType.Cancel;
break;
default:
// var ex = ErrorAndExceptionService.CreateLocutusException(this, "E67.01", null);
// throw ex;
return;
}
break;
case "variable":
if (string.IsNullOrEmpty(attrib.Value))
{
}
EventKey = attrib.Value;
break;
}
}
}
示例14: LinkBehavior
public LinkBehavior(XmlAttributeCollection collection)
: base(collection)
{
fileNode = null;
contextNode = null;
typeNode = null;
}
示例15: AreEqualAttribs
public bool AreEqualAttribs (XmlAttributeCollection expected, XmlAttributeCollection actual)
{
if (expected.Count != actual.Count)
return false;
for (int i=0; i<expected.Count; i++) {
if ((flags & Flags.IgnoreAttribOrder) != 0) {
string ln = expected[i].LocalName;
string ns = expected[i].NamespaceURI;
string val = expected[i].Value;
_expected = ns+":"+ln+"="+val;
XmlAttribute atr2 = actual[ln, ns];
_actual = atr2 == null ? "<<missing>>" : ns + ":" + ln + "=" + atr2.Value;
if (atr2 == null || atr2.Value.Trim().ToLower() != val.Trim().ToLower())
return false;
} else {
if (expected [i].LocalName != actual [i].LocalName)
return false;
if (expected [i].NamespaceURI != actual [i].NamespaceURI)
return false;
if (expected [i].Value.Trim().ToLower() != actual [i].Value.Trim().ToLower())
return false;
}
}
return true;
}