private NvdlNamespace ReadNamespace() { NvdlNamespace el = new NvdlNamespace(); FillLocation(el); el.NS = reader.GetAttribute("ns"); el.Wildcard = reader.GetAttribute("wildCard"); el.Match = ParseMatch(reader.GetAttribute("match")); FillForeignAttribute(el); if (reader.IsEmptyElement) { reader.Skip(); return(el); } reader.Read(); do { reader.MoveToContent(); if (reader.NodeType == XmlNodeType.EndElement) { break; } if (reader.NamespaceURI != Nvdl.Namespace) { el.Foreign.Add(XDocument.ReadFrom(reader)); continue; } ReadAction(el); } while (!reader.EOF); if (!reader.EOF) { reader.Read(); } return(el); }
public SimpleRule(NvdlRule rule, bool matchAttributes, NvdlCompileContext ctx) { FillLocation(rule); this.matchAttributes = matchAttributes; NvdlNamespace nss = rule as NvdlNamespace; if (nss == null) { this.isAny = true; } else { this.ns = nss.NS; if (nss.Wildcard == null) { wildcard = "*"; } else if (nss.Wildcard.Length > 1) { throw new NvdlCompileException("'wildCard' attribute can specify at most one character string.", rule); } else { wildcard = nss.Wildcard; } } SimplifyPhase1(rule, ctx); }
private NvdlNamespace ReadNamespace () { NvdlNamespace el = new NvdlNamespace (); FillLocation (el); el.NS = reader.GetAttribute ("ns"); el.Wildcard = reader.GetAttribute ("wildCard"); el.Match = ParseMatch (reader.GetAttribute ("match")); FillForeignAttribute (el); if (reader.IsEmptyElement) { reader.Skip (); return el; } reader.Read (); do { reader.MoveToContent (); if (reader.NodeType == XmlNodeType.EndElement) break; if (reader.NamespaceURI != Nvdl.Namespace) { el.Foreign.Add (doc.ReadNode (reader)); continue; } ReadAction (el); } while (!reader.EOF); if (!reader.EOF) reader.Read (); return el; }