本文整理汇总了C#中iTextSharp.xmp.impl.XmpNode.IterateQualifier方法的典型用法代码示例。如果您正苦于以下问题:C# XmpNode.IterateQualifier方法的具体用法?C# XmpNode.IterateQualifier怎么用?C# XmpNode.IterateQualifier使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iTextSharp.xmp.impl.XmpNode
的用法示例。
在下文中一共展示了XmpNode.IterateQualifier方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SerializeCanonicalRdfProperty
/// <summary>
/// Recursively handles the "value" for a node. It does not matter if it is a
/// top level property, a field of a struct, or an item of an array. The
/// indent is that for the property element. An xml:lang qualifier is written
/// as an attribute of the property start tag, not by itself forcing the
/// qualified property form. The patterns below mostly ignore attribute
/// qualifiers like xml:lang. Except for the one struct case, attribute
/// qualifiers don't affect the output form.
///
/// <blockquote>
///
/// <pre>
/// <ns:UnqualifiedSimpleProperty>value</ns:UnqualifiedSimpleProperty>
///
/// <ns:UnqualifiedStructProperty> (If no rdf:resource qualifier)
/// <rdf:Description>
/// ... Fields, same forms as top level properties
/// </rdf:Description>
/// </ns:UnqualifiedStructProperty>
///
/// <ns:ResourceStructProperty rdf:resource="URI"
/// ... Fields as attributes
/// >
///
/// <ns:UnqualifiedArrayProperty>
/// <rdf:Bag> or Seq or Alt
/// ... Array items as rdf:li elements, same forms as top level properties
/// </rdf:Bag>
/// </ns:UnqualifiedArrayProperty>
///
/// <ns:QualifiedProperty>
/// <rdf:Description>
/// <rdf:value> ... Property "value" following the unqualified
/// forms ... </rdf:value>
/// ... Qualifiers looking like named struct fields
/// </rdf:Description>
/// </ns:QualifiedProperty>
/// </pre>
///
/// </blockquote>
/// </summary>
/// <param name="node"> the property node </param>
/// <param name="emitAsRdfValue"> property shall be rendered as attribute rather than tag </param>
/// <param name="useCanonicalRdf"> use canonical form with inner description tag or
/// the compact form with rdf:ParseType="resource" attribute. </param>
/// <param name="indent"> the current indent level </param>
/// <exception cref="IOException"> Forwards all writer exceptions. </exception>
/// <exception cref="XmpException"> If "rdf:resource" and general qualifiers are mixed. </exception>
private void SerializeCanonicalRdfProperty(XmpNode node, bool useCanonicalRdf, bool emitAsRdfValue, int indent) {
bool emitEndTag = true;
bool indentEndTag = true;
// Determine the XML element name. Open the start tag with the name and
// attribute qualifiers.
string elemName = node.Name;
if (emitAsRdfValue) {
elemName = "rdf:value";
}
else if (XmpConst.ARRAY_ITEM_NAME.Equals(elemName)) {
elemName = "rdf:li";
}
WriteIndent(indent);
Write('<');
Write(elemName);
bool hasGeneralQualifiers = false;
bool hasRdfResourceQual = false;
for (IEnumerator it = node.IterateQualifier(); it.MoveNext();) {
XmpNode qualifier = (XmpNode) it.Current;
if (qualifier != null) {
if (!RDF_ATTR_QUALIFIER.Contains(qualifier.Name)) {
hasGeneralQualifiers = true;
}
else {
hasRdfResourceQual = "rdf:resource".Equals(qualifier.Name);
if (!emitAsRdfValue) {
Write(' ');
Write(qualifier.Name);
Write("=\"");
AppendNodeValue(qualifier.Value, true);
Write('"');
}
}
}
}
// Process the property according to the standard patterns.
if (hasGeneralQualifiers && !emitAsRdfValue) {
// This node has general, non-attribute, qualifiers. Emit using the
// qualified property form.
// ! The value is output by a recursive call ON THE SAME NODE with
// emitAsRDFValue set.
if (hasRdfResourceQual) {
throw new XmpException("Can't mix rdf:resource and general qualifiers", XmpError.BADRDF);
}
//.........这里部分代码省略.........
示例2: SerializeCompactRdfGeneralQualifier
/// <summary>
/// Serializes the general qualifier. </summary>
/// <param name="node"> the root node of the subtree </param>
/// <param name="indent"> the current indent level </param>
/// <exception cref="IOException"> Forwards all writer exceptions. </exception>
/// <exception cref="XmpException"> If qualifier and element fields are mixed. </exception>
private void SerializeCompactRdfGeneralQualifier(int indent, XmpNode node) {
// The node has general qualifiers, ones that can't be
// attributes on a property element.
// Emit using the qualified property pseudo-struct form. The
// value is output by a call
// to SerializePrettyRDFProperty with emitAsRDFValue set.
Write(" rdf:parseType=\"Resource\">");
WriteNewline();
SerializeCanonicalRdfProperty(node, false, true, indent + 1);
for (IEnumerator iq = node.IterateQualifier(); iq.MoveNext();) {
XmpNode qualifier = (XmpNode) iq.Current;
if (qualifier == null)
continue;
SerializeCanonicalRdfProperty(qualifier, false, false, indent + 1);
}
}
示例3: DeclareUsedNamespaces
/// <summary>
/// Writes all used namespaces of the subtree in node to the output.
/// The subtree is recursivly traversed. </summary>
/// <param name="node"> the root node of the subtree </param>
/// <param name="usedPrefixes"> a set containing currently used prefixes </param>
/// <param name="indent"> the current indent level </param>
/// <exception cref="IOException"> Forwards all writer exceptions. </exception>
private void DeclareUsedNamespaces(XmpNode node, ISet usedPrefixes, int indent) {
if (node.Options.SchemaNode) {
// The schema node name is the URI, the value is the prefix.
string prefix = node.Value.Substring(0, node.Value.Length - 1);
DeclareNamespace(prefix, node.Name, usedPrefixes, indent);
}
else if (node.Options.Struct) {
for (IEnumerator it = node.IterateChildren(); it.MoveNext();) {
XmpNode field = (XmpNode) it.Current;
if (field == null)
continue;
DeclareNamespace(field.Name, null, usedPrefixes, indent);
}
}
for (IEnumerator it = node.IterateChildren(); it.MoveNext();) {
XmpNode child = (XmpNode) it.Current;
if (child == null)
continue;
DeclareUsedNamespaces(child, usedPrefixes, indent);
}
for (IEnumerator it = node.IterateQualifier(); it.MoveNext();) {
XmpNode qualifier = (XmpNode) it.Current;
if (qualifier == null)
continue;
DeclareNamespace(qualifier.Name, null, usedPrefixes, indent);
DeclareUsedNamespaces(qualifier, usedPrefixes, indent);
}
}
示例4: CompareAliasedSubtrees
/// <summary>
/// The outermost call is special. The names almost certainly differ. The
/// qualifiers (and hence options) will differ for an alias to the x-default
/// item of a langAlt array.
/// </summary>
/// <param name="aliasNode"> the alias node </param>
/// <param name="baseNode"> the base node of the alias </param>
/// <param name="outerCall"> marks the outer call of the recursion </param>
/// <exception cref="XmpException"> Forwards XMP errors </exception>
private static void CompareAliasedSubtrees(XmpNode aliasNode, XmpNode baseNode, bool outerCall) {
if (!aliasNode.Value.Equals(baseNode.Value) || aliasNode.ChildrenLength != baseNode.ChildrenLength) {
throw new XmpException("Mismatch between alias and base nodes", XmpError.BADXMP);
}
if (!outerCall &&
(!aliasNode.Name.Equals(baseNode.Name) || !aliasNode.Options.Equals(baseNode.Options) ||
aliasNode.QualifierLength != baseNode.QualifierLength)) {
throw new XmpException("Mismatch between alias and base nodes", XmpError.BADXMP);
}
for (IEnumerator an = aliasNode.IterateChildren(), bn = baseNode.IterateChildren();
an.MoveNext() && bn.MoveNext();) {
XmpNode aliasChild = (XmpNode) an.Current;
XmpNode baseChild = (XmpNode) bn.Current;
CompareAliasedSubtrees(aliasChild, baseChild, false);
}
for (IEnumerator an = aliasNode.IterateQualifier(), bn = baseNode.IterateQualifier();
an.MoveNext() && bn.MoveNext();) {
XmpNode aliasQual = (XmpNode) an.Current;
XmpNode baseQual = (XmpNode) bn.Current;
CompareAliasedSubtrees(aliasQual, baseQual, false);
}
}