Наследование: SimpleXMLElement
Пример #1
0
        /**
        * This method resets the state of the XRD.
        */
        public void reset()
        {
            xmlID = "";
            idRef = null;
            version = null;
            types = new ArrayList();
            query = null;
            status = null;
            serverStatus = null;
            expires = null;
            providerID = null;

            localIDs = new ArrayList();
            equivIDs = new ArrayList();
            canonicalIDs = new ArrayList(); // CanonicalID (TODO: Should be 0 or 1)
            canonicalEquivID = null;

            refs = new ArrayList();
            prioritizedRefs = new PrioritizedList();

            redirects = new ArrayList();
            prioritizedRedirects = new PrioritizedList();

            services = new ArrayList();
            prioritizedServices = new PrioritizedList();
            selectedServices = new PrioritizedList();

            samlAssertion = null;

            moElem = null;
            moOtherChildrenVectorsMap = new Dictionary<object, object>();
        }
Пример #2
0
 public void setStatus(Status status)
 {
     this.status = status;
 }
Пример #3
0
        //throws UriFormatException, ParseException
        /**
        * This method populates the obj from DOM.  It does not keep a
        * copy of the DOM around.  Whitespace information is lost in this process.
        */
        public void fromDOM(XmlElement oElem)
        {
            reset();

            // get the id attribute
            if (oElem.hasAttributeNS(Tags.NS_XML, Tags.ATTR_ID_LOW))
                xmlID = oElem.getAttributeNS(Tags.NS_XML, Tags.ATTR_ID_LOW);

            if (oElem.hasAttributeNS(Tags.NS_XML, Tags.ATTR_IDREF))
                idRef = oElem.getAttributeNS(Tags.NS_XML, Tags.ATTR_IDREF);

            if (oElem.hasAttributeNS(null, Tags.ATTR_XRD_VERSION))
                version = oElem.getAttributeNS(null, Tags.ATTR_XRD_VERSION);

            for (XmlElement oChild = (XmlElement)oElem.FirstChild; oChild != null; oChild = (XmlElement)oChild.NextSibling) {

                string sChildName = oChild.LocalName ?? oChild.Name;

                if (sChildName.Equals(Tags.TAG_TYPE)) {
                    XRDType t = new XRDType();
                    t.fromXML(oChild);
                    types.Add(t);
                } else if (sChildName.Equals(Tags.TAG_QUERY)) {
                    Query q = new Query();
                    q.fromXML(oChild);
                    this.query = q;
                } else if (sChildName.Equals(Tags.TAG_STATUS)) {
                    Status s = new Status();
                    s.fromXML(oChild);
                    this.status = s;
                } else if (sChildName.Equals(Tags.TAG_SERVERSTATUS)) {
                    ServerStatus s = new ServerStatus();
                    s.fromXML(oChild);
                    this.serverStatus = s;
                } else if (sChildName.Equals(Tags.TAG_EXPIRES)) {
                    // only accept the first Expires element and make sure it
                    expires = new Expires(XmlConvert.ToDateTime(oChild.FirstChild.Value));
                } else if (sChildName.Equals(Tags.TAG_PROVIDERID)) {
                    ProviderID p = new ProviderID();
                    p.fromXML(oChild);
                    this.providerID = p;
                } else if (sChildName.Equals(Tags.TAG_LOCALID)) {
                    addLocalID(new LocalID(oChild));
                } else if (sChildName.Equals(Tags.TAG_EQUIVID)) {
                    equivIDs.Add(new EquivID(oChild));
                } else if (sChildName.Equals(Tags.TAG_CANONICALID)) {
                    canonicalIDs.Add(new CanonicalID(oChild));
                } else if (sChildName.Equals(Tags.TAG_CANONICALEQUIVID)) {
                    canonicalEquivID = new CanonicalEquivID();
                    canonicalEquivID.fromXML(oChild);
                } else if (sChildName.Equals(Tags.TAG_REDIRECT)) {
                    Redirect _ref = new Redirect(oChild);
                    addRedirect(_ref);
                } else if (sChildName.Equals(Tags.TAG_REF)) {
                    Ref _ref = new Ref(oChild);
                    addRef(_ref);
                } else if (sChildName.Equals(Tags.TAG_SERVICE)) {
                    addService(new Service(oChild));
                } else if (
                          (oChild.NamespaceURI != null) &&
                          oChild.NamespaceURI.Equals(Tags.NS_SAML) &&
                          (oChild.LocalName != null) &&
                          oChild.LocalName.Equals(Tags.TAG_ASSERTION)) {
                    samlAssertion = new Assertion(oChild);
                }
                    // Added this code to support extensions in Authority XmlElement
                  else {
                    ArrayList oVector =
                        (ArrayList)moOtherChildrenVectorsMap[sChildName];

                    if (oVector == null) {
                        oVector = new ArrayList();
                        moOtherChildrenVectorsMap[sChildName] = oVector;
                    }

                    oVector.Add(oChild.CloneNode(true));
                }
            }
        }