/** * Return the schema corresponding to this nsURI and a prefix. * * <p>This method is here to treat metadata which embed more than one time the same schema. It * permits to retrieve a specific schema with its prefix * * @param prefix The prefix fixed in the schema wanted * @param nsURI 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.getNamespace().equals(nsURI) && tmp.getPrefix().equals(prefix)) { return tmp; } } return null; }
/** * Get the XMPSchema for the specified namespace. * * <p>Return the schema corresponding to this nsURI<br> * BE CAREFUL: typically, Metadata should contain one schema for each type. This method returns * the first schema encountered corresponding to this NSURI.<br> * Return null if unknown * * @param nsURI The namespace URI corresponding to the schema wanted * @return The matching XMP schema representation */ public XMPSchema getSchema(String nsURI) { Iterator<XMPSchema> it = schemas.iterator(); XMPSchema tmp; while (it.hasNext()) { tmp = it.next(); if (tmp.getNamespace().equals(nsURI)) { return tmp; } } return null; }
/** * Create and add an unspecified schema. * * @param nsPrefix The prefix wanted for the schema * @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, nsURI, nsPrefix); schem.setAboutAsSimple(""); addSchema(schem); return schem; }