• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# impl.XmpNode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



XmpNode类属于iTextSharp.xmp.impl命名空间,在下文中一共展示了XmpNode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: 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);
            }
        }
开发者ID:,项目名称:,代码行数:24,代码来源:


示例2: XmpMetaImpl

 /// <summary>
 /// Constructor for an empty metadata object.
 /// </summary>
 public XmpMetaImpl() {
     // create root node
     _tree = new XmpNode(null, null, null);
 }
开发者ID:Gianluigi,项目名称:dssnet,代码行数:7,代码来源:XmpMetaImpl.cs


示例3: DoSetArrayItem

        // -------------------------------------------------------------------------------------
        // private


        /// <summary>
        /// Locate or create the item node and set the value. Note the index
        /// parameter is one-based! The index can be in the range [1..size + 1] or
        /// "last()", normalize it and check the insert flags. The order of the
        /// normalization checks is important. If the array is empty we end up with
        /// an index and location to set item size + 1.
        /// </summary>
        /// <param name="arrayNode"> an array node </param>
        /// <param name="itemIndex"> the index where to insert the item </param>
        /// <param name="itemValue"> the item value </param>
        /// <param name="itemOptions"> the options for the new item </param>
        /// <param name="insert"> insert oder overwrite at index position? </param>
        /// <exception cref="XmpException"> </exception>
        private void DoSetArrayItem(XmpNode arrayNode, int itemIndex, string itemValue, PropertyOptions itemOptions,
                                    bool insert) {
            XmpNode itemNode = new XmpNode(ARRAY_ITEM_NAME, null);
            itemOptions = XmpNodeUtils.VerifySetOptions(itemOptions, itemValue);

            // in insert mode the index after the last is allowed,
            // even ARRAY_LAST_ITEM points to the index *after* the last.
            int maxIndex = insert ? arrayNode.ChildrenLength + 1 : arrayNode.ChildrenLength;
            if (itemIndex == ARRAY_LAST_ITEM) {
                itemIndex = maxIndex;
            }

            if (1 <= itemIndex && itemIndex <= maxIndex) {
                if (!insert) {
                    arrayNode.RemoveChild(itemIndex);
                }
                arrayNode.AddChild(itemIndex, itemNode);
                SetNode(itemNode, itemValue, itemOptions, false);
            }
            else {
                throw new XmpException("Array index out of bounds", XmpError.BADINDEX);
            }
        }
开发者ID:Gianluigi,项目名称:dssnet,代码行数:40,代码来源:XmpMetaImpl.cs


示例4: 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


示例5: XmpPropertyImpl1

 public XmpPropertyImpl1(XmpNode itemNode) {
     _itemNode = itemNode;
 }
开发者ID:Gianluigi,项目名称:dssnet,代码行数:3,代码来源:XmpMetaImpl.cs


示例6: RdfParseTypeResourcePropertyElement

        /// <summary>
        /// 7.2.18 parseTypeResourcePropertyElt
        ///		start-element ( URI == propertyElementURIs, 
        ///			attributes == set ( idAttr?, parseResource ) )
        ///		propertyEltList
        ///		end-element()
        /// 
        /// Add a new struct node with a qualifier for the possible rdf:ID attribute. 
        /// Then process the XML child nodes to get the struct fields.
        /// </summary>
        /// <param name="xmp"> the xmp metadata object that is generated </param>
        /// <param name="xmpParent"> the parent xmp node </param>
        /// <param name="xmlNode"> the currently processed XML node </param>
        /// <param name="isTopLevel"> Flag if the node is a top-level node </param>
        /// <exception cref="XmpException"> thown on parsing errors </exception>
        private static void RdfParseTypeResourcePropertyElement(XmpMetaImpl xmp, XmpNode xmpParent, XmlNode xmlNode,
                                                                bool isTopLevel) {
            XmpNode newStruct = AddChildNode(xmp, xmpParent, xmlNode, "", isTopLevel);

            newStruct.Options.Struct = true;

            if (xmlNode.Attributes != null) {
                for (int i = 0; i < xmlNode.Attributes.Count; i++) {
                    XmlNode attribute = xmlNode.Attributes[i];
                    if ("xmlns".Equals(attribute.Prefix) || (attribute.Prefix == null && "xmlns".Equals(attribute.Name))) {
                        continue;
                    }

                    string attrLocal = attribute.LocalName;
                    string attrNs = attribute.NamespaceURI;
                    if (XML_LANG.Equals(attribute.Name)) {
                        AddQualifierNode(newStruct, XML_LANG, attribute.Value);
                    }
                    else if (NS_RDF.Equals(attrNs) && ("ID".Equals(attrLocal) || "parseType".Equals(attrLocal))) {
                        continue; // The caller ensured the value is "Resource".
                        // Ignore all rdf:ID attributes.
                    }
                    throw new XmpException("Invalid attribute for ParseTypeResource property element",
                                           XmpError.BADRDF);
                }
            }

            RdfPropertyElementList(xmp, newStruct, xmlNode, false);

            if (newStruct.HasValueChild) {
                FixupQualifiedNode(newStruct);
            }
        }
开发者ID:jagruti23,项目名称:itextsharp,代码行数:48,代码来源:ParseRdf.cs


示例7: AddChildNode

        /// <summary>
        /// Adds a child node.
        /// </summary>
        /// <param name="xmp"> the xmp metadata object that is generated </param>
        /// <param name="xmpParent"> the parent xmp node </param>
        /// <param name="xmlNode"> the currently processed XML node </param>
        /// <param name="value"> Node value </param>
        /// <param name="isTopLevel"> Flag if the node is a top-level node </param>
        /// <returns> Returns the newly created child node. </returns>
        /// <exception cref="XmpException"> thown on parsing errors </exception>
        private static XmpNode AddChildNode(XmpMetaImpl xmp, XmpNode xmpParent, XmlNode xmlNode, string value,
                                            bool isTopLevel) {
            IXmpSchemaRegistry registry = XmpMetaFactory.SchemaRegistry;
            string @namespace = xmlNode.NamespaceURI;
            string childName;
            if (@namespace != null) {
                if (NS_DC_DEPRECATED.Equals(@namespace)) {
                    // Fix a legacy DC namespace
                    @namespace = NS_DC;
                }

                string prefix = registry.GetNamespacePrefix(@namespace);
                if (prefix == null) {
                    prefix = xmlNode.Prefix ?? DEFAULT_PREFIX;
                    prefix = registry.RegisterNamespace(@namespace, prefix);
                }
                childName = prefix + xmlNode.LocalName;
            }
            else {
                throw new XmpException("XML namespace required for all elements and attributes",
                                       XmpError.BADRDF);
            }


            // create schema node if not already there
            PropertyOptions childOptions = new PropertyOptions();
            bool isAlias = false;
            if (isTopLevel) {
                // Lookup the schema node, adjust the XMP parent pointer.
                // Incoming parent must be the tree root.
                XmpNode schemaNode = XmpNodeUtils.FindSchemaNode(xmp.Root, @namespace, DEFAULT_PREFIX, true);
                schemaNode.Implicit = false; // Clear the implicit node bit.
                // need runtime check for proper 32 bit code.
                xmpParent = schemaNode;

                // If this is an alias set the alias flag in the node 
                // and the hasAliases flag in the tree.
                if (registry.FindAlias(childName) != null) {
                    isAlias = true;
                    xmp.Root.HasAliases = true;
                    schemaNode.HasAliases = true;
                }
            }


            // Make sure that this is not a duplicate of a named node.
            bool isArrayItem = "rdf:li".Equals(childName);
            bool isValueNode = "rdf:value".Equals(childName);

            // Create XMP node and so some checks
            XmpNode newChild = new XmpNode(childName, value, childOptions);
            newChild.Alias = isAlias;

            // Add the new child to the XMP parent node, a value node first.
            if (!isValueNode) {
                xmpParent.AddChild(newChild);
            }
            else {
                xmpParent.AddChild(1, newChild);
            }


            if (isValueNode) {
                if (isTopLevel || !xmpParent.Options.Struct) {
                    throw new XmpException("Misplaced rdf:value element", XmpError.BADRDF);
                }
                xmpParent.HasValueChild = true;
            }

            if (isArrayItem) {
                if (!xmpParent.Options.Array) {
                    throw new XmpException("Misplaced rdf:li element", XmpError.BADRDF);
                }
                newChild.Name = ARRAY_ITEM_NAME;
            }

            return newChild;
        }
开发者ID:jagruti23,项目名称:itextsharp,代码行数:88,代码来源:ParseRdf.cs


示例8: AccumulatePath

            /// <param name="currNode"> the node that will be added to the path. </param>
            /// <param name="parentPath"> the path up to this node. </param>
            /// <param name="currentIndex"> the current array index if an arrey is traversed </param>
            /// <returns> Returns the updated path. </returns>
            protected internal virtual string AccumulatePath(XmpNode currNode, string parentPath, int currentIndex) {
                string separator;
                string segmentName;
                if (currNode.Parent == null || currNode.Options.SchemaNode) {
                    return null;
                }
                if (currNode.Parent.Options.Array) {
                    separator = "";
                    segmentName = "[" + Convert.ToString(currentIndex) + "]";
                }
                else {
                    separator = "/";
                    segmentName = currNode.Name;
                }


                if (String.IsNullOrEmpty(parentPath)) {
                    return segmentName;
                }
                if (_outerInstance.Options.JustLeafname) {
                    return !segmentName.StartsWith("?") ? segmentName : segmentName.Substring(1); // qualifier
                }
                return parentPath + separator + segmentName;
            }
开发者ID:Gianluigi,项目名称:dssnet,代码行数:28,代码来源:XmpIteratorImpl.cs


示例9: CreatePropertyInfo

            /// <summary>
            /// Creates a property info object from an <code>XMPNode</code>. </summary>
            /// <param name="node"> an <code>XMPNode</code> </param>
            /// <param name="baseNs"> the base namespace to report </param>
            /// <param name="path"> the full property path </param>
            /// <returns> Returns a <code>XMPProperty</code>-object that serves representation of the node. </returns>
            protected internal virtual IXmpPropertyInfo CreatePropertyInfo(XmpNode node, string baseNs, string path) {
                string value = node.Options.SchemaNode ? null : node.Value;

                return new XmpPropertyInfoImpl(node, baseNs, path, value);
            }
开发者ID:Gianluigi,项目名称:dssnet,代码行数:11,代码来源:XmpIteratorImpl.cs


示例10: 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>
        /// 	&lt;ns:UnqualifiedSimpleProperty&gt;value&lt;/ns:UnqualifiedSimpleProperty&gt;
        /// 
        /// 	&lt;ns:UnqualifiedStructProperty&gt; (If no rdf:resource qualifier)
        /// 		&lt;rdf:Description&gt;
        /// 			... Fields, same forms as top level properties
        /// 		&lt;/rdf:Description&gt;
        /// 	&lt;/ns:UnqualifiedStructProperty&gt;
        /// 
        /// 	&lt;ns:ResourceStructProperty rdf:resource=&quot;URI&quot;
        /// 		... Fields as attributes
        /// 	&gt;
        /// 
        /// 	&lt;ns:UnqualifiedArrayProperty&gt;
        /// 		&lt;rdf:Bag&gt; or Seq or Alt
        /// 			... Array items as rdf:li elements, same forms as top level properties
        /// 		&lt;/rdf:Bag&gt;
        /// 	&lt;/ns:UnqualifiedArrayProperty&gt;
        /// 
        /// 	&lt;ns:QualifiedProperty&gt;
        /// 		&lt;rdf:Description&gt;
        /// 			&lt;rdf:value&gt; ... Property &quot;value&quot; following the unqualified 
        /// 				forms ... &lt;/rdf:value&gt;
        /// 			... Qualifiers looking like named struct fields
        /// 		&lt;/rdf:Description&gt;
        /// 	&lt;/ns:QualifiedProperty&gt;
        /// </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=&quot;resource&quot; attribute. </param>
        /// <param name="indent"> the current indent level </param>
        /// <exception cref="IOException"> Forwards all writer exceptions. </exception>
        /// <exception cref="XmpException"> If &quot;rdf:resource&quot; 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);
                }
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


示例11: NodeIterator

            /// <summary>
            /// Constructor for the node iterator. </summary>
            /// <param name="visitedNode"> the currently visited node </param>
            /// <param name="parentPath"> the accumulated path of the node </param>
            /// <param name="index"> the index within the parent node (only for arrays) </param>
            public NodeIterator(XmpIteratorImpl outerInstance, XmpNode visitedNode, string parentPath, int index) {
                _outerInstance = outerInstance;
                _visitedNode = visitedNode;
                _state = ITERATE_NODE;
                if (visitedNode.Options.SchemaNode) {
                    outerInstance.BaseNs = visitedNode.Name;
                }

                // for all but the root node and schema nodes
                _path = AccumulatePath(visitedNode, parentPath, index);
            }
开发者ID:Gianluigi,项目名称:dssnet,代码行数:16,代码来源:XmpIteratorImpl.cs


示例12: StartOuterRdfDescription

        /// <summary>
        /// Start the outer rdf:Description element, including all needed xmlns attributes.
        /// Leave the element open so that the compact form can add property attributes.
        /// </summary>
        /// <exception cref="IOException"> If the writing to   </exception>
        private void StartOuterRdfDescription(XmpNode schemaNode, int level) {
            WriteIndent(level + 1);
            Write(RDF_SCHEMA_START);
            WriteTreeName();

            ISet usedPrefixes = new HashSet();
            usedPrefixes.Add("xml");
            usedPrefixes.Add("rdf");

            DeclareUsedNamespaces(schemaNode, usedPrefixes, level + 3);

            Write('>');
            WriteNewline();
        }
开发者ID:,项目名称:,代码行数:19,代码来源:


示例13: 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);
            }
        }
开发者ID:,项目名称:,代码行数:37,代码来源:


示例14: SerializeCanonicalRdfSchema

 /// <summary>
 /// Serializes one schema with all contained properties in pretty-printed
 /// manner.<br> 
 /// Each schema's properties are written to a single
 /// rdf:Description element. All of the necessary namespaces are declared in
 /// the rdf:Description element. The baseIndent is the base level for the
 /// entire serialization, that of the x:xmpmeta element. An xml:lang
 /// qualifier is written as an attribute of the property start tag, not by
 /// itself forcing the qualified property form.
 /// 
 /// <blockquote>
 /// 
 /// <pre>
 ///  	 &lt;rdf:Description rdf:about=&quot;TreeName&quot; xmlns:ns=&quot;URI&quot; ... &gt;
 ///  
 ///  	 	... The actual properties of the schema, see SerializePrettyRDFProperty
 ///  
 ///  	 	&lt;!-- ns1:Alias is aliased to ns2:Actual --&gt;  ... If alias comments are wanted
 ///  
 ///  	 &lt;/rdf:Description&gt;
 /// </pre>
 /// 
 /// </blockquote>
 /// </summary>
 /// <param name="schemaNode"> a schema node </param>
 /// <param name="level"> </param>
 /// <exception cref="IOException"> Forwarded writer exceptions </exception>
 /// <exception cref="XmpException">  </exception>
 private void SerializeCanonicalRdfSchema(XmpNode schemaNode, int level) {
     // Write each of the schema's actual properties.
     for (IEnumerator it = schemaNode.IterateChildren(); it.MoveNext();) {
         XmpNode propNode = (XmpNode) it.Current;
         if (propNode == null)
             continue;
         SerializeCanonicalRdfProperty(propNode, _options.UseCanonicalFormat, false, level + 2);
     }
 }
开发者ID:,项目名称:,代码行数:37,代码来源:


示例15: RdfResourcePropertyElement

        /// <summary>
        /// 7.2.15 resourcePropertyElt
        ///		start-element ( URI == propertyElementURIs, attributes == set ( idAttr? ) )
        ///		ws* nodeElement ws*
        ///		end-element()
        /// 
        /// This handles structs using an rdf:Description node, 
        /// arrays using rdf:Bag/Seq/Alt, and typedNodes. It also catches and cleans up qualified 
        /// properties written with rdf:Description and rdf:value.
        /// </summary>
        /// <param name="xmp"> the xmp metadata object that is generated </param>
        /// <param name="xmpParent"> the parent xmp node </param>
        /// <param name="xmlNode"> the currently processed XML node </param>
        /// <param name="isTopLevel"> Flag if the node is a top-level node </param>
        /// <exception cref="XmpException"> thown on parsing errors </exception>
        private static void RdfResourcePropertyElement(XmpMetaImpl xmp, XmpNode xmpParent, XmlNode xmlNode,
                                                       bool isTopLevel) {
            if (isTopLevel && "iX:changes".Equals(xmlNode.Name)) {
                // Strip old "punchcard" chaff which has on the prefix "iX:".
                return;
            }

            XmpNode newCompound = AddChildNode(xmp, xmpParent, xmlNode, "", isTopLevel);

            // walk through the attributes
            if (xmlNode.Attributes != null) {
                for (int i = 0; i < xmlNode.Attributes.Count; i++) {
                    XmlNode attribute = xmlNode.Attributes[i];
                    if ("xmlns".Equals(attribute.Prefix) || (attribute.Prefix == null && "xmlns".Equals(attribute.Name))) {
                        continue;
                    }

                    string attrLocal = attribute.LocalName;
                    string attrNs = attribute.NamespaceURI;
                    if (XML_LANG.Equals(attribute.Name)) {
                        AddQualifierNode(newCompound, XML_LANG, attribute.Value);
                    }
                    else if ("ID".Equals(attrLocal) && NS_RDF.Equals(attrNs)) {
                        continue; // Ignore all rdf:ID attributes.
                    }
                    throw new XmpException("Invalid attribute for resource property element", XmpError.BADRDF);
                }
            }

            // walk through the children

            bool found = false;
            for (int i = 0; i < xmlNode.ChildNodes.Count; i++) {
                XmlNode currChild = xmlNode.ChildNodes[i];
                if (!IsWhitespaceNode(currChild)) {
                    if (currChild.NodeType == XmlNodeType.Element && !found) {
                        bool isRdf = NS_RDF.Equals(currChild.NamespaceURI);
                        string childLocal = currChild.LocalName;

                        if (isRdf && "Bag".Equals(childLocal)) {
                            newCompound.Options.Array = true;
                        }
                        else if (isRdf && "Seq".Equals(childLocal)) {
                            newCompound.Options.Array = true;
                            newCompound.Options.ArrayOrdered = true;
                        }
                        else if (isRdf && "Alt".Equals(childLocal)) {
                            newCompound.Options.Array = true;
                            newCompound.Options.ArrayOrdered = true;
                            newCompound.Options.ArrayAlternate = true;
                        }
                        else {
                            newCompound.Options.Struct = true;
                            if (!isRdf && !"Description".Equals(childLocal)) {
                                string typeName = currChild.NamespaceURI;
                                if (typeName == null) {
                                    throw new XmpException("All XML elements must be in a namespace",
                                                           XmpError.BADXMP);
                                }
                                typeName += ':' + childLocal;
                                AddQualifierNode(newCompound, "rdf:type", typeName);
                            }
                        }

                        RdfNodeElement(xmp, newCompound, currChild, false);

                        if (newCompound.HasValueChild) {
                            FixupQualifiedNode(newCompound);
                        }
                        else if (newCompound.Options.ArrayAlternate) {
                            XmpNodeUtils.DetectAltText(newCompound);
                        }

                        found = true;
                    }
                    else if (found) {
                        // found second child element
                        throw new XmpException("Invalid child of resource property element", XmpError.BADRDF);
                    }
                    else {
                        throw new XmpException("Children of resource property element must be XML elements",
                                               XmpError.BADRDF);
                    }
                }
            }
//.........这里部分代码省略.........
开发者ID:jagruti23,项目名称:itextsharp,代码行数:101,代码来源:ParseRdf.cs


示例16: XmpPropertyInfoImpl

 public XmpPropertyInfoImpl(XmpNode node, string baseNs, string path, string value) {
     _node = node;
     _baseNs = baseNs;
     _path = path;
     _value = value;
 }
开发者ID:Gianluigi,项目名称:dssnet,代码行数:6,代码来源:XmpIteratorImpl.cs


示例17: RdfLiteralPropertyElement

        /// <summary>
        /// 7.2.16 literalPropertyElt
        ///		start-element ( URI == propertyElementURIs, 
        ///				attributes == set ( idAttr?, datatypeAttr?) )
        ///		text()
        ///		end-element()
        /// 
        /// Add a leaf node with the text value and qualifiers for the attributes. </summary>
        /// <param name="xmp"> the xmp metadata object that is generated </param>
        /// <param name="xmpParent"> the parent xmp node </param>
        /// <param name="xmlNode"> the currently processed XML node </param>
        /// <param name="isTopLevel"> Flag if the node is a top-level node </param>
        /// <exception cref="XmpException"> thown on parsing errors </exception>
        private static void RdfLiteralPropertyElement(XmpMetaImpl xmp, XmpNode xmpParent, XmlNode xmlNode,
                                                      bool isTopLevel) {
            XmpNode newChild = AddChildNode(xmp, xmpParent, xmlNode, null, isTopLevel);
            if (xmlNode.Attributes != null) {
                for (int i = 0; i < xmlNode.Attributes.Count; i++) {
                    XmlNode attribute = xmlNode.Attributes[i];
                    if ("xmlns".Equals(attribute.Prefix) || (attribute.Prefix == null && "xmlns".Equals(attribute.Name))) {
                        continue;
                    }

                    string attrNs = attribute.NamespaceURI;
                    string attrLocal = attribute.LocalName;
                    if (XML_LANG.Equals(attribute.Name)) {
                        AddQualifierNode(newChild, XML_LANG, attribute.Value);
                    } else if (NS_RDF.Equals(attrNs) && ("ID".Equals(attrLocal) || "datatype".Equals(attrLocal))) {
                        continue; // Ignore all rdf:ID and rdf:datatype attributes.
                    } else
                        throw new XmpException("Invalid attribute for literal property element", XmpError.BADRDF);
                }
            }
            string textValue = "";
            for (int i = 0; i < xmlNode.ChildNodes.Count; i++) {
                XmlNode child = xmlNode.ChildNodes[i];
                if (child.NodeType == XmlNodeType.Text) {
                    textValue += child.Value;
                }
                else {
                    throw new XmpException("Invalid child of literal property element", XmpError.BADRDF);
                }
            }
            newChild.Value = textValue;
        }
开发者ID:jagruti23,项目名称:itextsharp,代码行数:45,代码来源:ParseRdf.cs


示例18: NodeIteratorChildren

            /// <summary>
            /// Constructor </summary>
            /// <param name="parentNode"> the node which children shall be iterated. </param>
            /// <param name="parentPath"> the full path of the former node without the leaf node. </param>
            public NodeIteratorChildren(XmpIteratorImpl outerInstance, XmpNode parentNode, string parentPath)
                : base(outerInstance, parentNode, parentPath, 0) {
                _outerInstance = outerInstance;
                if (parentNode.Options.SchemaNode) {
                    outerInstance.BaseNs = parentNode.Name;
                }
                _parentPath = AccumulatePath(parentNode, parentPath, 1);

                _childrenIterator = parentNode.IterateChildren();
            }
开发者ID:Gianluigi,项目名称:dssnet,代码行数:14,代码来源:XmpIteratorImpl.cs


示例19: RdfEmptyPropertyElement

        /// <summary>
        /// 7.2.21 emptyPropertyElt
        ///		start-element ( URI == propertyElementURIs,
        ///						attributes == set (
        ///							idAttr?, ( resourceAttr | nodeIdAttr )?, propertyAttr* ) )
        ///		end-element()
        /// 
        /// <ns:Prop1/>  <!-- a simple property with an empty value --> 
        /// <ns:Prop2 rdf:resource="http: *www.adobe.com/"/> <!-- a URI value --> 
        /// <ns:Prop3 rdf:value="..." ns:Qual="..."/> <!-- a simple qualified property --> 
        /// <ns:Prop4 ns:Field1="..." ns:Field2="..."/> <!-- a struct with simple fields -->
        /// 
        /// An emptyPropertyElt is an element with no contained content, just a possibly empty set of
        /// attributes. An emptyPropertyElt can represent three special cases of simple XMP properties: a
        /// simple property with an empty value (ns:Prop1), a simple property whose value is a URI
        /// (ns:Prop2), or a simple property with simple qualifiers (ns:Prop3). 
        /// An emptyPropertyElt can also represent an XMP struct whose fields are all simple and 
        /// unqualified (ns:Prop4).
        /// 
        /// It is an error to use both rdf:value and rdf:resource - that can lead to invalid  RDF in the
        /// verbose form written using a literalPropertyElt.
        /// 
        /// The XMP mapping for an emptyPropertyElt is a bit different from generic RDF, partly for 
        /// design reasons and partly for historical reasons. The XMP mapping rules are:
        /// <ol> 
        ///		<li> If there is an rdf:value attribute then this is a simple property
        ///				 with a text value.
        ///		All other attributes are qualifiers.
        ///		<li> If there is an rdf:resource attribute then this is a simple property 
        ///			with a URI value. 
        ///		All other attributes are qualifiers.
        ///		<li> If there are no attributes other than xml:lang, rdf:ID, or rdf:nodeID
        ///				then this is a simple 
        ///		property with an empty value. 
        ///		<li> Otherwise this is a struct, the attributes other than xml:lang, rdf:ID, 
        ///				or rdf:nodeID are fields. 
        /// </ol>
        /// </summary>
        /// <param name="xmp"> the xmp metadata object that is generated </param>
        /// <param name="xmpParent"> the parent xmp node </param>
        /// 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# io.IoObject类代码示例发布时间:2022-05-26
下一篇:
C# html.HtmlPipelineContext类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap