當前位置: 首頁>>代碼示例>>C#>>正文


C# XmlDocument.createElementNS方法代碼示例

本文整理匯總了C#中System.Xml.XmlDocument.createElementNS方法的典型用法代碼示例。如果您正苦於以下問題:C# XmlDocument.createElementNS方法的具體用法?C# XmlDocument.createElementNS怎麽用?C# XmlDocument.createElementNS使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Xml.XmlDocument的用法示例。


在下文中一共展示了XmlDocument.createElementNS方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: toDOM

        /*
        ****************************************************************************
        * toDOM()
        ****************************************************************************
        */
        /**
        *  This method will make DOM using the specified document.  If any DOM state
        * has been stored with the obj, it will not be used in this method.
        * This method generates a reference-free copy of new DOM.
        * @param oDoc - The document to use for generating DOM
        */
        public XmlElement toDOM(XmlDocument oDoc)
        {
            // for this particular toDOM implementation, oDoc must not be null
            if (oDoc == null)
            {
            return null;
            }

            XmlElement oElem = oDoc.createElementNS(Tags.NS_SAML, Tags.TAG_ASSERTION);

            oElem.setAttributeNS(Tags.NS_XMLNS, "xmlns", Tags.NS_SAML);
            oElem.setAttributeNS(Tags.NS_XMLNS, "xmlns:saml", Tags.NS_SAML);
            oElem.setPrefix("saml");
            oElem.setAttributeNS(null, Tags.ATTR_VERSION, "2.0");
            oElem.setAttributeNS(null, Tags.ATTR_ID_CAP, msXmlID);
            oElem.setAttributeNS(null, Tags.ATTR_ISSUEINSTANT, msIssueInstant);

            if (moIssuer != null)
            {
            XmlElement oChildElem = (XmlElement) moIssuer.toDOM(oDoc);
            oElem.AppendChild(oChildElem);
            }

            if (moSignature != null)
            {
            XmlElement oChildElem = moSignature.getElement();

            // import the node, we want a copy
            oChildElem = (XmlElement) oDoc.importNode(oChildElem, true);
            oElem.AppendChild(oChildElem);
            }

            if (moSubject != null)
            {
            XmlElement oChildElem = (XmlElement) moSubject.toDOM(oDoc);
            oElem.AppendChild(oChildElem);
            }

            if (moConditions != null)
            {
            XmlElement oChildElem = (XmlElement) moConditions.toDOM(oDoc);
            oElem.AppendChild(oChildElem);
            }

            if (moAttrStatement != null)
            {
            XmlElement oChildElem = (XmlElement) moAttrStatement.toDOM(oDoc);
            oElem.AppendChild(oChildElem);
            }

            return oElem;
        }
開發者ID:AArnott,項目名稱:dotnetxri,代碼行數:63,代碼來源:Assertion.cs

示例2: toDOM

        /*
        ****************************************************************************
        * toDOM()
        ****************************************************************************
        */
        /**
        *  This method will make DOM using the specified document.  If any DOM state
        * has been stored with the obj, it will not be used in this method.
        * This method generates a reference-free copy of new DOM.
        * @param oDoc - The document to use for generating DOM
        */
        public XmlElement toDOM(XmlDocument oDoc)
        {
            // for this particular toDOM implementation, oDoc must not be null
            if (oDoc == null)
            {
            return null;
            }

            XmlElement oElem = oDoc.createElementNS(Tags.NS_XRDS, Tags.TAG_XRDS);

            if (_ref != null){
            oElem.SetAttribute(Tags.ATTR_REF, _ref);
            }

            if (redirect != null){
            oElem.SetAttribute(Tags.ATTR_REDIRECT, redirect);
            }

            for (int i = 0; i < getNumChildren(); i++)
            {

            XmlElement oLocal = null;
            if (isXRDSAt(i))
                oLocal = getXRDSAt(i).toDOM(oDoc) ;
            else if(isXRDAt(i))
                oLocal = getDescriptorAt(i).toDOM(oDoc);
            if (oLocal != null)
                oElem.AppendChild(oLocal);
            }

            return oElem;
        }
開發者ID:AArnott,項目名稱:dotnetxri,代碼行數:43,代碼來源:XRDS.cs

示例3: toDOM

        /*
        ****************************************************************************
        * toDOM()
        ****************************************************************************
        */
        /**
        *  This method will make DOM using the specified document.  If any DOM state
        * has been stored with the obj, it will not be used in this method.
        * This method generates a reference-free copy of new DOM.
        * @param oDoc - The document to use for generating DOM
        */
        public XmlElement toDOM(XmlDocument oDoc)
        {
            // for this particular toDOM implementation, oDoc must not be null
            if (oDoc == null)
            {
            return null;
            }

            XmlElement oElem = oDoc.createElementNS(Tags.NS_SAML, Tags.TAG_SUBJECT);

            if (moNameID != null)
            {
            XmlElement oChildElem = (XmlElement) moNameID.toDOM(oDoc);
            oElem.AppendChild(oChildElem);
            }

            return oElem;
        }
開發者ID:AArnott,項目名稱:dotnetxri,代碼行數:29,代碼來源:Subject.cs

示例4: toDOM

        /*
        ****************************************************************************
        * toDOM()
        ****************************************************************************
        */
        /**
        *  This method will make DOM using the specified document.  If any DOM state
        * has been stored with the obj, it will not be used in this method.
        * This method generates a reference-free copy of new DOM.
        * @param oDoc - The document to use for generating DOM
        */
        public XmlElement toDOM(XmlDocument oDoc)
        {
            // for this particular toDOM implementation, oDoc must not be null
            if (oDoc == null)
            {
            return null;
            }

            XmlElement oElem = oDoc.createElementNS(Tags.NS_SAML, Tags.TAG_ATTRIBUTE);

            if (!msName.Equals(""))
            {
            oElem.setAttributeNS(null, Tags.ATTR_NAME, msName);
            }

            XmlElement oValElem =
            oDoc.createElementNS(Tags.NS_SAML, Tags.TAG_ATTRIBUTEVALUE);
            oValElem.AppendChild(oDoc.CreateTextNode(msValue));

            oElem.AppendChild(oValElem);

            return oElem;
        }
開發者ID:AArnott,項目名稱:dotnetxri,代碼行數:34,代碼來源:Attribute.cs


注:本文中的System.Xml.XmlDocument.createElementNS方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。