private void SetAttributes(SvgElement element, XmlReader reader, SvgDocument document) { //Trace.TraceInformation("Begin SetAttributes"); //string[] styles = null; //string[] style = null; //int i = 0; while (reader.MoveToNextAttribute()) { if (reader.LocalName.Equals("style") && !(element is NonSvgElement)) { var inlineSheet = cssParser.Parse("#a{" + reader.Value + "}"); foreach (var rule in inlineSheet.StyleRules) { foreach (var decl in rule.Declarations) { element.AddStyle(decl.Name, decl.Term.ToString(), SvgElement.StyleSpecificity_InlineStyle); } } } else if (IsStyleAttribute(reader.LocalName)) { element.AddStyle(reader.LocalName, reader.Value, SvgElement.StyleSpecificity_PresAttribute); } else { SetPropertyValue(element, reader.LocalName, reader.Value, document); } } //Trace.TraceInformation("End SetAttributes"); }
private void SetAttributes(SvgElement element, XmlReader reader, SvgDocument document) { //Trace.TraceInformation("Begin SetAttributes"); //string[] styles = null; //string[] style = null; //int i = 0; while (reader.MoveToNextAttribute()) { var prefix = reader.Prefix; var localName = reader.LocalName; if (reader.ReadAttributeValue()) { if (prefix.Length == 0) { if (localName.Equals("xmlns")) { element.Namespaces[string.Empty] = reader.Value; continue; } else if (localName.Equals("version")) { continue; } } else if (prefix.Equals("xmlns")) { element.Namespaces[localName] = reader.Value; continue; } if (localName.Equals("style") && !(element is NonSvgElement)) { var inlineSheet = cssParser.Parse("#a{" + reader.Value + "}"); foreach (var rule in inlineSheet.StyleRules) { foreach (var decl in rule.Declarations) { element.AddStyle(decl.Name, decl.Term.ToString(), SvgElement.StyleSpecificity_InlineStyle); } } } else if (prefix.Length == 0 && IsStyleAttribute(localName)) { element.AddStyle(localName, reader.Value, SvgElement.StyleSpecificity_PresAttribute); } else { var ns = prefix.Length == 0 ? string.Empty : reader.LookupNamespace(prefix); SetPropertyValue(element, ns, localName, reader.Value, document); } } } //Trace.TraceInformation("End SetAttributes"); }