当前位置: 首页>>代码示例>>C#>>正文


C# XmpNode.AddQualifier方法代码示例

本文整理汇总了C#中iTextSharp.xmp.impl.XmpNode.AddQualifier方法的典型用法代码示例。如果您正苦于以下问题:C# XmpNode.AddQualifier方法的具体用法?C# XmpNode.AddQualifier怎么用?C# XmpNode.AddQualifier使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在iTextSharp.xmp.impl.XmpNode的用法示例。


在下文中一共展示了XmpNode.AddQualifier方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddQualifierNode

        /// <summary>
        /// Adds a qualifier node.
        /// </summary>
        /// <param name="xmpParent"> the parent xmp node </param>
        /// <param name="name"> the name of the qualifier which has to be 
        /// 		QName including the <b>default prefix</b> </param>
        /// <param name="value"> the value of the qualifier </param>
        /// <returns> Returns the newly created child node. </returns>
        /// <exception cref="XmpException"> thown on parsing errors </exception>
        private static XmpNode AddQualifierNode(XmpNode xmpParent, string name, string value) {
            bool isLang = XML_LANG.Equals(name);
            // normalize value of language qualifiers
            XmpNode newQual = new XmpNode(name, isLang ? Utils.NormalizeLangValue(value) : value, null);
            xmpParent.AddQualifier(newQual);

            return newQual;
        }
开发者ID:jagruti23,项目名称:itextsharp,代码行数:17,代码来源:ParseRdf.cs

示例2: FixupQualifiedNode

        /// <summary>
        /// The parent is an RDF pseudo-struct containing an rdf:value field. Fix the
        /// XMP data model. The rdf:value node must be the first child, the other
        /// children are qualifiers. The form, value, and children of the rdf:value
        /// node are the real ones. The rdf:value node's qualifiers must be added to
        /// the others.
        /// </summary>
        /// <param name="xmpParent"> the parent xmp node </param>
        /// <exception cref="XmpException"> thown on parsing errors </exception>
        private static void FixupQualifiedNode(XmpNode xmpParent) {
            Debug.Assert(xmpParent.Options.Struct && xmpParent.HasChildren());

            XmpNode valueNode = xmpParent.GetChild(1);
            Debug.Assert("rdf:value".Equals(valueNode.Name));

            // Move the qualifiers on the value node to the parent. 
            // Make sure an xml:lang qualifier stays at the front.
            // Check for duplicate names between the value node's qualifiers and the parent's children. 
            // The parent's children are about to become qualifiers. Check here, between the groups. 
            // Intra-group duplicates are caught by XMPNode#addChild(...).
            if (valueNode.Options.HasLanguage) {
                if (xmpParent.Options.HasLanguage) {
                    throw new XmpException("Redundant xml:lang for rdf:value element", XmpError.BADXMP);
                }
                XmpNode langQual = valueNode.GetQualifier(1);
                valueNode.RemoveQualifier(langQual);
                xmpParent.AddQualifier(langQual);
            }

            // Start the remaining copy after the xml:lang qualifier.		
            for (int i = 1; i <= valueNode.QualifierLength; i++) {
                XmpNode qualifier = valueNode.GetQualifier(i);
                xmpParent.AddQualifier(qualifier);
            }


            // Change the parent's other children into qualifiers. 
            // This loop starts at 1, child 0 is the rdf:value node.
            for (int i = 2; i <= xmpParent.ChildrenLength; i++) {
                XmpNode qualifier = xmpParent.GetChild(i);
                xmpParent.AddQualifier(qualifier);
            }

            // Move the options and value last, other checks need the parent's original options. 
            // Move the value node's children to be the parent's children.
            Debug.Assert(xmpParent.Options.Struct || xmpParent.HasValueChild);

            xmpParent.HasValueChild = false;
            xmpParent.Options.Struct = false;
            xmpParent.Options.MergeWith(valueNode.Options);
            xmpParent.Value = valueNode.Value;

            xmpParent.RemoveChildren();
            for (IEnumerator it = valueNode.IterateChildren(); it.MoveNext();) {
                XmpNode child = (XmpNode) it.Current;
                xmpParent.AddChild(child);
            }
        }
开发者ID:jagruti23,项目名称:itextsharp,代码行数:58,代码来源:ParseRdf.cs

示例3: CloneSubtree

 /// <summary>
 /// Performs a <b>deep clone</b> of the complete subtree (children and
 /// qualifier )into and add it to the destination node.
 /// </summary>
 /// <param name="destination"> the node to add the cloned subtree </param>
 public virtual void CloneSubtree(XmpNode destination) {
     try {
         foreach (XmpNode node in Children) {
             destination.AddChild((XmpNode) node.Clone());
         }
         foreach (XmpNode node in Qualifier) {
             destination.AddQualifier((XmpNode) node.Clone());
         }
     }
     catch (XmpException) {
         // cannot happen (duplicate childs/quals do not exist in this node)
         Debug.Assert(false);
     }
 }
开发者ID:,项目名称:,代码行数:19,代码来源:

示例4: AppendLangItem

        /// <summary>
        /// Appends a language item to an alt text array.
        /// </summary>
        /// <param name="arrayNode"> the language array </param>
        /// <param name="itemLang"> the language of the item </param>
        /// <param name="itemValue"> the content of the item </param>
        /// <exception cref="XmpException"> Thrown if a duplicate property is added </exception>
        internal static void AppendLangItem(XmpNode arrayNode, string itemLang, string itemValue) {
            XmpNode newItem = new XmpNode(ARRAY_ITEM_NAME, itemValue, null);
            XmpNode langQual = new XmpNode(XML_LANG, itemLang, null);
            newItem.AddQualifier(langQual);

            if (!X_DEFAULT.Equals(langQual.Value)) {
                arrayNode.AddChild(newItem);
            }
            else {
                arrayNode.AddChild(1, newItem);
            }
        }
开发者ID:Gianluigi,项目名称:dssnet,代码行数:19,代码来源:XmpNodeUtils.cs

示例5: LookupQualSelector

        /// <summary>
        /// Searches for a qualifier selector in a node:
        /// [?qualName="value"] - an element in an array, chosen by a qualifier value.
        /// No implicit nodes are created for qualifier selectors, 
        /// except for an alias to an x-default item.
        /// </summary>
        /// <param name="arrayNode"> an array node </param>
        /// <param name="qualName"> the qualifier name </param>
        /// <param name="qualValue"> the qualifier value </param>
        /// <param name="aliasForm"> in case the qual selector results from an alias,
        /// 		  an x-default node is created if there has not been one. </param>
        /// <returns> Returns the index of th </returns>
        /// <exception cref="XmpException">  </exception>
        private static int LookupQualSelector(XmpNode arrayNode, string qualName, string qualValue, uint aliasForm) {
            if (XML_LANG.Equals(qualName)) {
                qualValue = Utils.NormalizeLangValue(qualValue);
                int index = LookupLanguageItem(arrayNode, qualValue);
                if (index < 0 && (aliasForm & AliasOptions.PROP_ARRAY_ALT_TEXT) > 0) {
                    XmpNode langNode = new XmpNode(ARRAY_ITEM_NAME, null);
                    XmpNode xdefault = new XmpNode(XML_LANG, X_DEFAULT, null);
                    langNode.AddQualifier(xdefault);
                    arrayNode.AddChild(1, langNode);
                    return 1;
                }
                return index;
            }
            for (int index = 1; index < arrayNode.ChildrenLength; index++) {
                XmpNode currItem = arrayNode.GetChild(index);

                for (IEnumerator it = currItem.IterateQualifier(); it.MoveNext();) {
                    XmpNode qualifier = (XmpNode) it.Current;
                    if (qualifier != null && qualName.Equals(qualifier.Name) && qualValue.Equals(qualifier.Value)) {
                        return index;
                    }
                }
            }
            return -1;
        }
开发者ID:Gianluigi,项目名称:dssnet,代码行数:38,代码来源:XmpNodeUtils.cs

示例6: FindQualifierNode

        /// <summary>
        /// Find or create a qualifier node under a given parent node. Returns a pointer to the 
        /// qualifier node, and optionally an iterator for the node's position in 
        /// the parent's vector of qualifiers. The iterator is unchanged if no qualifier node (null) 
        /// is returned.
        /// <em>Note:</em> On entry, the qualName parameter must not have the leading '?' from the 
        /// XmpPath step.
        /// </summary>
        /// <param name="parent"> the parent XMPNode </param>
        /// <param name="qualName"> the qualifier name </param>
        /// <param name="createNodes"> flag if nodes shall be created </param>
        /// <returns> Returns the qualifier node if found or created, <code>null</code> otherwise. </returns>
        /// <exception cref="XmpException">  </exception>
        private static XmpNode FindQualifierNode(XmpNode parent, string qualName, bool createNodes) {
            Debug.Assert(!qualName.StartsWith("?"));

            XmpNode qualNode = parent.FindQualifierByName(qualName);

            if (qualNode == null && createNodes) {
                qualNode = new XmpNode(qualName, null);
                qualNode.Implicit = true;

                parent.AddQualifier(qualNode);
            }

            return qualNode;
        }
开发者ID:Gianluigi,项目名称:dssnet,代码行数:27,代码来源:XmpNodeUtils.cs

示例7: TransplantArrayItemAlias

        /// <summary>
        /// Moves an alias node of array form to another schema into an array </summary>
        /// <param name="childNode"> the node to be moved </param>
        /// <param name="baseArray"> the base array for the array item </param>
        /// <exception cref="XmpException"> Forwards XMP errors </exception>
        private static void TransplantArrayItemAlias(XmpNode childNode, XmpNode baseArray) {
            if (baseArray.Options.ArrayAltText) {
                if (childNode.Options.HasLanguage) {
                    throw new XmpException("Alias to x-default already has a language qualifier",
                                           XmpError.BADXMP);
                }

                XmpNode langQual = new XmpNode(XmpConst.XML_LANG, XmpConst.X_DEFAULT, null);
                childNode.AddQualifier(langQual);
            }

            childNode.Name = XmpConst.ARRAY_ITEM_NAME;
            baseArray.AddChild(childNode);
        }
开发者ID:Gianluigi,项目名称:dssnet,代码行数:19,代码来源:XmpNormalizer.cs


注:本文中的iTextSharp.xmp.impl.XmpNode.AddQualifier方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。