C# Class iTextSharp.xmp.impl.ParseRdf

Parser for "normal" XML serialisation of RDF. @since 14.07.2006
Inheritance: XmpConst
ファイルを表示 Open project: nonorganic/dssnet

Private Methods

Method Description
AddChildNode ( XmpMetaImpl xmp, XmpNode xmpParent, XmlNode xmlNode, string value, bool isTopLevel ) : XmpNode

Adds a child node.

AddQualifierNode ( XmpNode xmpParent, string name, string value ) : XmpNode

Adds a qualifier node.

FixupQualifiedNode ( XmpNode xmpParent ) : void

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.

GetRdfTermKind ( XmlNode node ) : int

Determines the ID for a certain RDF Term. Arranged to hopefully minimize the parse time for large XMP.

IsCoreSyntaxTerm ( int term ) : bool

7.2.2 coreSyntaxTerms
rdf:RDF | rdf:ID | rdf:about | rdf:parseType | rdf:resource | rdf:nodeID | rdf:datatype

IsOldTerm ( int term ) : bool

7.2.4 oldTerms
rdf:aboutEach | rdf:aboutEachPrefix | rdf:bagID

IsPropertyElementName ( int term ) : bool

7.2.6 propertyElementURIs anyURI - ( coreSyntaxTerms | rdf:Description | oldTerms )

IsWhitespaceNode ( XmlNode node ) : bool

Checks if the node is a white space.

Parse ( XmlNode xmlRoot ) : XmpMetaImpl

The main parsing method. The XML tree is walked through from the root node and and XMP tree is created. This is a raw parse, the normalisation of the XMP tree happens outside.

RdfEmptyPropertyElement ( XmpMetaImpl xmp, XmpNode xmpParent, XmlNode xmlNode, bool isTopLevel ) : void

7.2.21 emptyPropertyElt start-element ( URI == propertyElementURIs, attributes == set ( idAttr?, ( resourceAttr | nodeIdAttr )?, propertyAttr* ) ) end-element() 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:

  1. If there is an rdf:value attribute then this is a simple property with a text value. All other attributes are qualifiers.
  2. If there is an rdf:resource attribute then this is a simple property with a URI value. All other attributes are qualifiers.
  3. If there are no attributes other than xml:lang, rdf:ID, or rdf:nodeID then this is a simple property with an empty value.
  4. Otherwise this is a struct, the attributes other than xml:lang, rdf:ID, or rdf:nodeID are fields.

RdfLiteralPropertyElement ( XmpMetaImpl xmp, XmpNode xmpParent, XmlNode xmlNode, bool isTopLevel ) : void

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.

RdfNodeElement ( XmpMetaImpl xmp, XmpNode xmpParent, XmlNode xmlNode, bool isTopLevel ) : void

7.2.5 nodeElementURIs anyURI - ( coreSyntaxTerms | rdf:li | oldTerms ) 7.2.11 nodeElement start-element ( URI == nodeElementURIs, attributes == set ( ( idAttr | nodeIdAttr | aboutAttr )?, propertyAttr* ) ) propertyEltList end-element() A node element URI is rdf:Description or anything else that is not an RDF term.

RdfNodeElementAttrs ( XmpMetaImpl xmp, XmpNode xmpParent, XmlNode xmlNode, bool isTopLevel ) : void

7.2.7 propertyAttributeURIs anyURI - ( coreSyntaxTerms | rdf:Description | rdf:li | oldTerms ) 7.2.11 nodeElement start-element ( URI == nodeElementURIs, attributes == set ( ( idAttr | nodeIdAttr | aboutAttr )?, propertyAttr* ) ) propertyEltList end-element() Process the attribute list for an RDF node element. A property attribute URI is anything other than an RDF term. The rdf:ID and rdf:nodeID attributes are simply ignored, as are rdf:about attributes on inner nodes.

RdfNodeElementList ( XmpMetaImpl xmp, XmpNode xmpParent, XmlNode rdfRdfNode ) : void

7.2.10 nodeElementList
ws* ( nodeElement ws* )* Note: this method is only called from the rdf:RDF-node (top level)

RdfParseTypeCollectionPropertyElement ( ) : void

7.2.19 parseTypeCollectionPropertyElt start-element ( URI == propertyElementURIs, attributes == set ( idAttr?, parseCollection ) ) nodeElementList end-element()

RdfParseTypeLiteralPropertyElement ( ) : void

7.2.17 parseTypeLiteralPropertyElt start-element ( URI == propertyElementURIs, attributes == set ( idAttr?, parseLiteral ) ) literal end-element()

RdfParseTypeOtherPropertyElement ( ) : void

7.2.20 parseTypeOtherPropertyElt start-element ( URI == propertyElementURIs, attributes == set ( idAttr?, parseOther ) ) propertyEltList end-element()

RdfParseTypeResourcePropertyElement ( XmpMetaImpl xmp, XmpNode xmpParent, XmlNode xmlNode, bool isTopLevel ) : void

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.

RdfPropertyElement ( XmpMetaImpl xmp, XmpNode xmpParent, XmlNode xmlNode, bool isTopLevel ) : void

7.2.14 propertyElt resourcePropertyElt | literalPropertyElt | parseTypeLiteralPropertyElt | parseTypeResourcePropertyElt | parseTypeCollectionPropertyElt | parseTypeOtherPropertyElt | emptyPropertyElt 7.2.15 resourcePropertyElt start-element ( URI == propertyElementURIs, attributes == set ( idAttr? ) ) ws* nodeElement ws* end-element() 7.2.16 literalPropertyElt start-element ( URI == propertyElementURIs, attributes == set ( idAttr?, datatypeAttr?) ) text() end-element() 7.2.17 parseTypeLiteralPropertyElt start-element ( URI == propertyElementURIs, attributes == set ( idAttr?, parseLiteral ) ) literal end-element() 7.2.18 parseTypeResourcePropertyElt start-element ( URI == propertyElementURIs, attributes == set ( idAttr?, parseResource ) ) propertyEltList end-element() 7.2.19 parseTypeCollectionPropertyElt start-element ( URI == propertyElementURIs, attributes == set ( idAttr?, parseCollection ) ) nodeElementList end-element() 7.2.20 parseTypeOtherPropertyElt start-element ( URI == propertyElementURIs, attributes == set ( idAttr?, parseOther ) ) propertyEltList end-element() 7.2.21 emptyPropertyElt start-element ( URI == propertyElementURIs, attributes == set ( idAttr?, ( resourceAttr | nodeIdAttr )?, propertyAttr* ) ) end-element() The various property element forms are not distinguished by the XML element name, but by their attributes for the most part. The exceptions are resourcePropertyElt and literalPropertyElt. They are distinguished by their XML element content. NOTE: The RDF syntax does not explicitly include the xml:lang attribute although it can appear in many of these. We have to allow for it in the attibute counts below.

RdfPropertyElementList ( XmpMetaImpl xmp, XmpNode xmpParent, XmlNode xmlParent, bool isTopLevel ) : void

7.2.13 propertyEltList ws* ( propertyElt ws* )*

RdfRdf ( XmpMetaImpl xmp, XmlNode rdfRdfNode ) : void

Each of these parsing methods is responsible for recognizing an RDF syntax production and adding the appropriate structure to the XMP tree. They simply return for success, failures will throw an exception.

RdfResourcePropertyElement ( XmpMetaImpl xmp, XmpNode xmpParent, XmlNode xmlNode, bool isTopLevel ) : void

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.