Examples of XMPSchemaRegistry


Examples of com.adobe.xmp.XMPSchemaRegistry

    }

    @Override
    public XMPMeta process(Metadata metadata) throws XMPException {
        setMetadata( metadata );
        XMPSchemaRegistry registry = XMPMetaFactory.getSchemaRegistry();

        String[] keys = metadata.names();
        for (String key : keys) {
            String[] keyParts = key.split( Metadata.NAMESPACE_PREFIX_DELIMITER );
            if (keyParts.length > 0 && keyParts.length <= 2) {
                String uri = registry.getNamespaceURI( keyParts[0] );

                if (uri != null) {
                    // Tika properties where the type differs from the XMP specification
                    if (key.equals( DublinCore.TITLE.getName() )
                            || key.equals( DublinCore.DESCRIPTION.getName() )
View Full Code Here

Examples of com.adobe.xmp.XMPSchemaRegistry

     *            the list of namespaces to be registered
     * @throws TikaException
     *             in case a namespace oculd not be registered
     */
    protected void registerNamespaces(Set<Namespace> namespaces) throws TikaException {
        XMPSchemaRegistry registry = XMPMetaFactory.getSchemaRegistry();

        for (Namespace namespace : namespaces) {
            // Any already registered namespace is not registered again
            try {
                registry.registerNamespace( namespace.uri, namespace.prefix );
            }
            catch (XMPException e) {
                throw new TikaException(
                        "Namespace needed by converter could not be registiered with XMPCore", e );
            }
View Full Code Here

Examples of com.adobe.xmp.XMPSchemaRegistry

     *            the list of namespaces to be registered
     * @throws TikaException
     *             in case a namespace oculd not be registered
     */
    protected void registerNamespaces(Set<Namespace> namespaces) throws TikaException {
        XMPSchemaRegistry registry = XMPMetaFactory.getSchemaRegistry();

        for (Namespace namespace : namespaces) {
            // Any already registered namespace is not registered again
            try {
                registry.registerNamespace( namespace.uri, namespace.prefix );
            }
            catch (XMPException e) {
                throw new TikaException(
                        "Namespace needed by converter could not be registiered with XMPCore", e );
            }
View Full Code Here

Examples of com.adobe.xmp.XMPSchemaRegistry

   * @throws XMPException thown on parsing errors
   */
  private static XMPNode addChildNode(XMPMetaImpl xmp, XMPNode xmpParent, Node xmlNode,
      String value, boolean isTopLevel) throws XMPException
  {
    XMPSchemaRegistry registry = XMPMetaFactory.getSchemaRegistry();
    String namespace = xmlNode.getNamespaceURI();
    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.getPrefix() != null ? xmlNode.getPrefix() : DEFAULT_PREFIX;
        prefix = registry.registerNamespace(namespace, prefix);
      }
      childName = prefix + xmlNode.getLocalName();
    }
    else
    {
      throw new XMPException(
        "XML namespace required for all elements and attributes", BADRDF);
    }

   
    // create schema node if not already there
    PropertyOptions childOptions = new PropertyOptions();
    boolean 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.getRoot(), namespace,
        DEFAULT_PREFIX, true);
      schemaNode.setImplicit(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.getRoot().setHasAliases(true);
        schemaNode.setHasAliases(true);
      }
View Full Code Here

Examples of com.itextpdf.xmp.XMPSchemaRegistry

   * @throws XMPException thown on parsing errors
   */
  private static XMPNode addChildNode(XMPMetaImpl xmp, XMPNode xmpParent, Node xmlNode,
      String value, boolean isTopLevel) throws XMPException
  {
    XMPSchemaRegistry registry = XMPMetaFactory.getSchemaRegistry();
    String namespace = xmlNode.getNamespaceURI();
    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.getPrefix() != null ? xmlNode.getPrefix() : DEFAULT_PREFIX;
        prefix = registry.registerNamespace(namespace, prefix);
      }
      childName = prefix + xmlNode.getLocalName();
    }
    else
    {
      throw new XMPException(
        "XML namespace required for all elements and attributes", BADRDF);
    }

   
    // create schema node if not already there
    PropertyOptions childOptions = new PropertyOptions();
    boolean 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.getRoot(), namespace,
        DEFAULT_PREFIX, true);
      schemaNode.setImplicit(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.getRoot().setHasAliases(true);
        schemaNode.setHasAliases(true);
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.