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


C# XmpNode.ReplaceChild方法代码示例

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


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

示例1: NormalizeDcArrays

        /// <summary>
        /// Undo the denormalization performed by the XMP used in Acrobat 5.<br> 
        /// If a Dublin Core array had only one item, it was serialized as a simple
        /// property. <br>
        /// The <code>xml:lang</code> attribute was dropped from an
        /// <code>alt-text</code> item if the language was <code>x-default</code>.
        /// </summary>
        /// <param name="dcSchema"> the DC schema node </param>
        /// <exception cref="XmpException"> Thrown if normalization fails </exception>
        private static void NormalizeDcArrays(XmpNode dcSchema) {
            for (int i = 1; i <= dcSchema.ChildrenLength; i++) {
                XmpNode currProp = dcSchema.GetChild(i);

                PropertyOptions arrayForm = (PropertyOptions) _dcArrayForms[currProp.Name];
                if (arrayForm == null) {
                    continue;
                }
                if (currProp.Options.Simple) {
                    // create a new array and add the current property as child, 
                    // if it was formerly simple 
                    XmpNode newArray = new XmpNode(currProp.Name, arrayForm);
                    currProp.Name = XmpConst.ARRAY_ITEM_NAME;
                    newArray.AddChild(currProp);
                    dcSchema.ReplaceChild(i, newArray);

                    // fix language alternatives
                    if (arrayForm.ArrayAltText && !currProp.Options.HasLanguage) {
                        XmpNode newLang = new XmpNode(XmpConst.XML_LANG, XmpConst.X_DEFAULT, null);
                        currProp.AddQualifier(newLang);
                    }
                }
                else {
                    // clear array options and add corrected array form if it has been an array before
                    currProp.Options.SetOption(
                        PropertyOptions.ARRAY | PropertyOptions.ARRAY_ORDERED | PropertyOptions.ARRAY_ALTERNATE |
                        PropertyOptions.ARRAY_ALT_TEXT, false);
                    currProp.Options.MergeWith(arrayForm);

                    if (arrayForm.ArrayAltText) {
                        // applying for "dc:description", "dc:rights", "dc:title"
                        RepairAltText(currProp);
                    }
                }
            }
        }
开发者ID:Gianluigi,项目名称:dssnet,代码行数:45,代码来源:XmpNormalizer.cs


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