Add() public method

public Add ( char key, int start, int len ) : string
key char
start int
len int
return string
 private static XmlNameTable CreateNameTable()
 {
     XmlNameTable table = new System.Xml.NameTable();
     table.Add(string.Empty);
     table.Add("http://www.w3.org/2000/xmlns/");
     table.Add("http://www.w3.org/XML/1998/namespace");
     return table;
 }
        private static XmlNameTable CreateNameTable()
        {
            XmlNameTable table = new System.Xml.NameTable();

            table.Add(string.Empty);
            table.Add("http://www.w3.org/2000/xmlns/");
            table.Add("http://www.w3.org/XML/1998/namespace");
            return(table);
        }
Esempio n. 3
0
 public static XmlNameTable CreateXmlNameTable(List<ComponentBase> lst)
 {
     //NameTable nameTable = new NameTable();
     //foreach (ComponentBase item in lst)
     //{
     //    nameTable.Add(item.Name);
     //}
     //return nameTable;
     NameTable nt = new NameTable();
     object book = nt.Add("book");
     object price = nt.Add("price");
     return nt;
 }
Esempio n. 4
0
 public static XmlNameTable CreateXmlNameTable(List<Funclet> lst)
 {
     //NameTable nameTable = new NameTable();
     //foreach (Funclet item in lst)
     //{
     //    nameTable.Add(item.FunctionName);
     //}
     //return nameTable;
     NameTable nt = new NameTable();
     object book = nt.Add("book");
     object price = nt.Add("price");
     return nt;
 }
        // Reads to the following element with the given LocalName and NamespaceURI.
        public virtual bool ReadToFollowing(string localName, string namespaceURI)
        {
            if (localName == null || localName.Length == 0)
            {
                throw XmlExceptionHelper.CreateInvalidNameArgumentException(localName, "localName");
            }

            if (namespaceURI == null)
            {
                throw new ArgumentNullException("namespaceURI");
            }

            // atomize local name and namespace
            localName    = NameTable.Add(localName);
            namespaceURI = NameTable.Add(namespaceURI);

            // find following element with that name
            while (Read())
            {
                if (NodeType == XmlNodeType.Element && Ref.Equal(localName, LocalName) && Ref.Equal(namespaceURI, NamespaceURI))
                {
                    return(true);
                }
            }

            return(false);
        }
Esempio n. 6
0
 static Schema() {
     NameTable nt = new NameTable();
     nt.Add(Namespace.Xs.NamespaceName);
     NamespaceManager = new XmlNamespaceManager(nt);
     Swidtag = XDocument.Load(XmlReader.Create(new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream("FearTheCowboy.Iso19770.Properties.Swidtag.xsd.xml")), new XmlReaderSettings()));
     NamespaceManager.AddNamespace("xs", Namespace.Xs.NamespaceName);
 }
        // Reads to the next sibling of the current element with the given LocalName and NamespaceURI.
        public virtual bool ReadToNextSibling(string localName, string namespaceURI)
        {
            if (localName == null || localName.Length == 0)
            {
                throw XmlExceptionHelper.CreateInvalidNameArgumentException(localName, "localName");
            }

            if (namespaceURI == null)
            {
                throw new ArgumentNullException("namespaceURI");
            }

            // atomize local name and namespace
            localName    = NameTable.Add(localName);
            namespaceURI = NameTable.Add(namespaceURI);

            // find the next sibling
            XmlNodeType nt;

            do
            {
                SkipSubtree();
                nt = NodeType;
                if (nt == XmlNodeType.Element && Ref.Equal(localName, LocalName) && Ref.Equal(namespaceURI, NamespaceURI))
                {
                    return(true);
                }
            } while (nt != XmlNodeType.EndElement && !EOF);
            return(false);
        }
Esempio n. 8
0
 public NonValidatingReader(string content)
     : base()
 {
     this.content = content;
     _NameTable = new NameTable();
     Namespaces = new Dictionary<string,string>();
     Namespaces.Add(_NameTable.Add("xml"),"http://www.w3.org/XML/1998/namespace");
 }
Esempio n. 9
0
		/// <summary>
		/// Initializes a new instance of the <see cref="DynamicContext"/> class.
		/// </summary>
		/// <param name="context">A previously filled context with the namespaces to use.</param>
		/// <param name="table">The NameTable to use.</param>
		public DynamicContext(XmlNamespaceManager context, NameTable table) : base(table)
		{
			object xml = table.Add(XmlNamespaces.Xml);
			object xmlns = table.Add(XmlNamespaces.XmlNs);

			if (context != null)
			{
				foreach (string prefix in context)
				{
					string uri = context.LookupNamespace(prefix);
					// Use fast object reference comparison to omit forbidden namespace declarations.
					if (Object.Equals(uri, xml) || Object.Equals(uri, xmlns))
						continue;

					base.AddNamespace(prefix, uri);
				}
			}
		}
Esempio n. 10
0
        // Reads to the first descendant of the current element with the given LocalName and NamespaceURI.
        public virtual bool ReadToDescendant(string localName, string namespaceURI)
        {
            if (localName == null || localName.Length == 0)
            {
                throw XmlExceptionHelper.CreateInvalidNameArgumentException(localName, "localName");
            }

            if (namespaceURI == null)
            {
                throw new ArgumentNullException("namespaceURI");
            }

            // save the element or root depth
            int parentDepth = Depth;

            if (NodeType != XmlNodeType.Element)
            {
                // adjust the depth if we are on root node
                if (ReadState == ReadState.Initial)
                {
                    Debug.Assert(parentDepth == 0);
                    parentDepth--;
                }
                else
                {
                    return(false);
                }
            }
            else if (IsEmptyElement)
            {
                return(false);
            }

            // atomize local name and namespace
            localName    = NameTable.Add(localName);
            namespaceURI = NameTable.Add(namespaceURI);

            // find the descendant
            while (Read() && Depth > parentDepth)
            {
                if (NodeType == XmlNodeType.Element && Ref.Equal(localName, LocalName) && Ref.Equal(namespaceURI, NamespaceURI))
                {
                    return(true);
                }
            }

            Debug.Assert(NodeType == XmlNodeType.EndElement || (parentDepth == -1 && ReadState == ReadState.EndOfFile));
            return(false);
        }
Esempio n. 11
0
        // Reads to the first descendant of the current element with the given Name.
        public virtual bool ReadToDescendant(string name)
        {
            if (name == null || name.Length == 0)
            {
                throw new ArgumentException(name, "name");
            }

            // save the element or root depth
            int parentDepth = Depth;

            if (NodeType != XmlNodeType.Element)
            {
                // adjust the depth if we are on root node
                if (ReadState == ReadState.Initial)
                {
                    Debug.Assert(parentDepth == 0);
                    parentDepth--;
                }
                else
                {
                    return(false);
                }
            }
            else if (IsEmptyElement)
            {
                return(false);
            }

            // atomize name
            name = NameTable.Add(name);

            // find the descendant
            while (Read() && Depth > parentDepth)
            {
                if (NodeType == XmlNodeType.Element && Ref.Equal(name, Name))
                {
                    return(true);
                }
            }

            Debug.Assert(NodeType == XmlNodeType.EndElement || (parentDepth == -1 && ReadState == ReadState.EndOfFile));
            return(false);
        }
Esempio n. 12
0
        // Reads to the following element with the given Name.
        public virtual bool ReadToFollowing(string name)
        {
            if (name == null || name.Length == 0)
            {
                throw XmlExceptionHelper.CreateInvalidNameArgumentException(name, "name");
            }

            // atomize name
            name = NameTable.Add(name);

            // find following element with that name
            while (Read())
            {
                if (NodeType == XmlNodeType.Element && Ref.Equal(name, Name))
                {
                    return(true);
                }
            }

            return(false);
        }
Esempio n. 13
0
        // Reads to the next sibling of the current element with the given Name.
        public virtual bool ReadToNextSibling(string name)
        {
            if (name == null || name.Length == 0)
            {
                throw XmlExceptionHelper.CreateInvalidNameArgumentException(name, "name");
            }

            // atomize name
            name = NameTable.Add(name);

            // find the next sibling
            XmlNodeType nt;

            do
            {
                SkipSubtree();
                nt = NodeType;
                if (nt == XmlNodeType.Element && Ref.Equal(name, Name))
                {
                    return(true);
                }
            } while (nt != XmlNodeType.EndElement && !EOF);
            return(false);
        }
Esempio n. 14
0
        // Finalizer
        /*protected override void Finalize()
        {
            Interlocked.Decrement(ref s_counter);
            return;
        }

        // Timer callback
        private static void Cleanup(Object state)
        {
            // Check if there are existing instances using the nametable
            if(s_counter == 0)
            {
                // Null the name table so that it can get garbage collected
                Object table = s_atomizedTable;
                s_atomizedTable = null;

                // Check for new instances
                if(s_counter > 0)
                {
                    // A new instance got created and it might be using the
                    // name table that we hold now. Update the satic if that
                    // was indeed the case
                    Interlocked.CompareExchange(ref s_atomizedTable, table, null);
                }
            }

            return;
        }*/

        // Creates and initializes the name table if neccessary
        static private XmlNameTable CreatePrimedNametable()
        {
            Util.Log("SdlParser.CreatePrimedNametable");            

            //Interlocked.Increment(ref s_counter);
            /*if(s_atomizedTable == null)
            {
                // Create a new nametable
                //MTNameTable newTable = new MTNameTable(true);
            }*/
            NameTable newTable = new NameTable();

                // Atomically update static location to point to the current table
                /*Object oldTable = Interlocked.CompareExchange(ref s_atomizedTable, newTable, null);
                if(oldTable != null)
                    newTable = (MTNameTable) oldTable; */

            // Atomize frequently used strings for perf
            // The following ops are not done inside a lock as they are idempotent
            s_operationString = newTable.Add("operation");
            s_emptyString = newTable.Add(String.Empty);
            s_complexTypeString = newTable.Add("complexType");
            s_simpleTypeString = newTable.Add("simpleType");
            s_elementString = newTable.Add("element");
            s_enumerationString = newTable.Add("enumeration");
            s_encodingString = newTable.Add("encoding");
            s_attributeString = newTable.Add("attribute");
            s_allString = newTable.Add("all");
            s_sequenceString = newTable.Add("sequence");
            s_choiceString = newTable.Add("choice");
            s_minOccursString = newTable.Add("minOccurs");
            s_maxOccursString = newTable.Add("maxOccurs");
            s_unboundedString = newTable.Add("unbounded");
            s_oneString = newTable.Add("1");
            s_zeroString = newTable.Add("0");
            s_nameString = newTable.Add("name");
            s_typeString = newTable.Add("type");
            s_baseString = newTable.Add("base");
            s_valueString = newTable.Add("value");
            s_interfaceString = newTable.Add("interface");
            s_serviceString = newTable.Add("service");
            s_extendsString = newTable.Add("extends");
            s_addressesString = newTable.Add("addresses");
            s_addressString = newTable.Add("address");
            s_uriString = newTable.Add("uri");
            s_implementsString = newTable.Add("implements");
            s_requestString = newTable.Add("request");
            s_responseString = newTable.Add("response");
            s_requestResponseString = newTable.Add("requestResponse");
            s_messageString = newTable.Add("message");
            s_locationString = newTable.Add("location");
            s_importString = newTable.Add("import");
            s_onewayString = newTable.Add("oneway");
            s_refString = newTable.Add("ref");
            s_refTypeString = newTable.Add("refType");
            s_referenceString = newTable.Add("Reference");
            s_objectString = newTable.Add("Object");
            s_urTypeString = newTable.Add("ur-type");
            s_arrayString = newTable.Add("Array");
            //s_sudsString = newTable.Add("suds");
            s_sudsString = newTable.Add("soap");
            s_soapString = newTable.Add("soap");
            s_serviceDescString = newTable.Add("serviceDescription");
            s_schemaString = newTable.Add("schema");
            s_targetNamespaceString = newTable.Add("targetNamespace");
            s_namespaceString = newTable.Add("namespace");
            s_idString = newTable.Add("ID");
            s_soapActionString = newTable.Add("soapAction");
            s_schemaNamespaceString = newTable.Add("http://www.w3.org/2000/10/XMLSchema");
            s_instanceNamespaceString = newTable.Add("http://www.w3.org/2000/10/XMLSchema-instance");
            s_soapNamespaceString = newTable.Add("urn:schemas-xmlsoap-org:soap.v1");
            //s_sudsNamespaceString = newTable.Add("urn:schemas-xmlsoap-org:suds.v1");
            s_sudsNamespaceString = newTable.Add("urn:schemas-xmlsoap-org:soap-sdl-2000-01-25");
            //s_URTNamespaceString = newTable.Add("urn:schamas-xmlsoap-org:urt.v1");
            //s_serviceNamespaceString = newTable.Add("urn:schemas-xmlsoap-org:servicedesc.v1");
            s_serviceNamespaceString = newTable.Add("urn:schemas-xmlsoap-org:sdl.2000-01-25");

            return((XmlNameTable) newTable);

                // Enqueue a timer if it has not already been done
                /*Timer timer = new Timer(new TimerCallback(Cleanup), null, 1000, 1000);
                Object existingTimer = Interlocked.CompareExchange(ref s_enqueuedTimer, timer, null);
                if(existingTimer != null)
                    timer.Dispose(); */
            //}

            //return((XmlNameTable) s_atomizedTable);
        }
Esempio n. 15
0
        private static NameTable CreateAtomNameTable()
        {
            NameTable table = new NameTable();
            table.Add(XmlConstants.AtomNamespace);
            table.Add(XmlConstants.DataWebNamespace);
            table.Add(XmlConstants.DataWebMetadataNamespace);

            table.Add(XmlConstants.AtomContentElementName);
            table.Add(XmlConstants.AtomContentSrcAttributeName);
            table.Add(XmlConstants.AtomEntryElementName);
            table.Add(XmlConstants.AtomETagAttributeName);
            table.Add(XmlConstants.AtomFeedElementName);

            table.Add(XmlConstants.AtomIdElementName);

            table.Add(XmlConstants.AtomInlineElementName);
            table.Add(XmlConstants.AtomLinkElementName);
            table.Add(XmlConstants.AtomLinkRelationAttributeName);
            table.Add(XmlConstants.AtomNullAttributeName);
            table.Add(XmlConstants.AtomPropertiesElementName);
            table.Add(XmlConstants.AtomTitleElementName);
            table.Add(XmlConstants.AtomTypeAttributeName);

            table.Add(XmlConstants.XmlErrorCodeElementName);
            table.Add(XmlConstants.XmlErrorElementName);
            table.Add(XmlConstants.XmlErrorInnerElementName);
            table.Add(XmlConstants.XmlErrorMessageElementName);
            table.Add(XmlConstants.XmlErrorTypeElementName);
            return table;
        }
Esempio n. 16
0
        //    may look at the following website for correct parsing of HTML file
        // 	http://stackoverflow.com/questions/8194155/c-sharp-parse-xml-file
        public void ParsePlayerNewNew(ref string cFilePath)
        {
            //	Load document
            NameTable nametable = new NameTable();
            //object html = nametable.Add ("HTML");
            object body = nametable.Add ("body");

            // Create the reader.
            XmlReaderSettings settings = new XmlReaderSettings();
            settings.NameTable = nametable;
            XmlReader reader = XmlReader.Create(cFilePath, settings);

            reader.MoveToContent();
            reader.Skip ();
            reader.ReadToDescendant("body");

            if (System.Object.ReferenceEquals (body, reader.Name)) {
                string innerxml = reader.ReadInnerXml ();
                Console.WriteLine (innerxml);
            }
        }
        public static void Main(String[] args)
        {
            nsmgr = new XmlNamespaceManager(new NameTable());
            nsmgr.AddNamespace("urn", "urn:nhibernate-mapping-2.2");

            children = new ArrayList();
            allMaps = new MultiMap();

            File.Delete("error-log.txt");

            // DOMConfigurator is deprecated in the latest log4net, but we are using an earlier
            // version that comes with NVelocity.
            XmlConfigurator.Configure(new FileInfo("NHibernate.Tool.hbm2net.exe.config"));

            if (args.Length == 0)
            {
                Console.Error.WriteLine("No arguments provided. Nothing to do. Exit.");
                Environment.Exit(- 1);
            }

            ArrayList mappingFiles = new ArrayList();
            string outputDir = null;
            SupportClass.ListCollectionSupport generators = new SupportClass.ListCollectionSupport();

            MultiMap globalMetas = new MultiHashMap();
            // parse command line parameters
            for (int i = 0; i < args.Length; i++)
            {
                if (args[i].StartsWith("--"))
                {
                    if (args[i].StartsWith("--config="))
                    {
                        FileInfo configFile = new FileInfo(args[i].Substring(9));

                        // parse config xml file
                        Document document = new XmlDocument();
                        document.Load(configFile.FullName);
                        globalMetas = MetaAttributeHelper.LoadAndMergeMetaMap((document["codegen"]), null);
                        IEnumerator generateElements = document["codegen"].SelectNodes("generate").GetEnumerator();

                        while (generateElements.MoveNext())
                        {
                            generators.Add(new Generator(configFile.Directory, (Element) generateElements.Current));
                        }
                    }
                    else if (args[i].StartsWith("--output="))
                    {
                        outputDir = args[i].Substring(9);
                    }
                }
                else if (args[i].IndexOf("*") > -1)
                {
                    // Handle wildcards
                    mappingFiles.AddRange(GetFiles(args[i]));
                }
                else
                {
                    mappingFiles.Add(args[i]);
                }
            }

            // if no config xml file, add a default generator
            if (generators.Count == 0)
            {
                generators.Add(new Generator(new DirectoryInfo(Environment.CurrentDirectory)));
            }

            Hashtable classMappings = new Hashtable();
            for (IEnumerator iter = mappingFiles.GetEnumerator(); iter.MoveNext(); )
            {
                log.Info(iter.Current.ToString());

                string mappingFile = (string)iter.Current;
                if (!Path.IsPathRooted(mappingFile))
                {
                    mappingFile = Path.Combine(Environment.CurrentDirectory, mappingFile);
                }
                if (!File.Exists(mappingFile))
                    throw new FileNotFoundException("Mapping file does not exist.", mappingFile);

                // parse the mapping file
                NameTable nt = new NameTable();
                nt.Add("urn:nhibernate-mapping-2.2");
                Document document = new XmlDocument(nt);
                document.Load(mappingFile);

                Element rootElement = document["hibernate-mapping"];

                if (rootElement == null)
                    continue;

                XmlAttribute a = rootElement.Attributes["namespace"];
                string pkg = null;
                if (a != null)
                {
                    pkg = a.Value;
                }
                MappingElement me = new MappingElement(rootElement, null);
                IEnumerator classElements = rootElement.SelectNodes("urn:class", nsmgr).GetEnumerator();
                MultiMap mm = MetaAttributeHelper.LoadAndMergeMetaMap(rootElement, globalMetas);
                HandleClass(pkg, me, classMappings, classElements, mm, false);

                classElements = rootElement.SelectNodes("urn:subclass", nsmgr).GetEnumerator();
                HandleClass(pkg, me, classMappings, classElements, mm, true);

                classElements = rootElement.SelectNodes("urn:joined-subclass", nsmgr).GetEnumerator();
                HandleClass(pkg, me, classMappings, classElements, mm, true);

                // Ok, pickup subclasses that we found before their superclasses
                ProcessChildren(classMappings);

                // generate source files
                for (IEnumerator iterator = generators.GetEnumerator(); iterator.MoveNext(); )
                {
                    Generator g = (Generator)iterator.Current;
                    g.BaseDirName = outputDir;
                    g.Generate(classMappings);
                }
            }
        }
Esempio n. 18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PathNode"/> class.
 /// </summary>
 /// <param name="elementNsUri">The namespace URI of the element-node</param>
 /// <param name="elementNodeName">The local name of the element-node</param>
 /// <param name="nameTable">A NameTable for storing namespace URI and local name</param>
 internal PathNode(string elementNsUri, string elementNodeName, NameTable nameTable)
 {
     _XmlElementNsUri = nameTable.Add(elementNsUri);
     _XmlElementNodeName = nameTable.Add(elementNodeName);
 }
Esempio n. 19
0
        private void CheckXmlMapping(string hbm,params string[] stream)
        {
            NameTable nt = new NameTable();
            nt.Add("urn:nhibernate-mapping-2.2");
            var nsmgr = new XmlNamespaceManager(nt);
            nsmgr.AddNamespace("urn", "urn:nhibernate-mapping-2.2");
            XmlDocument doc = new XmlDocument(nt);
            doc.PreserveWhitespace = true;
            doc.LoadXml(internalStreams[stream[0]].ToString());
            XmlNode refChild = doc.SelectSingleNode("//urn:class",nsmgr);
            for (int i = 1; i < stream.Length; ++i)
            {
                XmlDocument docChild = new XmlDocument(nt);
                docChild.PreserveWhitespace = true;
                docChild.LoadXml(internalStreams[stream[i]].ToString());
                doc.SelectSingleNode("/urn:hibernate-mapping",nsmgr).AppendChild(doc.ImportNode(docChild.SelectSingleNode("//urn:class",nsmgr),true));
            }
            DiffConfiguration dc = new DiffConfiguration("test", true, WhitespaceHandling.None, true);
            XmlDiff diff = new XmlDiff(new XmlInput(doc.OuterXml)
                                       , new XmlInput(ResourceHelper.GetResource(hbm))
                                       ,dc
                                       );
            var res = diff.Compare();
            if (!res.Equal)
            {
                Console.WriteLine("Expected xml was:");
                Console.WriteLine(ResourceHelper.GetResource(hbm));
                Console.WriteLine("But was:");
                Console.WriteLine(doc.InnerXml);

            }
            Assert.IsTrue(res.Equal);
        }
Esempio n. 20
0
        private static void GeometryGmlWriterTest(Action<GeometryPipeline> pipelineCalls, params string[] expectedXPaths)
        {
            var ms = new MemoryStream();
            var w = XmlWriter.Create(ms, new XmlWriterSettings { Indent = false });
            DrawBoth gw = new GmlWriter(w);
            gw.GeometryPipeline.SetCoordinateSystem(CoordinateSystem.DefaultGeometry);

            pipelineCalls(gw.GeometryPipeline);
            w.Flush();
            w.Close();

            // use XElement to validate basic XML integrity
            ms.Seek(0, SeekOrigin.Begin);
            XmlNameTable nt = new NameTable();
            nt.Add(GmlConstants.GmlPrefix);
            // XPath or string contains
            var xnm = new XmlNamespaceManager(nt);
            xnm.AddNamespace(GmlConstants.GmlPrefix, GmlConstants.GmlNamespace);

            var xDoc = new XmlDocument(nt);
            xDoc.Load(ms);

            var nav = xDoc.CreateNavigator();
            SpatialTestUtils.VerifyXPaths(nav, xnm, "/node()[@gml:srsName = '" + GmlConstants.SrsPrefix + CoordinateSystem.DefaultGeometry.EpsgId + "']");

            SpatialTestUtils.VerifyXPaths(nav, xnm, expectedXPaths);
        }
Esempio n. 21
0
        // Creates and initializes the name table if neccessary
        static private XmlNameTable CreatePrimedNametable()
        {
            Util.Log("WsdlParser.CreatePrimedNametable");           

            //Interlocked.Increment(ref s_counter);
            /*if(s_atomizedTable == null)
            {
            // Create a new nametable
            //MTNameTable newTable = new MTNameTable(true);
            }*/
            NameTable newTable = new NameTable();

            // Atomically update static location to point to the current table
            /*Object oldTable = Interlocked.CompareExchange(ref s_atomizedTable, newTable, null);
            if(oldTable != null)
            newTable = (MTNameTable) oldTable; */

            // Atomize frequently used strings for perf
            // The following ops are not done inside a lock as they are idempotent
            s_emptyString = newTable.Add(String.Empty);
            s_complexTypeString = newTable.Add("complexType");
            s_simpleTypeString = newTable.Add("simpleType");
            s_elementString = newTable.Add("element");
            s_enumerationString = newTable.Add("enumeration");
            s_encodingString = newTable.Add("encoding");
            s_attributeString = newTable.Add("attribute");
            s_attributesString = newTable.Add("attributes");
            s_allString = newTable.Add("all");
            s_sequenceString = newTable.Add("sequence");
            s_choiceString = newTable.Add("choice");
            s_minOccursString = newTable.Add("minOccurs");
            s_maxOccursString = newTable.Add("maxOccurs");
            s_unboundedString = newTable.Add("unbounded");
            s_oneString = newTable.Add("1");
            s_zeroString = newTable.Add("0");
            s_nameString = newTable.Add("name");
            s_typeString = newTable.Add("type");
            s_baseString = newTable.Add("base");
            s_valueString = newTable.Add("value");
            s_interfaceString = newTable.Add("interface");
            s_serviceString = newTable.Add("service");
            s_extendsString = newTable.Add("extends");
            s_addressesString = newTable.Add("addresses");
            s_addressString = newTable.Add("address");
            s_uriString = newTable.Add("uri");
            s_implementsString = newTable.Add("implements");
            s_nestedTypeString = newTable.Add("nestedType");
            s_requestString = newTable.Add("request");
            s_responseString = newTable.Add("response");
            s_requestResponseString = newTable.Add("requestResponse");
            s_messageString = newTable.Add("message");
            s_locationString = newTable.Add("location");
            s_schemaLocationString = newTable.Add("schemaLocation");
            s_importString = newTable.Add("import");
            s_onewayString = newTable.Add("oneway");
            s_includeString = newTable.Add("include");
            s_refString = newTable.Add("ref");
            s_refTypeString = newTable.Add("refType");
            s_referenceString = newTable.Add("Reference");
            s_objectString = newTable.Add("Object");
            s_urTypeString = newTable.Add("anyType");
            s_arrayString = newTable.Add("Array");
            s_sudsString = newTable.Add("suds");
            s_methodString = newTable.Add("method");
            s_useString = newTable.Add("use");
            s_rootTypeString = newTable.Add("rootType");
            s_soapString = newTable.Add("soap");
            s_serviceDescString = newTable.Add("serviceDescription");
            s_schemaString = newTable.Add("schema");
            s_targetNamespaceString = newTable.Add("targetNamespace");
            s_namespaceString = newTable.Add("namespace");
            s_idString = newTable.Add("ID");
            s_soapActionString = newTable.Add("soapAction");
            s_schemaNamespaceString1999 = newTable.Add(SudsConverter.Xsd1999);
            s_instanceNamespaceString1999 = newTable.Add(SudsConverter.Xsi1999);
            s_schemaNamespaceString2000 = newTable.Add(SudsConverter.Xsd2000);
            s_instanceNamespaceString2000 = newTable.Add(SudsConverter.Xsi2000);
            s_schemaNamespaceString = newTable.Add(SudsConverter.Xsd2001);
            s_instanceNamespaceString = newTable.Add(SudsConverter.Xsi2001);
            s_soapNamespaceString = newTable.Add("urn:schemas-xmlsoap-org:soap.v1");
            //s_sudsNamespaceString = newTable.Add("urn:schemas-xmlsoap-org:suds.v1");
            s_sudsNamespaceString = newTable.Add("urn:schemas-xmlsoap-org:soap-sdl-2000-01-25");
            //s_URTNamespaceString = newTable.Add("urn:schamas-xmlsoap-org:urt.v1");
            //s_serviceNamespaceString = newTable.Add("urn:schemas-xmlsoap-org:servicedesc.v1");
            s_serviceNamespaceString = newTable.Add("urn:schemas-xmlsoap-org:sdl.2000-01-25");

            // Wsdl strings
            s_definitionsString = newTable.Add("definitions");
            s_wsdlNamespaceString = newTable.Add("http://schemas.xmlsoap.org/wsdl/");
            s_wsdlSoapNamespaceString = newTable.Add("http://schemas.xmlsoap.org/wsdl/soap/");
            s_wsdlSudsNamespaceString = newTable.Add("http://www.w3.org/2000/wsdl/suds");
            s_enumTypeString = newTable.Add("enumType");
            s_typesString = newTable.Add("types");
            s_partString = newTable.Add("part");
            s_portTypeString = newTable.Add("portType");
            s_operationString = newTable.Add("operation");
            s_inputString = newTable.Add("input");
            s_outputString = newTable.Add("output");
            s_bindingString = newTable.Add("binding");
            s_classString = newTable.Add("class");
            s_structString = newTable.Add("struct");
            s_ISerializableString = newTable.Add("ISerializable");
            s_marshalByRefString = newTable.Add("MarshalByRefObject");
            s_delegateString = newTable.Add("Delegate");
            s_servicedComponentString = newTable.Add("ServicedComponent");
            s_comObjectString = newTable.Add("__ComObject");
            s_portString = newTable.Add("port");
            s_styleString = newTable.Add("style");
            s_transportString = newTable.Add("transport");
            s_encodedString = newTable.Add("encoded");
            s_faultString = newTable.Add("fault");
            s_bodyString = newTable.Add("body");
            s_partsString = newTable.Add("parts");
            s_headerString = newTable.Add("header");
            s_encodingStyleString = newTable.Add("encodingStyle");                                  
            s_restrictionString = newTable.Add("restriction");                                  
            s_complexContentString = newTable.Add("complexContent");
            s_soapEncodingString = newTable.Add("http://schemas.xmlsoap.org/soap/encoding/");
            s_arrayTypeString = newTable.Add("arrayType");
            s_parameterOrderString = newTable.Add("parameterOrder");


            return((XmlNameTable) newTable);

            // Enqueue a timer if it has not already been done
            /*Timer timer = new Timer(new TimerCallback(Cleanup), null, 1000, 1000);
            Object existingTimer = Interlocked.CompareExchange(ref s_enqueuedTimer, timer, null);
            if(existingTimer != null)
            timer.Dispose(); */
            //}

            //return((XmlNameTable) s_atomizedTable);
        }
Esempio n. 22
0
        public MFTestResults XmlTest5_NameTable()
        {
            /// <summary>
            /// Tests the NameTable class, which implements XmlNameTable
            /// </summary>
            ///
            bool testResult = true;
            try
            {
                XmlReader testReader = XmlReader.Create(new testStream());

                NameTable testNT = new NameTable();
                object root = testNT.Add("root");
                object element1 = testNT.Add("TestElement1");
                testReader.Read();
                object localName = testReader.LocalName;
                if (!(localName == root))
                {
                    Log.Comment("1st reading, expected local name '" + root + "' but got '" + localName + "'");
                    testResult = false;
                }
                testReader.Read();
                localName = testReader.LocalName;
                if (!(localName == element1))
                {
                    Log.Comment("2nd reading, expected local name '" + element1 + "' but got '" + localName + "'");
                    testResult = false;
                }

                testNT.Add("test1");

                if (testNT.Get("test1").GetType() != Type.GetType("System.String"))
                    throw new Exception("Get(string) got wrong type");

                if (testNT.Get("test1") != "test1")
                    throw new Exception("Get(string) got wrong data");

                if (testNT.Get("test1".ToCharArray(), 0, 5).GetType() != Type.GetType("System.String"))
                    throw new Exception("Get(string) got wrong type");

                if (testNT.Get("test1".ToCharArray(), 0, 5) != "test1")
                    throw new Exception("Get(string) got wrong data");

                testNT.Add("test2".ToCharArray(), 0, 5);

                if (testNT.Get("test2").GetType() != Type.GetType("System.String"))
                    throw new Exception("Get(string) got wrong type");

                if (testNT.Get("test2") != "test2")
                    throw new Exception("Get(string) got wrong data");

                if (testNT.Get("test2".ToCharArray(), 0, 5).GetType() != Type.GetType("System.String"))
                    throw new Exception("Get(string) got wrong type");

                if (testNT.Get("test2".ToCharArray(), 0, 5) != "test2")
                    throw new Exception("Get(string) got wrong data");

            }
            catch (Exception e)
            {
                testResult = false;
                Log.Comment("Incorrect exception caught: " + e.Message);
            }
            return (testResult ? MFTestResults.Pass : MFTestResults.Fail);
        }
        public void AndroidStudioStrings_AddsToNameTable()
        {
            var nameTable = new NameTable();
            var uut = new AndroidStudioStrings(nameTable);

            Assert.AreSame(nameTable.Add("problems"), uut.Problems);
            Assert.AreSame(nameTable.Add("problem"), uut.Problem);
            Assert.AreSame(nameTable.Add("file"), uut.File);
            Assert.AreSame(nameTable.Add("line"), uut.Line);
            Assert.AreSame(nameTable.Add("module"), uut.Module);
            Assert.AreSame(nameTable.Add("package"), uut.Package);
            Assert.AreSame(nameTable.Add("entry_point"), uut.EntryPoint);
            Assert.AreSame(nameTable.Add("problem_class"), uut.ProblemClass);
            Assert.AreSame(nameTable.Add("hints"), uut.Hints);
            Assert.AreSame(nameTable.Add("hint"), uut.Hint);
            Assert.AreSame(nameTable.Add("description"), uut.Description);

            Assert.AreSame(nameTable.Add("TYPE"), uut.Type);
            Assert.AreSame(nameTable.Add("FQNAME"), uut.FQName);
            Assert.AreSame(nameTable.Add("severity"), uut.Severity);
            Assert.AreSame(nameTable.Add("attribute_key"), uut.AttributeKey);
            Assert.AreSame(nameTable.Add("value"), uut.Value);
        }
Esempio n. 24
0
		static XmpTag () {
			// This allows for fast string comparison using operator==
			NameTable = new NameTable ();
			// Namespaces
			AddNamespacePrefix ("", ""); // Needed for the about attribute, which can be unqualified.
			AddNamespacePrefix ("x", ADOBE_X_NS);
			AddNamespacePrefix ("crs", CRS_NS);
			AddNamespacePrefix ("dc", DC_NS);
			AddNamespacePrefix ("exif", EXIF_NS);
			AddNamespacePrefix ("stJob", JOB_NS);
			AddNamespacePrefix ("MicrosoftPhoto", MS_PHOTO_NS);
			AddNamespacePrefix ("photoshop", PHOTOSHOP_NS);
			AddNamespacePrefix ("rdf", RDF_NS);
			AddNamespacePrefix ("stDim", STDIM_NS);
			AddNamespacePrefix ("tiff", TIFF_NS);
			AddNamespacePrefix ("xmp", XAP_NS);
			AddNamespacePrefix ("xapBJ", XAP_BJ_NS);
			AddNamespacePrefix ("xapMM", XAP_MM_NS);
			AddNamespacePrefix ("xapRights", XAP_RIGHTS_NS);
			AddNamespacePrefix ("xml", XML_NS);
			AddNamespacePrefix ("xmlns", XMLNS_NS);
			AddNamespacePrefix ("xmpTPg", XMPTG_NS);

			// Attribute names
			NameTable.Add (ABOUT_URI);
			NameTable.Add (ABOUT_EACH_URI);
			NameTable.Add (ABOUT_EACH_PREFIX_URI);
			NameTable.Add (ALT_URI);
			NameTable.Add (BAG_URI);
			NameTable.Add (BAG_ID_URI);
			NameTable.Add (DATA_TYPE_URI);
			NameTable.Add (DESCRIPTION_URI);
			NameTable.Add (ID_URI);
			NameTable.Add (LANG_URI);
			NameTable.Add (LI_URI);
			NameTable.Add (NODE_ID_URI);
			NameTable.Add (PARSE_TYPE_URI);
			NameTable.Add (RDF_URI);
			NameTable.Add (RESOURCE_URI);
			NameTable.Add (SEQ_URI);
			NameTable.Add (VALUE_URI);
		}
        public static void Generate(String[] args,IFileCreationObserver fileCreationObserver)
        {
            //this has to change... dirty things during porting
            ClassMapping.ResetComponents();
            nsmgr = new XmlNamespaceManager(new NameTable());
            nsmgr.AddNamespace("urn", "urn:nhibernate-mapping-2.2");
            children = new ArrayList();
            allMaps = new MultiMap();
            ArrayList mappingFiles = new ArrayList();
            string outputDir = null;
            SupportClass.ListCollectionSupport generators = new SupportClass.ListCollectionSupport();
            MultiMap globalMetas = new MultiHashMap();
            // parse command line parameters
            cmdLine = new Hbm2NetParameters(args);
            try
            {
                cmdLine.Parse();
                if (0 == cmdLine.FileNames.Count())
                {
                    Console.Error.WriteLine("No input file(s) specified");
                    throw new NotEnougthParametersException();
                }
            }
            catch (NotEnougthParametersException)
            {
                Console.Error.WriteLine(string.Format("Use:hbm2net {0} files.hbm.xml ( wildcards allowed )",cmdLine.GetShortHelp()));
                Console.Error.WriteLine(cmdLine.GetHelp());
                Environment.Exit(-1);
            }
            if (!string.IsNullOrEmpty(cmdLine.ConfigFile))
            {
                if (File.Exists(cmdLine.ConfigFile))
                {
                    try
                    {
                        FileInfo configFile = new FileInfo(cmdLine.ConfigFile);
                        // parse config xml file
                        Document document = new XmlDocument();
                        document.Load(configFile.FullName);
                        var cfgValidator = new ConfigurationValidator();
                        cfgValidator.Validate(document);
                        if (!string.IsNullOrEmpty(cfgValidator.WarningMessage))
                        {
                            log.Warn("Configuration:" + cfgValidator.WarningMessage);
                        }
                        globalMetas = MetaAttributeHelper.LoadAndMergeMetaMap((document["codegen"]), null);
                        IEnumerator generateElements = document["codegen"].SelectNodes("generate").GetEnumerator();
                        while (generateElements.MoveNext())
                        {
                            generators.Add(new Generator(configFile.Directory, (Element)generateElements.Current));
                        }
                    }
                    catch (ConfigurationValidationException validationException)
                    {
                        Console.Error.WriteLine("Error validating configuration file:" + validationException.Message);
                        Environment.Exit(-1);
                    }
                    catch (Exception genericException)
                    {
                        Console.Error.WriteLine("Error reading configuration file:" + genericException.Message);
                        Environment.Exit(-1);
                    }
                }
                else
                {
                    log.Error("Configuration file:" + cmdLine.ConfigFile + " does not exist");
                    Environment.Exit(-1);
                }
            }
            if (generators.Count == 0)
            {
                log.Info("No configuration file specified: using T4 generator with default template.");
                T4Render t4 = new T4Render();
                t4.Configure(new DirectoryInfo(Directory.GetCurrentDirectory()), new NameValueCollection());
                generators.Add(new Generator(t4));
            }
            if (!string.IsNullOrEmpty(cmdLine.OutputDir))
            {
                outputDir = cmdLine.OutputDir;
            }
            foreach (string inFile in cmdLine.FileNames)
            {
                if (inFile.IndexOf("*") > -1)
                {
                    mappingFiles.AddRange(GetFiles(inFile));
                }
                else
                {
                    mappingFiles.Add(inFile);
                }
            }

            Hashtable classMappings = new Hashtable();
            for (IEnumerator iter = mappingFiles.GetEnumerator(); iter.MoveNext(); )
            {
                log.Info(iter.Current.ToString());

                string mappingFile = (string)iter.Current;
                if (!Path.IsPathRooted(mappingFile))
                {
                    mappingFile = Path.Combine(Environment.CurrentDirectory, mappingFile);
                }
                if (!File.Exists(mappingFile))
                    throw new FileNotFoundException("Mapping file does not exist.", mappingFile);

                // parse the mapping file
                NameTable nt = new NameTable();
                nt.Add("urn:nhibernate-mapping-2.2");
                Document document = new XmlDocument(nt);
                document.Load(mappingFile);
                FileInfo mappingFileInfo = new FileInfo(mappingFile);
                SourceFileInfoMap.Instance.Add(document, mappingFileInfo);
                Element rootElement = document["hibernate-mapping"];

                if (rootElement == null)
                    continue;

                XmlAttribute a = rootElement.Attributes["namespace"];
                string pkg = null;
                if (a != null)
                {
                    pkg = a.Value;
                }
                MappingElement me = new MappingElement(rootElement, null);
                IEnumerator classElements = rootElement.SelectNodes("urn:class", nsmgr).GetEnumerator();
                MultiMap mm = MetaAttributeHelper.LoadAndMergeMetaMap(rootElement, globalMetas);
                HandleClass(pkg, me, classMappings, classElements, mm, false);

                classElements = rootElement.SelectNodes("urn:subclass", nsmgr).GetEnumerator();
                HandleClass(pkg, me, classMappings, classElements, mm, true);

                classElements = rootElement.SelectNodes("urn:joined-subclass", nsmgr).GetEnumerator();
                HandleClass(pkg, me, classMappings, classElements, mm, true);

                // Ok, pickup subclasses that we found before their superclasses
                ProcessChildren(classMappings);

            }
            // generate source files
            for (IEnumerator iterator = generators.GetEnumerator(); iterator.MoveNext(); )
            {
                Generator g = (Generator)iterator.Current;
                g.BaseDirName = outputDir ?? ".\\";
                g.Generate(classMappings,fileCreationObserver,cmdLine.CheckTime!=null);
            }
        }
Esempio n. 26
0
        public void CppCheckStrings_PutsStringsInNameTable()
        {
            var nameTable = new NameTable();
            var uut = new CppCheckStrings(nameTable);
            Assert.AreSame(nameTable.Add("results"), uut.Results);

            Assert.AreSame(nameTable.Add("cppcheck"), uut.CppCheck);
            Assert.AreSame(nameTable.Add("version"), uut.Version);
            Assert.AreSame(nameTable.Add("errors"), uut.Errors);
            Assert.AreSame(nameTable.Add("error"), uut.Error);

            Assert.AreSame(nameTable.Add("id"), uut.Id);
            Assert.AreSame(nameTable.Add("msg"), uut.Msg);
            Assert.AreSame(nameTable.Add("verbose"), uut.Verbose);
            Assert.AreSame(nameTable.Add("severity"), uut.Severity);

            Assert.AreSame(nameTable.Add("location"), uut.Location);
            Assert.AreSame(nameTable.Add("file"), uut.File);
            Assert.AreSame(nameTable.Add("line"), uut.Line);
        }
Esempio n. 27
0
        public static ScriptInfo GetScriptInfo(ParsedPath scriptPath)
        {
            if (!File.Exists(scriptPath))
                throw new FileNotFoundException();

            StringBuilder sb = new StringBuilder();

            using (StreamReader reader = new StreamReader(scriptPath))
            {
                string line = reader.ReadLine();

                // Read until there is a non-blank line
                while (line != null)
                {
                    line = line.Trim();

                    if (line.Length != 0)
                        break;

                    line = reader.ReadLine();
                }

                while (line != null && line.StartsWith("///"))
                {
                    sb.Append(line.Substring(3).Trim());
                    line = reader.ReadLine();
                }
            }

            if (sb.Length == 0)
            {
                throw new ScriptInfoException(CodeRunnerResources.ScriptHeaderNotFound);
            }

            string vsVersion = "0.0";
            string fxVersion = "0.0";
            string clrVersion = "0.0";
            List<string> references = new List<string>();

            // If we have some lines, try and interpret them as an XML snippet with minimal error checking
            using (StringReader stringReader = new StringReader(sb.ToString()))
            {
                NameTable nameTable = new NameTable();

                string localVs = nameTable.Add("vs");
                string localFx = nameTable.Add("fx");
                string localClr = nameTable.Add("clr");
                string localRef = nameTable.Add("ref");

                XmlReaderSettings settings = new XmlReaderSettings();

                settings.IgnoreComments = true;
                settings.IgnoreWhitespace = true;
                settings.IgnoreProcessingInstructions = true;
                settings.ValidationType = ValidationType.None;
                settings.NameTable = nameTable;

                try
                {
                    XmlReader xmlReader = XmlReader.Create(stringReader);

                    xmlReader.Read();

                    while (!xmlReader.EOF)
                    {
                        string local = xmlReader.LocalName;

                        if (xmlReader.IsStartElement() &&
                            (local == localClr || local == localFx || local == localRef || local == localVs))
                        {
                            xmlReader.MoveToContent();
                            string content = xmlReader.ReadString();

                            if (local == localFx)
                            {
                                fxVersion = content;
                            }
                            else if (local == localClr)
                            {
                                clrVersion = content;
                            }
                            else if (local == localVs)
                            {
                                vsVersion = content;
                            }
                            else if (local == localRef)
                            {
                                references.Add(content);
                            }

                            xmlReader.ReadEndElement();
                        }
                        else
                            xmlReader.Read();
                    }
                }
                catch (XmlException e)
                {
                    throw new ScriptInfoException(e.Message);
                }
            }

            if (!ValidRuntimeVersions.Any(s => (s == clrVersion)))
            {
                throw new ScriptInfoException(CodeRunnerResources.UnsupportedOrUnknownRuntime(clrVersion,
                    StringUtility.Join(", ", ValidRuntimeVersions)));
            }

            if (!ValidFrameworkVersions.Any(s => (s == fxVersion)))
            {
                throw new ScriptInfoException(CodeRunnerResources.UnsupportedOrUnknownFx(fxVersion,
                    StringUtility.Join(", ", ValidFrameworkVersions)));
            }

            if (!ValidRuntimeVersions.Any(s => (s == clrVersion)))
            {
                throw new ScriptInfoException(CodeRunnerResources.UnsupportedOrUnknownVisualStudio(vsVersion,
                    StringUtility.Join(", ", ValidVisualStudioVersions)));
            }

            if (!ValidClrFxVsVersions.Any(s => (s[0] == clrVersion && s[1] == fxVersion && s[2] == vsVersion)))
            {
                throw new ScriptInfoException(CodeRunnerResources.UnsupportedClrFxVsCombination(clrVersion, fxVersion, vsVersion));
            }

            return new ScriptInfo(vsVersion, clrVersion, fxVersion, references);
        }
 private static XmlNameTable CreatePrimedNametable()
 {
     NameTable table = new NameTable();
     s_emptyString = table.Add(string.Empty);
     s_complexTypeString = table.Add("complexType");
     s_simpleTypeString = table.Add("simpleType");
     s_elementString = table.Add("element");
     s_enumerationString = table.Add("enumeration");
     s_encodingString = table.Add("encoding");
     s_attributeString = table.Add("attribute");
     s_attributesString = table.Add("attributes");
     s_allString = table.Add("all");
     s_sequenceString = table.Add("sequence");
     s_choiceString = table.Add("choice");
     s_minOccursString = table.Add("minOccurs");
     s_maxOccursString = table.Add("maxOccurs");
     s_unboundedString = table.Add("unbounded");
     s_oneString = table.Add("1");
     s_zeroString = table.Add("0");
     s_nameString = table.Add("name");
     s_typeString = table.Add("type");
     s_baseString = table.Add("base");
     s_valueString = table.Add("value");
     s_interfaceString = table.Add("interface");
     s_serviceString = table.Add("service");
     s_extendsString = table.Add("extends");
     s_addressesString = table.Add("addresses");
     s_addressString = table.Add("address");
     s_uriString = table.Add("uri");
     s_implementsString = table.Add("implements");
     s_nestedTypeString = table.Add("nestedType");
     s_requestString = table.Add("request");
     s_responseString = table.Add("response");
     s_requestResponseString = table.Add("requestResponse");
     s_messageString = table.Add("message");
     s_locationString = table.Add("location");
     s_schemaLocationString = table.Add("schemaLocation");
     s_importString = table.Add("import");
     s_onewayString = table.Add("oneway");
     s_includeString = table.Add("include");
     s_refString = table.Add("ref");
     s_refTypeString = table.Add("refType");
     s_referenceString = table.Add("Reference");
     s_objectString = table.Add("Object");
     s_urTypeString = table.Add("anyType");
     s_arrayString = table.Add("Array");
     s_sudsString = table.Add("suds");
     s_methodString = table.Add("method");
     s_useString = table.Add("use");
     s_rootTypeString = table.Add("rootType");
     s_soapString = table.Add("soap");
     s_serviceDescString = table.Add("serviceDescription");
     s_schemaString = table.Add("schema");
     s_targetNamespaceString = table.Add("targetNamespace");
     s_namespaceString = table.Add("namespace");
     s_idString = table.Add("ID");
     s_soapActionString = table.Add("soapAction");
     s_schemaNamespaceString1999 = table.Add(SudsConverter.Xsd1999);
     s_instanceNamespaceString1999 = table.Add(SudsConverter.Xsi1999);
     s_schemaNamespaceString2000 = table.Add(SudsConverter.Xsd2000);
     s_instanceNamespaceString2000 = table.Add(SudsConverter.Xsi2000);
     s_schemaNamespaceString = table.Add(SudsConverter.Xsd2001);
     s_instanceNamespaceString = table.Add(SudsConverter.Xsi2001);
     s_soapNamespaceString = table.Add("urn:schemas-xmlsoap-org:soap.v1");
     s_sudsNamespaceString = table.Add("urn:schemas-xmlsoap-org:soap-sdl-2000-01-25");
     s_serviceNamespaceString = table.Add("urn:schemas-xmlsoap-org:sdl.2000-01-25");
     s_definitionsString = table.Add("definitions");
     s_wsdlNamespaceString = table.Add("http://schemas.xmlsoap.org/wsdl/");
     s_wsdlSoapNamespaceString = table.Add("http://schemas.xmlsoap.org/wsdl/soap/");
     s_wsdlSudsNamespaceString = table.Add("http://www.w3.org/2000/wsdl/suds");
     s_enumTypeString = table.Add("enumType");
     s_typesString = table.Add("types");
     s_partString = table.Add("part");
     s_portTypeString = table.Add("portType");
     s_operationString = table.Add("operation");
     s_inputString = table.Add("input");
     s_outputString = table.Add("output");
     s_bindingString = table.Add("binding");
     s_classString = table.Add("class");
     s_structString = table.Add("struct");
     s_ISerializableString = table.Add("ISerializable");
     s_marshalByRefString = table.Add("MarshalByRefObject");
     s_delegateString = table.Add("Delegate");
     s_servicedComponentString = table.Add("ServicedComponent");
     s_comObjectString = table.Add("__ComObject");
     s_portString = table.Add("port");
     s_styleString = table.Add("style");
     s_transportString = table.Add("transport");
     s_encodedString = table.Add("encoded");
     s_faultString = table.Add("fault");
     s_bodyString = table.Add("body");
     s_partsString = table.Add("parts");
     s_headerString = table.Add("header");
     s_encodingStyleString = table.Add("encodingStyle");
     s_restrictionString = table.Add("restriction");
     s_complexContentString = table.Add("complexContent");
     s_soapEncodingString = table.Add("http://schemas.xmlsoap.org/soap/encoding/");
     s_arrayTypeString = table.Add("arrayType");
     s_parameterOrderString = table.Add("parameterOrder");
     return table;
 }
Esempio n. 29
0
 public void FortifyStrings_ContainsCorrectStrings()
 {
     var nameTable = new NameTable();
     var uut = new FortifyStrings(nameTable);
     Assert.AreSame(nameTable.Add("Issue"), uut.Issue);
     Assert.AreSame(nameTable.Add("iid"), uut.Iid);
     Assert.AreSame(nameTable.Add("ruleID"), uut.RuleId);
     Assert.AreSame(nameTable.Add("Category"), uut.Category);
     Assert.AreSame(nameTable.Add("Folder"), uut.Folder);
     Assert.AreSame(nameTable.Add("Kingdom"), uut.Kingdom);
     Assert.AreSame(nameTable.Add("Abstract"), uut.Abstract);
     Assert.AreSame(nameTable.Add("AbstractCustom"), uut.AbstractCustom);
     Assert.AreSame(nameTable.Add("Friority"), uut.Friority);
     Assert.AreSame(nameTable.Add("Tag"), uut.Tag);
     Assert.AreSame(nameTable.Add("Comment"), uut.Comment);
     Assert.AreSame(nameTable.Add("Primary"), uut.Primary);
     Assert.AreSame(nameTable.Add("Source"), uut.Source);
     Assert.AreSame(nameTable.Add("TraceDiagramPath"), uut.TraceDiagramPath);
     Assert.AreSame(nameTable.Add("ExternalCategory"), uut.ExternalCategory);
     Assert.AreSame(nameTable.Add("type"), uut.Type);
     Assert.AreSame(nameTable.Add("FileName"), uut.FileName);
     Assert.AreSame(nameTable.Add("FilePath"), uut.FilePath);
     Assert.AreSame(nameTable.Add("LineStart"), uut.LineStart);
     Assert.AreSame(nameTable.Add("Snippet"), uut.Snippet);
     Assert.AreSame(nameTable.Add("SnippetLine"), uut.SnippetLine);
     Assert.AreSame(nameTable.Add("TargetFunction"), uut.TargetFunction);
 }
Esempio n. 30
0
        static XmlNameTable CreateNameTable()
        {
            var nameTable = new NameTable();
             nameTable.Add(String.Empty);
             nameTable.Add("http://www.w3.org/2000/xmlns/");
             nameTable.Add("http://www.w3.org/XML/1998/namespace");

             return nameTable;
        }
Esempio n. 31
0
        // Note: new members should also be added to nameTable in CreateNameTable method.

        protected virtual XmlNameTable CreateNameTable()
        {
            var nameTable = new NameTable();

            nameTable.Add(WordprocessingMLNamespace);
            nameTable.Add(RelationshipsNamespace);
            nameTable.Add(DocumentElement);
            nameTable.Add(BodyElement);
            nameTable.Add(ParagraphElement);
            nameTable.Add(TableElement);
            nameTable.Add(ParagraphPropertiesElement);
            nameTable.Add(SimpleFieldElement);
            nameTable.Add(HyperlinkElement);
            nameTable.Add(RunElement);
            nameTable.Add(BreakElement);
            nameTable.Add(TabCharacterElement);
            nameTable.Add(TextElement);
            nameTable.Add(RunPropertiesElement);
            nameTable.Add(TableRowElement);
            nameTable.Add(TableCellElement);

            return nameTable;
        }
Esempio n. 32
0
 public void CreateNameTable()
 {
     NameTable nt = new NameTable();
     nt.Add("Root");
 }