Package com.itextpdf.xmp

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

Related Classes of com.itextpdf.xmp.XMPSchemaRegistry

Copyright © 2018 www.massapicom. 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.