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


C# XmpNode.RemoveChildren方法代码示例

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


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

示例1: SetNode

        /// <summary>
        /// The internals for SetProperty() and related calls, used after the node is
        /// found or created.
        /// </summary>
        /// <param name="node">
        ///            the newly created node </param>
        /// <param name="value">
        ///            the node value, can be <code>null</code> </param>
        /// <param name="newOptions">
        ///            options for the new node, must not be <code>null</code>. </param>
        /// <param name="deleteExisting"> flag if the existing value is to be overwritten </param>
        /// <exception cref="XmpException"> thrown if options and value do not correspond </exception>
        internal virtual void SetNode(XmpNode node, object value, PropertyOptions newOptions, bool deleteExisting) {
            if (deleteExisting) {
                node.Clear();
            }

            // its checked by setOptions(), if the merged result is a valid options set
            node.Options.MergeWith(newOptions);

            if (!node.Options.CompositeProperty) {
                // This is setting the value of a leaf node.
                XmpNodeUtils.SetNodeValue(node, value);
            }
            else {
                if (value != null && value.ToString().Length > 0) {
                    throw new XmpException("Composite nodes can't have values", XmpError.BADXPATH);
                }

                node.RemoveChildren();
            }
        }
开发者ID:Gianluigi,项目名称:dssnet,代码行数:32,代码来源:XmpMetaImpl.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


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