コード例 #1
0
 /// <summary>Appends a qualifier to the qualifier list and sets respective options.</summary>
 /// <param name="qualNode">a qualifier node.</param>
 /// <exception cref="iText.Kernel.XMP.XMPException"></exception>
 public virtual void AddQualifier(iText.Kernel.XMP.Impl.XMPNode qualNode)
 {
     AssertQualifierNotExisting(qualNode.GetName());
     qualNode.SetParent(this);
     qualNode.GetOptions().SetQualifier(true);
     GetOptions().SetHasQualifiers(true);
     // contraints
     if (qualNode.IsLanguageNode())
     {
         // "xml:lang" is always first and the option "hasLanguage" is set
         options.SetHasLanguage(true);
         GetQualifier().Insert(0, qualNode);
     }
     else
     {
         if (qualNode.IsTypeNode())
         {
             // "rdf:type" must be first or second after "xml:lang" and the option "hasType" is set
             options.SetHasType(true);
             GetQualifier().Insert(!options.GetHasLanguage() ? 0 : 1, qualNode);
         }
         else
         {
             // other qualifiers are appended
             GetQualifier().Add(qualNode);
         }
     }
 }
コード例 #2
0
 /// <summary>Adds a node as child to this node.</summary>
 /// <param name="node">an XMPNode</param>
 /// <exception cref="iText.Kernel.XMP.XMPException"></exception>
 public virtual void AddChild(iText.Kernel.XMP.Impl.XMPNode node)
 {
     // check for duplicate properties
     AssertChildNotExisting(node.GetName());
     node.SetParent(this);
     GetChildren().Add(node);
 }
コード例 #3
0
 /// <summary>Internal find.</summary>
 /// <param name="list">the list to search in</param>
 /// <param name="expr">the search expression</param>
 /// <returns>Returns the found node or <code>nulls</code>.</returns>
 private iText.Kernel.XMP.Impl.XMPNode Find(IList list, String expr)
 {
     if (list != null)
     {
         for (IEnumerator it = list.GetEnumerator(); it.MoveNext();)
         {
             iText.Kernel.XMP.Impl.XMPNode child = (iText.Kernel.XMP.Impl.XMPNode)it
                                                   .Current;
             if (child.GetName().Equals(expr))
             {
                 return(child);
             }
         }
     }
     return(null);
 }
コード例 #4
0
 /// <summary>Adds a node as child to this node.</summary>
 /// <param name="index">
 /// the index of the node <em>before</em> which the new one is inserted.
 /// <em>Note:</em> The node children are indexed from [1..size]!
 /// An index of size + 1 appends a node.
 /// </param>
 /// <param name="node">an XMPNode</param>
 /// <exception cref="iText.Kernel.XMP.XMPException"></exception>
 public virtual void AddChild(int index, iText.Kernel.XMP.Impl.XMPNode node)
 {
     AssertChildNotExisting(node.GetName());
     node.SetParent(this);
     GetChildren().Insert(index - 1, node);
 }