本文整理汇总了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);
}
}
}
}