private int hashCodeUnion; // Set of hash bits that can quickly guarantee a name is not a duplicate /// <summary> /// Initialize the cache. Use this method instead of a constructor in order to reuse the cache. /// </summary> public void Init(XmlRawWriter wrapped) { SetWrappedWriter(wrapped); // Clear attribute list this.numEntries = 0; this.idxLastName = 0; this.hashCodeUnion = 0; }
public override XmlRawWriter StartTree(XPathNodeType rootType, IXmlNamespaceResolver nsResolver, XmlNameTable nameTable) { // Build XPathDocument // If rootType != XPathNodeType.Root, then build an XQuery fragment _doc = new XPathDocument(nameTable); _writer = _doc.LoadFromWriter(XPathDocument.LoadFlags.AtomizeNames | (rootType == XPathNodeType.Root ? XPathDocument.LoadFlags.None : XPathDocument.LoadFlags.Fragment), string.Empty); _writer.NamespaceResolver = nsResolver; return(_writer); }
/// <summary> /// The wrapped writer will callback on this method if it wishes to remove itself from the pipeline. /// </summary> private void SetWrappedWriter(XmlRawWriter writer) { // If new writer might remove itself from pipeline, have it callback on this method when its ready to go IRemovableWriter removable = writer as IRemovableWriter; if (removable != null) { removable.OnRemoveWriterEvent = SetWrappedWriter; } this.wrapped = writer; }
/// <summary> /// Create a document containing a root node and a single text node child with "text" as its text value. /// This method is thread-safe, and is always guaranteed to return the exact same document, no matter how many /// threads have called it concurrently. /// </summary> public XPathNavigator GetNavigator(string text, string baseUri, XmlNameTable nameTable) { if (this.cache == null) { // Create XPathDocument XPathDocument doc = new XPathDocument(nameTable); XmlRawWriter writer = doc.LoadFromWriter(XPathDocument.LoadFlags.AtomizeNames, baseUri); writer.WriteString(text); writer.Close(); this.cache = doc; } return(((XPathDocument)this.cache).CreateNavigator()); }
/// <summary> /// Create a document from the cache of events. If a document has already been created previously, return it. /// This method is thread-safe, and is always guaranteed to return the exact same document, no matter how many /// threads have called it concurrently. /// </summary> public XPathNavigator GetNavigator(XmlEventCache events, XmlNameTable nameTable) { if (this.cache == null) { // Create XPathDocument from event cache XPathDocument doc = new XPathDocument(nameTable); XmlRawWriter writer = doc.LoadFromWriter(XPathDocument.LoadFlags.AtomizeNames | (events.HasRootNode ? XPathDocument.LoadFlags.None : XPathDocument.LoadFlags.Fragment), events.BaseUri); events.EventsToWriter(writer); writer.Close(); this.cache = doc; } return(((XPathDocument)this.cache).CreateNavigator()); }
//------------------------------------------------------------------------ // ToNode (internal type to internal type) //------------------------------------------------------------------------ public static XPathNavigator ToNode(XPathItem item) { XsltLibrary.CheckXsltValue(item); if (!item.IsNode) { // Create Navigator over text node containing string value of item XPathDocument doc = new XPathDocument(); XmlRawWriter writer = doc.LoadFromWriter(XPathDocument.LoadFlags.AtomizeNames, string.Empty); writer.WriteString(ToString(item)); writer.Close(); return(doc.CreateNavigator()); } RtfNavigator?rtf = item as RtfNavigator; if (rtf != null) { return(rtf.ToNavigator()); } return((XPathNavigator)item); }
internal NavigatorOutput(string baseUri) { _doc = new XPathDocument(); _wr = _doc.LoadFromWriter(XPathDocument.LoadFlags.AtomizeNames, baseUri); }
public XmlMergeSequenceWriter(XmlRawWriter xwrt) { _xwrt = xwrt; _lastItemWasAtomic = false; }
internal XmlRawWriterBase64Encoder(XmlRawWriter rawWriter) { this.rawWriter = rawWriter; }
/// <summary> /// Constructor. /// </summary> public XmlMergeSequenceWriter(XmlRawWriter xwrt) { this.xwrt = xwrt; this.lastItemWasAtomic = false; }