public static void toXmlImpl(Env env, StringBuilder sb, Element node)
  {
    sb.append('<');
    sb.append(node.getNodeName());

    NamedNodeMap attrMap = node.getAttributes();

    for (int i = 0; i < attrMap.getLength(); i++) {
      Node attr = attrMap.item(i);

      toXml(env, sb, attr);
    }

    if (node.getFirstChild() == null) {
      sb.append('/');
      sb.append('>');
    }
    else {
      sb.append('>');

      Node child = node.getFirstChild();

      while (child != null) {
        toXml(env, sb, child);

        child = child.getNextSibling();
      }

      sb.append('<');
      sb.append('/');
      sb.append(node.getNodeName());
      sb.append('>');
    }
  }
示例#2
0
        private static void processAttributes(Node node, IList idrefs, ResultBuffer rs, EvaluationContext context)
        {
            if (!node.hasAttributes())
            {
                return;
            }

            NamedNodeMap attributeList = node.Attributes;

            for (int atsub = 0; atsub < attributeList.Length; atsub++)
            {
                Attr     atNode = (Attr)attributeList.item(atsub);
                NodeType atType = new AttrType(atNode, context.StaticContext.TypeModel);
                if (atType.ID)
                {
                    if (hasIDREF(idrefs, atNode))
                    {
                        if (!isDuplicate(node, rs))
                        {
                            ElementType element = new ElementType((Element)node, context.StaticContext.TypeModel);
                            rs.add(element);
                        }
                    }
                }
            }
        }
示例#3
0
        /// <summary>Populate the properties for Queue</summary>
        /// <param name="field"/>
        /// <returns/>
        private Properties PopulateProperties(Element field)
        {
            Properties props      = new Properties();
            NodeList   propfields = field.GetChildNodes();

            for (int i = 0; i < propfields.GetLength(); i++)
            {
                Node prop = propfields.Item(i);
                //If this node is not of type element
                //skip this.
                if (!(prop is Element))
                {
                    continue;
                }
                if (PropertyTag.Equals(prop.GetNodeName()))
                {
                    if (prop.HasAttributes())
                    {
                        NamedNodeMap nmp = prop.GetAttributes();
                        if (nmp.GetNamedItem(KeyTag) != null && nmp.GetNamedItem(ValueTag) != null)
                        {
                            props.SetProperty(nmp.GetNamedItem(KeyTag).GetTextContent(), nmp.GetNamedItem(ValueTag
                                                                                                          ).GetTextContent());
                        }
                    }
                }
            }
            return(props);
        }
示例#4
0
文件: Content.cs 项目: develmax/Xacml
        private void EncodeChild(Node node, PrintStream psout, Indentation indenter)
        {
            psout.Print(indenter + "<" + node.NodeName);
            NamedNodeMap attrs = this._node.Attributes;

            for (int i = 0; i < attrs.Length; i++)
            {
                Node attr = attrs.Item(i);
                psout.Print(" " + attr.NodeName + "=\"" + attr.NodeValue + "\" ");
            }
            psout.Print("> ");
            psout.PrintLine();
            indenter.Down();
            NodeList children = node.ChildNodes;

            for (int i = 0; i < children.Length; i++)
            {
                Node child = children.Item(i);
                if (child.NodeType == Node.ELEMENT_NODE)
                {
                    this.EncodeChild(child, psout, indenter);
                }
                else
                {
                    string txt = child.TextContent.Trim();
                    if (txt.Length > 0)
                    {
                        psout.PrintLine(indenter + txt);
                    }
                }
            }
            indenter.Up();
            psout.PrintLine(indenter + "</" + node.NodeName + ">");
        }
示例#5
0
  DOMNamedNodeMap createWrapper(NamedNodeMap node)
  {
    DOMNamedNodeMap wrapper = new DOMNamedNodeMap(this, node);
    _wrapperMap.put(node, wrapper);

    return wrapper;
  }
示例#6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="owner"></param>
 /// <param name="name"></param>
 public Element(Document owner, string localName, string @namespace = null, string namespacePrefix = null)
     : base(owner)
 {
     LocalName    = localName;
     NamespaceUri = @namespace;
     Prefix       = namespacePrefix;
     Attributes   = new NamedNodeMap();
 }
示例#7
0
        private Queue ParseResource(Element queuesNode)
        {
            Queue rootNode = null;

            try
            {
                if (!QueuesTag.Equals(queuesNode.GetTagName()))
                {
                    Log.Info("Bad conf file: top-level element not <queues>");
                    throw new RuntimeException("No queues defined ");
                }
                NamedNodeMap nmp  = queuesNode.GetAttributes();
                Node         acls = nmp.GetNamedItem(AclsEnabledTag);
                if (acls != null)
                {
                    Log.Warn("Configuring " + AclsEnabledTag + " flag in " + QueueManager.QueueConfFileName
                             + " is not valid. " + "This tag is ignored. Configure " + MRConfig.MrAclsEnabled
                             + " in mapred-site.xml. See the " + " documentation of " + MRConfig.MrAclsEnabled
                             + ", which is used for enabling job level authorization and " + " queue level authorization."
                             );
                }
                NodeList props = queuesNode.GetChildNodes();
                if (props == null || props.GetLength() <= 0)
                {
                    Log.Info(" Bad configuration no queues defined ");
                    throw new RuntimeException(" No queues defined ");
                }
                //We have root level nodes.
                for (int i = 0; i < props.GetLength(); i++)
                {
                    Node propNode = props.Item(i);
                    if (!(propNode is Element))
                    {
                        continue;
                    }
                    if (!propNode.GetNodeName().Equals(QueueTag))
                    {
                        Log.Info("At root level only \" queue \" tags are allowed ");
                        throw new RuntimeException("Malformed xml document no queue defined ");
                    }
                    Element prop = (Element)propNode;
                    //Add children to root.
                    Queue q = CreateHierarchy(string.Empty, prop);
                    if (rootNode == null)
                    {
                        rootNode = new Queue();
                        rootNode.SetName(string.Empty);
                    }
                    rootNode.AddChild(q);
                }
                return(rootNode);
            }
            catch (DOMException e)
            {
                Log.Info("Error parsing conf file: " + e);
                throw new RuntimeException(e);
            }
        }
示例#8
0
        protected internal virtual void assertThatThereIsNoNewerNamespaceUrl()
        {
            Node         rootElement = modelInstance.Document.DomSource.Node.FirstChild;
            NamedNodeMap attributes  = rootElement.Attributes;

            for (int i = 0; i < attributes.Length; i++)
            {
                Node   item      = attributes.item(i);
                string nodeValue = item.NodeValue;
                assertNotEquals("Found newer namespace url which shouldn't exist", TestModelConstants.NEWER_NAMESPACE, nodeValue);
            }
        }
示例#9
0
        public AttributesReference(Node node)
        {
            NamedNodeMap attrs = node.Attributes;

            for (int i = 0; i < attrs.Length; i++)
            {
                Node child = attrs.Item(i);
                if (child.NodeName.Equals("ReferenceId"))
                {
                    this._referenceId = node.Attributes.GetNamedItem("ReferenceId").NodeValue.Trim();
                }
            }
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void read(org.w3c.dom.Element chartItemSpec, org.maltparser.core.flow.FlowChartManager flowCharts) throws org.maltparser.core.exception.MaltChainedException
        public virtual void read(Element chartItemSpec, FlowChartManager flowCharts)
        {
            chartItemName  = chartItemSpec.getAttribute("item");
            chartItemClass = flowCharts.FlowChartSystem.getChartElement(chartItemName).ChartItemClass;

            NamedNodeMap attrs = chartItemSpec.Attributes;

            for (int i = 0; i < attrs.Length; i++)
            {
                Attr attribute = (Attr)attrs.item(i);
                addChartItemAttribute(attribute.Name, attribute.Value);
            }
        }
  public static void toXmlImpl(Env env, StringBuilder sb, DocumentType node)
  {
    sb.append("<!DOCTYPE");

    sb.append(' ');
    sb.append(node.getName());

    sb.append(' ');
    sb.append("SYSTEM");

    sb.append(' ');
    sb.append('"');
    sb.append(node.getSystemId());
    sb.append('"');

    NamedNodeMap entities = node.getEntities();

    if (entities != null && entities.getLength() > 0) {
      sb.append(' ');
      sb.append('[');
      sb.append('\n');

      for (int i = 0; i < entities.getLength(); i++) {
        Entity entity = (Entity) entities.item(i);

        sb.append("<!ENTITY");

        sb.append(' ');
        sb.append(entity.getNodeName());


        sb.append(' ');
        sb.append('"');
        sb.append(entity.getTextContent());
        sb.append('"');

        sb.append('>');
        sb.append('\n');
      }

      sb.append(']');
    }

    sb.append('>');
  }
示例#12
0
        private static string getAttribute(Node node, string name)
        {
            string       attribute = "";
            NamedNodeMap nnm       = node.Attributes;

            if (nnm.Count == 1)

            {
                Node item = nnm.Item(0);
                if (item.Name.Equals(name))

                {
                    attribute = item.Value;
                }
            }

            return(attribute);
        }
示例#13
0
        private static List <string> getAttributes(Node node)
        {
            List <string> positions = new List <string>();
            NamedNodeMap  nnm       = node.Attributes;

            for (int i = 0; i < nnm.Count; i++)

            {
                Node item = nnm.Item(i);
                if (item.Name.Equals("type"))

                {
                    positions.Add(item.Value);
                }
            }

            return(positions);
        }
        /// <summary>
        /// Inserta o configura datos extras al documento XBRL que se está escribiendo
        /// </summary>
        /// <param name="locationHandle">Handle de la ubicación del archivo</param>
        /// <param name="objectDocument">Documento XML a escribir</param>
        /// <returns>Mismo documento que se escribe</returns>
        public object onWrite(ILocationHandle locationHandle, object objectDocument)
        {
            if (objectDocument is Document)
            {
                Document doc = (Document)objectDocument;

                Node fChild = doc.getFirstChild().getFirstChild();
                while (fChild != null)
                {
                    if (fChild.getLocalName().Equals("schemaRef"))
                    {
                        NamedNodeMap attMap = fChild.getAttributes();
                        if (attMap != null)
                        {
                            for (int iAtt = 0; iAtt < attMap.getLength(); iAtt++)
                            {
                                Node attributeNode = attMap.item(iAtt);
                                if ("href".Equals(attributeNode.getLocalName()))
                                {
                                    if (_httpsSustituido)
                                    {
                                        attributeNode.setNodeValue(internalInstance.DtsDocumentoInstancia[0]
                                                                   .HRef.Replace("http://", "https://").Replace("HTTP://", "HTTPS://"));
                                    }
                                    else
                                    {
                                        attributeNode.setNodeValue(internalInstance.DtsDocumentoInstancia[0].HRef);
                                    }
                                    break;
                                }
                            }
                        }
                        break;
                    }
                    fChild = fChild.getNextSibling();
                }

                doc.setXmlStandalone(true);
                doc.setXmlVersion("1.0");
                Node comment = doc.createComment("Documento XBRL generado por AbaxXBRL 2.1n - 2H Software");
                doc.insertBefore(comment, doc.getFirstChild());
            }
            return(objectDocument);
        }
示例#15
0
        private string GetNodeAttribute(Node node, string tag, bool isRequired)
        {
            NamedNodeMap attrs = node.Attributes;
            Node         attr  = attrs.GetNamedItem(tag);

            if (attr != null)
            {
                return(attr.NodeValue);
            }

            if (isRequired)
            {
                throw new Indeterminate(Indeterminate.IndeterminateSyntaxError);
            }
            else
            {
                return(null);
            }
        }
示例#16
0
        /// <summary>
        /// Language test operation.
        /// </summary>
        /// <param name="node">
        ///            Node to test. </param>
        /// <param name="lang">
        ///            Language to test for. </param>
        /// <returns> Boolean result of operation. </returns>
        private static bool test_lang(Node node, string lang)
        {
            NamedNodeMap attrs = node.Attributes;

            if (attrs != null)
            {
                for (int i = 0; i < attrs.Length; i++)
                {
                    Attr attr = (Attr)attrs.item(i);

                    if (!"xml:lang".Equals(attr.Name))
                    {
                        continue;
                    }

                    string xmllangValue = attr.Value;
                    int    hyphenIndex  = xmllangValue.IndexOf('-');

                    if (hyphenIndex > -1)
                    {
                        xmllangValue = xmllangValue.Substring(0, hyphenIndex);
                    }


                    string langLanguage = lang;
                    if (lang.Length > 2)
                    {
                        langLanguage = lang.Substring(0, 2);
                    }

                    return(xmllangValue.Equals(langLanguage, StringComparison.CurrentCultureIgnoreCase));
                }
            }

            Node parent = node.ParentNode;

            if (parent == null)
            {
                return(false);
            }

            return(test_lang(parent, lang));
        }
示例#17
0
        private static IList lookupPrefixes(ElementType element)
        {
            Element domElm = (Element)element.node_value();

            IList prefixList = new ArrayList();
            Node  node       = domElm;

            while (node != null && node.NodeType != NodeConstants.DOCUMENT_NODE)
            {
                NamedNodeMap attrs = node.Attributes;
                for (int i = 0; i < attrs.Length; i++)
                {
                    Node   attr   = attrs.item(i);
                    string prefix = null;
                    if (attr.NamespaceURI != null && attr.NamespaceURI.Equals(XMLConstants.XMLNS_ATTRIBUTE_NS_URI))
                    {
                        // Default Namespace
                        if (attr.NodeName.Equals(XMLConstants.XMLNS_ATTRIBUTE))
                        {
                            prefix = "";
                        }
                        else
                        {
                            // Should we check the namespace in the Dynamic Context and return that???
                            prefix = attr.LocalName;
                        }
                        if (!string.ReferenceEquals(prefix, null))
                        {
                            if (!prefixList.Contains(prefix))
                            {
                                prefixList.Add(prefix);
                            }
                        }
                    }
                }

                node = node.ParentNode;
            }
            return(prefixList);
        }
示例#18
0
        /// <exception cref="Org.Apache.Hadoop.Yarn.Server.Resourcemanager.Scheduler.Fair.AllocationConfigurationException
        ///     "/>
        public virtual void InitializeFromXml(Element el)
        {
            bool         create               = true;
            NamedNodeMap attributes           = el.GetAttributes();
            IDictionary <string, string> args = new Dictionary <string, string>();

            for (int i = 0; i < attributes.GetLength(); i++)
            {
                Node   node  = attributes.Item(i);
                string key   = node.GetNodeName();
                string value = node.GetNodeValue();
                if (key.Equals("create"))
                {
                    create = System.Boolean.Parse(value);
                }
                else
                {
                    args[key] = value;
                }
            }
            Initialize(create, args);
        }
示例#19
0
        public AttributeValue(Node node)
        {
            NamedNodeMap allattrs = node.Attributes;

            for (int i = 0; i < allattrs.Length; i++)
            {
                Node child = allattrs.Item(i);
                if (child.NodeName.Equals("DataType"))
                {
                    this._datatype = child.NodeValue;
                }
                else
                {
                    this._anyAttributeName  = child.NodeName;
                    this._anyAttributeValue = child.NodeValue;
                }
            }
            if (this._datatype == null)
            {
                throw new Indeterminate(Indeterminate.IndeterminateSyntaxError);
            }
            this._value = new BagDataType();
            this._value.AddDataType(DataTypeFactory.Instance.CreateValue(this._datatype, node.TextContent));
        }
示例#20
0
        private OSMTagMapping(URL tagConf)
        {
            try
            {
                sbyte defaultZoomAppear;

                // ---- Parse XML file ----
                DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
                DocumentBuilder        builder = factory.newDocumentBuilder();
                Document document = builder.parse(tagConf.openStream());

                XPath xpath = XPathFactory.newInstance().newXPath();

                XPathExpression xe = xpath.compile(XPATH_EXPRESSION_DEFAULT_ZOOM);
                defaultZoomAppear = sbyte.Parse((string)xe.evaluate(document, XPathConstants.STRING));

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.HashMap<Nullable<short>, java.util.Set<String>> tmpPoiZoomOverrides = new java.util.HashMap<>();
                Dictionary <short?, ISet <string> > tmpPoiZoomOverrides = new Dictionary <short?, ISet <string> >();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.HashMap<Nullable<short>, java.util.Set<String>> tmpWayZoomOverrides = new java.util.HashMap<>();
                Dictionary <short?, ISet <string> > tmpWayZoomOverrides = new Dictionary <short?, ISet <string> >();

                // ---- Get list of poi nodes ----
                xe = xpath.compile(XPATH_EXPRESSION_POIS);
                NodeList pois = (NodeList)xe.evaluate(document, XPathConstants.NODESET);

                for (int i = 0; i < pois.Length; i++)
                {
                    NamedNodeMap attributes = pois.item(i).Attributes;
                    string       key        = attributes.getNamedItem("key").TextContent;
                    string       value      = attributes.getNamedItem("value").TextContent;

                    string[] equivalentValues = null;
                    if (attributes.getNamedItem("equivalent-values") != null)
                    {
                        equivalentValues = attributes.getNamedItem("equivalent-values").TextContent.Split(",");
                    }

                    sbyte zoom = attributes.getNamedItem("zoom-appear") == null ? defaultZoomAppear : sbyte.Parse(attributes.getNamedItem("zoom-appear").TextContent);

                    bool renderable = attributes.getNamedItem("renderable") == null ? true : bool.Parse(attributes.getNamedItem("renderable").TextContent);

                    bool forcePolygonLine = attributes.getNamedItem("force-polygon-line") == null ? false : bool.Parse(attributes.getNamedItem("force-polygon-line").TextContent);

                    OSMTag osmTag = new OSMTag(this.poiID, key, value, zoom, renderable, forcePolygonLine);
                    if (this.stringToPoiTag.ContainsKey(osmTag.tagKey()))
                    {
                        LOGGER.warning("duplicate osm-tag found in tag-mapping configuration (ignoring): " + osmTag);
                        continue;
                    }
                    LOGGER.finest("adding poi: " + osmTag);
                    this.stringToPoiTag[osmTag.tagKey()] = osmTag;
                    if (equivalentValues != null)
                    {
                        foreach (string equivalentValue in equivalentValues)
                        {
                            this.stringToPoiTag[OSMTag.tagKey(key, equivalentValue)] = osmTag;
                        }
                    }
                    this.idToPoiTag[Convert.ToInt16(this.poiID)] = osmTag;

                    // also fill optimization mapping with identity
                    this.optimizedPoiIds[Convert.ToInt16(this.poiID)] = Convert.ToInt16(this.poiID);

                    // check if this tag overrides the zoom level spec of another tag
                    NodeList zoomOverrideNodes = pois.item(i).ChildNodes;
                    for (int j = 0; j < zoomOverrideNodes.Length; j++)
                    {
                        Node overriddenNode = zoomOverrideNodes.item(j);
                        if (overriddenNode is Element)
                        {
                            string        keyOverridden   = overriddenNode.Attributes.getNamedItem("key").TextContent;
                            string        valueOverridden = overriddenNode.Attributes.getNamedItem("value").TextContent;
                            ISet <string> s = tmpPoiZoomOverrides[Convert.ToInt16(this.poiID)];
                            if (s == null)
                            {
                                s = new HashSet <>();
                                tmpPoiZoomOverrides[Convert.ToInt16(this.poiID)] = s;
                            }
                            s.Add(OSMTag.tagKey(keyOverridden, valueOverridden));
                        }
                    }

                    this.poiID++;
                }

                // ---- Get list of way nodes ----
                xe = xpath.compile(XPATH_EXPRESSION_WAYS);
                NodeList ways = (NodeList)xe.evaluate(document, XPathConstants.NODESET);

                for (int i = 0; i < ways.Length; i++)
                {
                    NamedNodeMap attributes = ways.item(i).Attributes;
                    string       key        = attributes.getNamedItem("key").TextContent;
                    string       value      = attributes.getNamedItem("value").TextContent;

                    string[] equivalentValues = null;
                    if (attributes.getNamedItem("equivalent-values") != null)
                    {
                        equivalentValues = attributes.getNamedItem("equivalent-values").TextContent.Split(",");
                    }

                    sbyte zoom = attributes.getNamedItem("zoom-appear") == null ? defaultZoomAppear : sbyte.Parse(attributes.getNamedItem("zoom-appear").TextContent);

                    bool renderable = attributes.getNamedItem("renderable") == null ? true : bool.Parse(attributes.getNamedItem("renderable").TextContent);

                    bool forcePolygonLine = attributes.getNamedItem("force-polygon-line") == null ? false : bool.Parse(attributes.getNamedItem("force-polygon-line").TextContent);

                    OSMTag osmTag = new OSMTag(this.wayID, key, value, zoom, renderable, forcePolygonLine);
                    if (this.stringToWayTag.ContainsKey(osmTag.tagKey()))
                    {
                        LOGGER.warning("duplicate osm-tag found in tag-mapping configuration (ignoring): " + osmTag);
                        continue;
                    }
                    LOGGER.finest("adding way: " + osmTag);
                    this.stringToWayTag[osmTag.tagKey()] = osmTag;
                    if (equivalentValues != null)
                    {
                        foreach (string equivalentValue in equivalentValues)
                        {
                            this.stringToWayTag[OSMTag.tagKey(key, equivalentValue)] = osmTag;
                        }
                    }
                    this.idToWayTag[Convert.ToInt16(this.wayID)] = osmTag;

                    // also fill optimization mapping with identity
                    this.optimizedWayIds[Convert.ToInt16(this.wayID)] = Convert.ToInt16(this.wayID);

                    // check if this tag overrides the zoom level spec of another tag
                    NodeList zoomOverrideNodes = ways.item(i).ChildNodes;
                    for (int j = 0; j < zoomOverrideNodes.Length; j++)
                    {
                        Node overriddenNode = zoomOverrideNodes.item(j);
                        if (overriddenNode is Element)
                        {
                            string        keyOverridden   = overriddenNode.Attributes.getNamedItem("key").TextContent;
                            string        valueOverridden = overriddenNode.Attributes.getNamedItem("value").TextContent;
                            ISet <string> s = tmpWayZoomOverrides[Convert.ToInt16(this.wayID)];
                            if (s == null)
                            {
                                s = new HashSet <>();
                                tmpWayZoomOverrides[Convert.ToInt16(this.wayID)] = s;
                            }
                            s.Add(OSMTag.tagKey(keyOverridden, valueOverridden));
                        }
                    }

                    this.wayID++;
                }

                // copy temporary values from zoom-override data sets
                foreach (KeyValuePair <short?, ISet <string> > entry in tmpPoiZoomOverrides.SetOfKeyValuePairs())
                {
                    ISet <OSMTag> overriddenTags = new HashSet <OSMTag>();
                    foreach (string tagString in entry.Value)
                    {
                        OSMTag tag = this.stringToPoiTag[tagString];
                        if (tag != null)
                        {
                            overriddenTags.Add(tag);
                        }
                    }
                    if (overriddenTags.Count > 0)
                    {
                        this.poiZoomOverrides[entry.Key] = overriddenTags;
                    }
                }

                foreach (KeyValuePair <short?, ISet <string> > entry in tmpWayZoomOverrides.SetOfKeyValuePairs())
                {
                    ISet <OSMTag> overriddenTags = new HashSet <OSMTag>();
                    foreach (string tagString in entry.Value)
                    {
                        OSMTag tag = this.stringToWayTag[tagString];
                        if (tag != null)
                        {
                            overriddenTags.Add(tag);
                        }
                    }
                    if (overriddenTags.Count > 0)
                    {
                        this.wayZoomOverrides[entry.Key] = overriddenTags;
                    }
                }

                // ---- Error handling ----
            }
            catch (SAXParseException spe)
            {
                LOGGER.severe("\n** Parsing error, line " + spe.LineNumber + ", uri " + spe.SystemId);
                throw new System.InvalidOperationException(spe);
            }
            catch (SAXException sxe)
            {
                throw new System.InvalidOperationException(sxe);
            }
            catch (ParserConfigurationException pce)
            {
                throw new System.InvalidOperationException(pce);
            }
            catch (IOException ioe)
            {
                throw new System.InvalidOperationException(ioe);
            }
            catch (XPathExpressionException e)
            {
                throw new System.InvalidOperationException(e);
            }
        }
示例#21
0
        public Attribute(Node node)
        {
            if (!node.NodeName.Equals(Identifer))
            {
                throw new Indeterminate(Indeterminate.IndeterminateSyntaxError);
            }

            NamedNodeMap attributes = node.Attributes;

            Node idnode = attributes.GetNamedItem("AttributeId");

            if (idnode != null)
            {
                this._attributeId = new AnyURIDataType(idnode.NodeValue);
            }
            else
            {
                throw new Indeterminate(Indeterminate.IndeterminateSyntaxError);
            }

            Node includeinresultnode = attributes.GetNamedItem("IncludeInResult");

            if (includeinresultnode != null)
            {
                string value = includeinresultnode.NodeValue.Trim();
                if (value.EqualsIgnoreCase("true"))
                {
                    this._includeInResult = BooleanDataType.True;
                }
                else
                {
                    this._includeInResult = BooleanDataType.False;
                }
            }
            else
            {
                throw new Indeterminate(Indeterminate.IndeterminateSyntaxError);
            }

            Node issuernode = attributes.GetNamedItem("Issuer");

            if (issuernode != null)
            {
                this._issuer = new StringDataType(issuernode.NodeValue);
            }

            this._attributeValues = new List <AttributeValue>();

            NodeList children = node.ChildNodes;

            for (int i = 0; i < children.Length; i++)
            {
                Node child = children.Item(i);
                if (child.NodeName.Equals("AttributeValue"))
                {
                    this._attributeValues.Add((AttributeValue)AttributeValue.GetInstance(child));
                }
            }

            if (this._attributeValues.Count == 0)
            {
                throw new Indeterminate(Indeterminate.IndeterminateSyntaxError);
            }
        }
 public XmlAttributeCollectionWrapper(NamedNodeMap attributes)
 {
     _attributes = attributes;
 }
示例#23
0
文件: Request.cs 项目: develmax/Xacml
        public Request(Node node)
        {
            if (node.NodeName.Equals(Identifer) == false)
            {
                throw new Indeterminate(Indeterminate.IndeterminateSyntaxError);
            }

            this._otherattributes = new Hashtable();
            NamedNodeMap attrs = node.Attributes;

            this._combinedDecision = BooleanDataType.False;
            for (int i = 0; i < attrs.Length; i++)
            {
                Node child = attrs.Item(i);
                if (child.NodeName.Equals("ReturnPolicyIdList"))
                {
                    string value = node.Attributes.GetNamedItem("ReturnPolicyIdList").NodeValue.Trim();
                    if (value.EqualsIgnoreCase("true"))
                    {
                        this._returnPolicyIdList = BooleanDataType.True;
                    }
                    else
                    {
                        this._returnPolicyIdList = BooleanDataType.False;
                    }
                }
                else if (child.NodeName.Equals("CombinedDecision"))
                {
                    string value = node.Attributes.GetNamedItem("CombinedDecision").NodeValue.Trim();
                    if (value.EqualsIgnoreCase("true"))
                    {
                        this._combinedDecision = BooleanDataType.True;
                    }
                    else
                    {
                        this._combinedDecision = BooleanDataType.False;
                    }
                }
                else
                {
                    this._otherattributes.Add(child.NodeName, child.NodeValue);
                }
            }

            this._attributes      = new List <Attributes>();
            this._requestDefaults = new List <RequestDefaults>();
            this._multiRequests   = new List <MultiRequests>();
            NodeList children = node.ChildNodes;

            for (int i = 0; i < children.Length; i++)
            {
                Node child = children.Item(i);
                if (child.NodeName.Equals(Attributes.Identifer))
                {
                    this._attributes.Add(Attributes.GetInstance(child));
                }
                else if (child.NodeName.Equals(RequestDefaults.Identifer))
                {
                    this._requestDefaults.Add(new RequestDefaults(child));
                }
                else if (child.NodeName.Equals(MultiRequests.Identifer))
                {
                    this._multiRequests.Add(new MultiRequests(child));
                }
            }
        }
示例#24
0
文件: Node.cs 项目: rrsc/AngleSharp
 /// <summary>
 /// Constructs a new node.
 /// </summary>
 internal Node()
 {
     _name = String.Empty;
     _attributes = new NamedNodeMap(this);
     _children = new NodeList();
 }
示例#25
0
 /// <summary>
 /// Constructs a new node.
 /// </summary>
 internal Node()
 {
     _name       = String.Empty;
     _attributes = new NamedNodeMap(this);
     _children   = new NodeList();
 }
示例#26
0
 public NamedNodeMapTests()
 {
     Attrs = new NamedNodeMap();
 }