Package org.apache.padaf.xmpbox.schema

Examples of org.apache.padaf.xmpbox.schema.XMPSchema


    } else {
      int c = 0;
      String namespaceUri = reader.get().getNamespaceURI(c);
      String namespacePrefix = reader.get().getNamespacePrefix(c);
      c++;
      XMPSchema schema = nsMap.getAssociatedSchemaObject(metadata, namespaceUri, namespacePrefix);
      while (c<reader.get().getNamespaceCount() && schema==null) {
        // try next
        namespaceUri = reader.get().getNamespaceURI(c);
        namespacePrefix = reader.get().getNamespacePrefix(c);
        schema = nsMap.getAssociatedSchemaObject(metadata, namespaceUri, namespacePrefix);
        c++;
      }

      if (schema != null) {
        namespaces.remove(namespacePrefix);
      } else {
        schema = metadata.createAndAddDefaultSchema(namespacePrefix,namespaceUri);
      }

      for (int i = 1; i < cptNS; i++) {
        schema.setAttribute(new Attribute(XMPSchema.NS_NAMESPACE,
            "xmlns", reader.get().getNamespacePrefix(i), reader.get().getNamespaceURI(i)));
      }
      treatDescriptionAttributes(metadata, schema);
      while (reader.get().nextTag() == XMLStreamReader.START_ELEMENT) {
        parseProperty(schema, metadata);
View Full Code Here


   *             When Instancing specified Object Schema failed
   */
  @SuppressWarnings("unchecked")
  public XMPSchema createXMPSchema(XMPMetadata metadata, String prefix)
  throws XmpSchemaException {
    XMPSchema schema = null;
    Class[] argsClass;
    Object[] schemaArgs;

    if (isDeclarative) {
      argsClass = new Class[] { XMPMetadata.class, String.class, String.class };
View Full Code Here

  @Before
  public void init() throws Exception {
    metadata = new XMPMetadata();
    String tmpNsURI = "http://www.test.org/schem/";
    tmp = new XMPSchema(metadata, "test", tmpNsURI);
    tmp.addBagValue("test:BagContainer", "Value1");
    tmp.addBagValue("test:BagContainer", "Value2");
    tmp.addBagValue("test:BagContainer", "Value3");

    tmp.addSequenceValue("test:SeqContainer", "Value1");
    tmp.addSequenceValue("test:SeqContainer", "Value2");
    tmp.addSequenceValue("test:SeqContainer", "Value3");

    tmp
        .addProperty(new TextType(metadata, "test", "simpleProperty",
            "YEP"));

    tmp2 = new XMPSchema(metadata, "space", "http://www.space.org/schem/");
    tmp2.addSequenceValue("test:SeqSpContainer", "ValueSpace1");
    tmp2.addSequenceValue("test:SeqSpContainer", "ValueSpace2");
    tmp2.addSequenceValue("test:SeqSpContainer", "ValueSpace3");

    metadata.addSchema(tmp);
View Full Code Here

  protected XMPSchema schem;

  @Before
  public void resetDocument() throws Exception {
    parent = new XMPMetadata();
    schem = new XMPSchema(parent, "nsSchem", "nsURI");

  }
View Full Code Here

    String langAltSchem1 = "x-default";

    String valAltSchem2 = "altvalSchem2";
    String langAltSchem2 = "fr-fr";

    XMPSchema schem1 = new XMPSchema(parent, "test",
        "http://www.test.org/schem/");
    schem1.addBagValue(bagName, valBagSchem1);
    schem1.addSequenceValue(seqName, valSeqSchem1);
    schem1.setLanguagePropertyValue(altName, langAltSchem1, valAltSchem1);

    XMPSchema schem2 = new XMPSchema(parent, "test",
        "http://www.test.org/schem/");
    schem2.addBagValue(bagName, valBagSchem2);
    schem2.addSequenceValue(seqName, valSeqSchem2);
    schem2.setLanguagePropertyValue(altName, langAltSchem2, valAltSchem2);

    schem1.merge(schem2);

    // Check if all values are present
    Assert.assertEquals(valAltSchem2, schem1.getLanguagePropertyValue(
View Full Code Here

    // Check ADOBE PDF Schema
    Assert.assertEquals("PDFlib Personalization Server 7.0.2p5 (Win32)",
        metadata.getAdobePDFSchema().getProducerValue());

    // Check Defined Schema
    XMPSchema schem = metadata.getSchema("http://www.acme.com/ns/email/1/");
    Assert.assertEquals(DateConverter
        .toCalendar("2007-11-09T09:55:36+01:00"), schem
        .getDatePropertyValue("acmeemail:Delivery-Date"));
    Assert.assertNotNull(schem.getAbstractProperty(("acmeemail:From")));

    // SaveMetadataHelper.serialize(metadata, true, System.out);

  }
View Full Code Here

    // Check ADOBE PDF Schema
    Assert.assertEquals("PDFlib Personalization Server 7.0.2p5 (Win32)",
        metadata.getAdobePDFSchema().getProducerValue());

    // Check Defined Schema
    XMPSchema schem = metadata.getSchema("http://www.acme.com/ns/email/1/");
    Assert.assertEquals(DateConverter
        .toCalendar("2007-11-09T09:55:36+01:00"), schem
        .getDatePropertyValue("acmeemail:Delivery-Date"));
    Assert.assertNotNull(schem.getAbstractProperty(("acmeemail:From")));

    // SaveMetadataHelper.serialize(metadata, true, System.out);

  }
View Full Code Here

     *            The namespace URI corresponding to the schema wanted
     * @return The Class Schema representation
     */
    public XMPSchema getSchema(String nsURI) {
        Iterator<XMPSchema> it = schemas.schemas.iterator();
        XMPSchema tmp;
        while (it.hasNext()) {
            tmp = it.next();
            if (tmp.getNamespaceValue().equals(nsURI)) {
                return tmp;
            }
        }
        return null;
    }
View Full Code Here

     *            The namespace URI corresponding to the schema wanted
     * @return The Class Schema representation
     */
    public XMPSchema getSchema(String prefix, String nsURI) {
        Iterator<XMPSchema> it = getAllSchemas().iterator();
        XMPSchema tmp;
        while (it.hasNext()) {
            tmp = it.next();
            if (tmp.getNamespaceValue().equals(nsURI)
                    && tmp.getPrefix().equals(prefix)) {
                return tmp;
            }
        }
        return null;
    }
View Full Code Here

     * @param nsURI
     *            The namespace URI wanted for the schema
     * @return The schema added in order to work on it
     */
    public XMPSchema createAndAddDefaultSchema(String nsPrefix, String nsURI) {
        XMPSchema schem = new XMPSchema(this, nsPrefix, nsURI);
        schem.setAboutAsSimple("");
        addSchema(schem);
        return schem;
    }
View Full Code Here

TOP

Related Classes of org.apache.padaf.xmpbox.schema.XMPSchema

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.