public static object DynCreateAttribute([Implict] Executive executive, QNameValue name, object value) { XQueryContext context = (XQueryContext)executive.Owner; XQueryDocument doc = context.CreateDocument(); XQueryDocumentBuilder builder = new XQueryDocumentBuilder(doc); if (name.Prefix == "xmlns" || (name.Prefix == "" && name.LocalName == "xmlns")) throw new XQueryException(Properties.Resources.XQDY0044); builder.WriteStartElement("dummy"); builder.WriteStartAttribute(name.Prefix, name.LocalName, name.NamespaceUri); string text = value == Undefined.Value ? "" : (string)value; builder.WriteString(text); builder.WriteEndAttribute(); builder.WriteEndElement(); XPathNavigator nav = doc.CreateNavigator(); return new NodeIterator(XPathFactory.DynAttributeIterator(nav)); }
public static object BeginAttribute([Implict] Executive executive, object o, QNameValue name) { XQueryContext context = (XQueryContext)executive.Owner; XQueryDocumentBuilder builder = GetBuilder(o); builder.WriteStartAttribute(name.Prefix, name.LocalName, name.NamespaceUri); return builder; }
public static object DynCreateElement([Implict] Executive executive, QNameValue name, object body) { XQueryContext context = (XQueryContext)executive.Owner; XQueryDocument doc = context.CreateDocument(); XQueryDocumentBuilder builder = new XQueryDocumentBuilder(doc); builder.WriteStartElement(name.Prefix, name.LocalName, name.NamespaceUri); if (body != null) WriteNode(executive, builder, body); builder.WriteEndElement(); return doc.CreateNavigator(); }