本文整理汇总了C#中System.Xml.XmlElement.hasAttributeNS方法的典型用法代码示例。如果您正苦于以下问题:C# XmlElement.hasAttributeNS方法的具体用法?C# XmlElement.hasAttributeNS怎么用?C# XmlElement.hasAttributeNS使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlElement
的用法示例。
在下文中一共展示了XmlElement.hasAttributeNS方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: fromDOM
//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));
}
}
}
示例2: fromDOM
/*
****************************************************************************
* fromDOM()
****************************************************************************
*/
/**
* 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(null, Tags.ATTR_ID_CAP))
{
msXmlID = oElem.getAttributeNS(null, Tags.ATTR_ID_CAP);
}
if (oElem.hasAttributeNS(null, Tags.ATTR_ISSUEINSTANT))
{
msIssueInstant = oElem.getAttributeNS(null, Tags.ATTR_ISSUEINSTANT);
}
for (
XmlNode oChild = oElem.FirstChild; oChild != null;
oChild = oChild.NextSibling)
{
if (oChild.LocalName.Equals(Tags.TAG_ISSUER))
{
// only accept the first XRIAuthority
if (moIssuer == null)
{
moIssuer = new NameID((XmlElement) oChild);
}
}
else if (oChild.LocalName.Equals(Tags.TAG_SIGNATURE))
{
// only accept the first XRIAuthority
if (moSignature == null)
{
try
{
XmlDocument oDoc = new XmlDocument();
XmlElement oChildCopy =
(XmlElement) oDoc.ImportNode(oChild, true);
moSignature = new XMLSignature(oChildCopy, null);
}
catch (Exception oEx)
{
soLog.Warn(
"Caught exception while parsing Signature", oEx);
}
}
}
else if (oChild.LocalName.Equals(Tags.TAG_SUBJECT))
{
// only accept the first XRIAuthority
if (moSubject == null)
{
moSubject = new Subject((XmlElement) oChild);
}
}
else if (oChild.LocalName.Equals(Tags.TAG_CONDITIONS))
{
// only accept the first XRIAuthority
if (moConditions == null)
{
moConditions = new Conditions((XmlElement) oChild);
}
}
else if (oChild.LocalName.Equals(Tags.TAG_ATTRIBUTESTATEMENT))
{
// only accept the first XRIAuthority
if (moAttrStatement == null)
{
moAttrStatement = new AttributeStatement((XmlElement) oChild);
}
}
}
}
示例3: fromDOM
/*
****************************************************************************
* fromDOM()
****************************************************************************
*/
/**
* This method populates the XRD 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(null, Tags.ATTR_NAME))
{
msName = oElem.getAttributeNS(null, Tags.ATTR_NAME);
}
for (
XmlNode oChild = oElem.FirstChild; oChild != null;
oChild = oChild.NextSibling)
{
if (oChild.LocalName.Equals(Tags.TAG_ATTRIBUTEVALUE))
{
// only accept the first element and make sure it
// is a text node
if (
(msValue.Equals("")) && (oChild.FirstChild != null) &&
(oChild.FirstChild.NodeType == XmlNode.TEXT_NODE))
{
msValue = oChild.FirstChild.getNodeValue();
}
}
}
}