示例#1
0
        static string DoReplacements(string template, HelpItem hi)
        {
            string s = template;

            s = Regex.Replace(s, "##ATOM##", hi.atom);
            s = Regex.Replace(s, "##HELPID##", hi.helpID);
            s = Regex.Replace(s, "##SHORTDESC##",
                              HttpUtility.HtmlEncode(hi.shortDesc));
            s = Regex.Replace(s, "##LINKTITLE##", hi.linkTitle);
            s = Regex.Replace(s, "##PROBLEM##", hi.problem);
            s = Regex.Replace(s, "##FWLINKID##", "" + hi.fwLinkID);
            s = Regex.Replace(s, "##TABLENAME##", "" + hi.tableName);
            return(s);
        }
示例#2
0
        public List <HelpItem> ReadHelpItems()
        {
            List <HelpItem> items  = new List <HelpItem>();
            XmlDocument     xmlDoc = GetXMLDoc(m_xmlPath);
            XPathNavigator  nav    = ValidateXMLDoc(xmlDoc, m_xsdPath);

            if (null == nav)
            {
                return(items);
            }
            // G.CO( "Validated XML" );
            //Instantiate an XmlNamespaceManager object.
            XmlNamespaceManager nsmgr = new
                                        XmlNamespaceManager(xmlDoc.NameTable);

            nsmgr.AddNamespace("foo", m_nameSpace);

            string            q  = "foo:helpitems/*";
            XPathNodeIterator it = nav.Select(q, nsmgr);

            while (it.MoveNext())
            {
                XPathNavigator node = it.Current;
                HelpItem       hi   = new HelpItem();
                hi.atom      = XG.StrAttrReq(node, "atom");
                hi.helpID    = XG.StrAttrReq(node, "helpID");
                hi.linkTitle = XG.StrAttrReq(node, "linkTitle");
                hi.specLink  = XG.StrAttrReq(node, "specLink");
                hi.shortDesc = XG.StrAttrReq(node, "shortDesc");
                hi.tableName = XG.StrAttrReq(node, "tableName");
                hi.fwLinkID  = XG.IntAttrReq(node, "fwLinkID");
                XPathNavigator pNode =
                    XG.SingletonNodeReq(node, "foo:problem", nsmgr);
                hi.problem = pNode.Value;
                items.Add(hi);
            }
            return(items);
        }
示例#3
0
        public List<HelpItem> ReadHelpItems()
        {
            List<HelpItem> items = new List<HelpItem>();
            XmlDocument xmlDoc = GetXMLDoc( m_xmlPath );
            XPathNavigator nav = ValidateXMLDoc( xmlDoc, m_xsdPath );
            if ( null == nav ) {
                return items;
            }
            // G.CO( "Validated XML" );
            //Instantiate an XmlNamespaceManager object. 
            XmlNamespaceManager nsmgr = new 
                XmlNamespaceManager( xmlDoc.NameTable );
            nsmgr.AddNamespace( "foo", m_nameSpace );

            string q = "foo:helpitems/*";
            XPathNodeIterator it = nav.Select( q, nsmgr );

            while ( it.MoveNext() ) {
                XPathNavigator node = it.Current;
                HelpItem hi = new HelpItem();
                hi.atom = XG.StrAttrReq( node, "atom" );
                hi.helpID = XG.StrAttrReq( node, "helpID" );
                hi.linkTitle = XG.StrAttrReq( node, "linkTitle" );
                hi.specLink = XG.StrAttrReq( node, "specLink" );
                hi.shortDesc = XG.StrAttrReq( node, "shortDesc" );
                hi.tableName = XG.StrAttrReq( node, "tableName" );
                hi.fwLinkID = XG.IntAttrReq( node, "fwLinkID" );
                XPathNavigator pNode = 
                    XG.SingletonNodeReq(node,"foo:problem",nsmgr);
                hi.problem = pNode.Value;
                items.Add( hi );
            }
            return items;
        }
示例#4
0
 static string DoReplacements( string template, HelpItem hi )
 {
     string s = template;
     s = Regex.Replace( s, "##ATOM##", hi.atom );
     s = Regex.Replace( s, "##HELPID##", hi.helpID );
     s = Regex.Replace( s, "##SHORTDESC##", 
                        HttpUtility.HtmlEncode( hi.shortDesc ) );
     s = Regex.Replace( s, "##LINKTITLE##", hi.linkTitle );
     s = Regex.Replace( s, "##PROBLEM##", hi.problem );
     s = Regex.Replace( s, "##FWLINKID##", ""+hi.fwLinkID );
     s = Regex.Replace( s, "##TABLENAME##", ""+hi.tableName );
     return s;
 }