Beispiel #1
0
        /// <summary>
        /// This is used to write a new start element to the resulting XML
        /// document. This will create an output node of the specified
        /// name before writing the start tag. Once the tag is written
        /// the node is pushed on to the head of the output node stack.
        /// </summary>
        /// <param name="node">
        /// This is the node that is to have its name written.
        /// </param>
        public void WriteName(OutputNode node)
        {
            String prefix = node.GetPrefix(verbose);
            String name   = node.Name;

            if (name != null)
            {
                writer.WriteStart(name, prefix);
            }
        }
Beispiel #2
0
        //public String GetPrefix() {
        //   return GetPrefix(true);
        //}
        /// This is used to acquire the prefix for this output node. If
        /// the output node is an element then this will search its parent
        /// nodes until the prefix that is currently in scope is found.
        /// If however this node is an attribute then the hierarchy of
        /// nodes is not searched as attributes to not inherit namespaces.
        /// </summary>
        /// <param name="inherit">
        /// if there is no explicit prefix then inherit
        /// </param>
        /// <returns>
        /// this returns the prefix associated with this node
        /// </returns>
        public String GetPrefix(bool inherit)
        {
            String prefix = scope.Get(reference);

            if (inherit)
            {
                if (prefix == null)
                {
                    return(parent.GetPrefix());
                }
            }
            return(prefix);
        }
Beispiel #3
0
        /// <summary>
        /// This is used to write the attributes of the specified node to
        /// the output. This will iterate over each node entered on to
        /// the node. Once written the node is considered inactive.
        /// </summary>
        /// <param name="node">
        /// This is the node to have is attributes written.
        /// </param>
        public void WriteAttributes(OutputNode node)
        {
            NodeMap <OutputNode> map = node.Attributes;

            foreach (String name in map.Names)
            {
                OutputNode entry  = map.Get(name);
                String     prefix = entry.GetPrefix(verbose);
                String     value  = entry.Value;

                writer.WriteAttribute(name, value, prefix);
            }
            active.Remove(node);
        }
Beispiel #4
0
        /// <summary>
        /// This is used to write a new end element to the resulting XML
        /// document. This will acquire the name and value of the given
        /// node, if the node has a value that is written. Finally a new
        /// end tag is written to the document and the output is flushed.
        /// </summary>
        /// <param name="node">
        /// This is the node that is to have an end tag.
        /// </param>
        public void WriteEnd(OutputNode node, Mode mode)
        {
            String value = node.Value;

            if (value != null)
            {
                writer.WriteText(value, mode);
            }
            String prefix = node.GetPrefix(verbose);
            String name   = node.Name;

            if (name != null)
            {
                writer.WriteEnd(name, prefix);
                writer.Flush();
            }
        }