/**\r
* TIFF image format.\r
* \r
- * @see http://partners.adobe.com/public/developer/tiff/index.html#spec\r
+ * @see <a href="http://partners.adobe.com/public/developer/tiff/index.html#spec">\r
+ * http://partners.adobe.com/public/developer/tiff/index.html#spec</a>\r
*/\r
public static final String IMAGE_TIFF = "image/tiff";\r
\r
/**\r
* Pict image format.\r
* \r
- * @see http://developer.apple.com/documentation/mac/QuickDraw/QuickDraw-2.html\r
+ * @see <a href="http://developer.apple.com/documentation/mac/QuickDraw/QuickDraw-2.html">\r
+ * http://developer.apple.com/documentation/mac/QuickDraw/QuickDraw-2.html</a>\r
*/\r
public static final String IMAGE_PICT = "image/pict";\r
\r
import java.util.Hashtable;\r
import java.util.concurrent.locks.ReentrantReadWriteLock;\r
\r
-import org.apache.log4j.Logger;\r
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;\r
import org.apache.poi.openxml4j.exceptions.InvalidOperationException;\r
import org.apache.poi.openxml4j.exceptions.OpenXML4JException;\r
import org.apache.poi.openxml4j.opc.internal.unmarshallers.PackagePropertiesUnmarshaller;\r
import org.apache.poi.openxml4j.opc.internal.unmarshallers.UnmarshallContext;\r
import org.apache.poi.openxml4j.util.Nullable;\r
+import org.apache.poi.util.POILogger;\r
+import org.apache.poi.util.POILogFactory;\r
\r
/**\r
* Represents a container that can store multiple data objects.\r
/**\r
* Logger.\r
*/\r
- protected static Logger logger = Logger.getLogger("org.openxml4j.opc");\r
+ private static POILogger logger = POILogFactory.getLogger(Package.class);\r
\r
/**\r
* Default package access.\r
public void close() throws IOException {\r
if (this.packageAccess == PackageAccess.READ) {\r
logger\r
- .warn("The close() method is intended to SAVE a package. This package is open in READ ONLY mode, use the revert() method instead !");\r
+ .log(POILogger.WARN, "The close() method is intended to SAVE a package. This package is open in READ ONLY mode, use the revert() method instead !");\r
return;\r
}\r
\r
}\r
} catch (OpenXML4JException e) {\r
logger\r
- .warn("Can't retrieve parts by relationship type: an exception has been thrown by getRelationshipsByType method");\r
+ .log(POILogger.WARN, "Can't retrieve parts by relationship type: an exception has been thrown by getRelationshipsByType method");\r
return null;\r
}\r
return retArr;\r
if (unmarshallPart instanceof PackagePropertiesPart)\r
this.packageProperties = (PackagePropertiesPart) unmarshallPart;\r
} catch (IOException ioe) {\r
- logger.warn("Unmarshall operation : IOException for "\r
+ logger.log(POILogger.WARN, "Unmarshall operation : IOException for "\r
+ part.partName);\r
continue;\r
} catch (InvalidOperationException invoe) {\r
* If rule M1.12 is not verified : Packages shall not contain\r
* equivalent part names and package implementers shall neither\r
* create nor recognize packages with equivalent part names.\r
- * @see {@link#createPartImpl(URI, String)}\r
+ * @see #createPartImpl(PackagePartName, String, boolean) \r
*/\r
public PackagePart createPart(PackagePartName partName, String contentType) {\r
return this.createPart(partName, contentType, true);\r
* disk\r
* \r
* @return The new part.\r
- * @see {@link #createPart(PackagePartName, String)}\r
+ * @see #createPart(PackagePartName, String)\r
*/\r
public PackagePart createPart(PackagePartName partName, String contentType,\r
ByteArrayOutputStream content) {\r
sourcePartName = PackagingURIHelper.createPartName(sourceURI);\r
} catch (InvalidFormatException e) {\r
logger\r
- .error("Part name URI '"\r
+ .log(POILogger.ERROR, "Part name URI '"\r
+ sourceURI\r
+ "' is not valid ! This message is not intended to be displayed !");\r
return;\r
this.deletePartRecursive(targetPartName);\r
}\r
} catch (InvalidFormatException e) {\r
- logger.warn("An exception occurs while deleting part '"\r
+ logger.log(POILogger.WARN, "An exception occurs while deleting part '"\r
+ partName.getName()\r
+ "'. Some parts may remain in the package. - "\r
+ e.getMessage());\r
* \r
* @return All package relationships of this package.\r
* @throws OpenXML4JException\r
- * @see {@link #getRelationshipsHelper(String)}\r
+ * @see #getRelationshipsHelper(String)\r
*/\r
public PackageRelationshipCollection getRelationships()\r
throws OpenXML4JException {\r
try {\r
partMarshallers.put(new ContentType(contentType), marshaller);\r
} catch (InvalidFormatException e) {\r
- logger.warn("The specified content type is not valid: '"\r
+ logger.log(POILogger.WARN, "The specified content type is not valid: '"\r
+ e.getMessage() + "'. The marshaller will not be added !");\r
}\r
}\r
try {\r
partUnmarshallers.put(new ContentType(contentType), unmarshaller);\r
} catch (InvalidFormatException e) {\r
- logger.warn("The specified content type is not valid: '"\r
+ logger.log(POILogger.WARN, "The specified content type is not valid: '"\r
+ e.getMessage()\r
+ "'. The unmarshaller will not be added !");\r
}\r
\r
/**\r
* Add a relationship to a part (except relationships part).\r
- * \r
+ * <p>\r
* Check rule M1.25: The Relationships part shall not have relationships to\r
* any other part. Package implementers shall enforce this requirement upon\r
* the attempt to create such a relationship and shall treat any such\r
* relationship as invalid.\r
- * \r
+ * </p>\r
* @param targetPartName\r
* Name of the target part. This one must be relative to the\r
* source root directory of the part.\r
\r
/**\r
* Add a relationship to a part (except relationships part).\r
- * \r
+ * <p>\r
* Check rule M1.25: The Relationships part shall not have relationships to\r
* any other part. Package implementers shall enforce this requirement upon\r
* the attempt to create such a relationship and shall treat any such\r
* relationship as invalid.\r
- * \r
+ * </p>\r
* @param targetURI\r
* URI of the target part. Must be relative to the source root\r
* directory of the part.\r
}\r
\r
/**\r
- * @return\r
+ * @return true if this part is a relationship\r
*/\r
public boolean isRelationshipPart() {\r
return this.isRelationshipPart;\r
}\r
\r
/**\r
- * @return\r
+ * @return true if this part has been logically deleted\r
*/\r
public boolean isDeleted() {\r
return isDeleted;\r
* @author Julien Chable\r
* @version 0.1\r
* \r
- * @see http://www.ietf.org/rfc/rfc3986.txt\r
+ * @see <a href="http://www.ietf.org/rfc/rfc3986.txt">http://www.ietf.org/rfc/rfc3986.txt</a>\r
*/\r
public final class PackagePartName implements Comparable<PackagePartName> {\r
\r
private String id;\r
\r
/**\r
- * R�f�rence vers le package.\r
+ * Reference to the package.\r
*/\r
private Package container;\r
\r
/**\r
* Constructor.\r
* \r
- * @param packageParent\r
+ * @param pkg\r
* @param sourcePart\r
* @param targetUri\r
* @param targetMode\r
\r
/**\r
* \r
- * @return\r
+ * @return URL of the source part of this relationship\r
*/\r
public URI getSourceURI() {\r
if (source == null) {\r
import java.util.Iterator;\r
import java.util.TreeMap;\r
\r
-import org.apache.log4j.Logger;\r
import org.dom4j.Attribute;\r
import org.dom4j.Document;\r
import org.dom4j.Element;\r
import org.dom4j.io.SAXReader;\r
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;\r
import org.apache.poi.openxml4j.exceptions.InvalidOperationException;\r
+import org.apache.poi.util.POILogger;\r
+import org.apache.poi.util.POILogFactory;\r
\r
/**\r
* Represents a collection of PackageRelationship elements that are owned by a\r
public final class PackageRelationshipCollection implements\r
Iterable<PackageRelationship> {\r
\r
- private static Logger logger = Logger.getLogger("org.openxml4j.opc");\r
+ private static POILogger logger = POILogFactory.getLogger(PackageRelationshipCollection.class);\r
\r
/**\r
* Package relationships ordered by ID.\r
throws InvalidFormatException {\r
try {\r
SAXReader reader = new SAXReader();\r
- logger.debug("Parsing relationship: " + relPart.getPartName());\r
+ logger.log(POILogger.DEBUG, "Parsing relationship: " + relPart.getPartName());\r
Document xmlRelationshipsDoc = reader\r
.read(relPart.getInputStream());\r
\r
\r
if (value.indexOf("\\") != -1) {\r
logger\r
- .info("target contains \\ therefore not a valid URI"\r
+ .log(POILogger.INFO, "target contains \\ therefore not a valid URI"\r
+ value + " replaced by /");\r
value = value.replaceAll("\\\\", "/");\r
// word can save external relationship with a \ instead\r
\r
target = new URI(value);\r
} catch (URISyntaxException e) {\r
- logger.error("Cannot convert " + value\r
+ logger.log(POILogger.ERROR, "Cannot convert " + value\r
+ " in a valid relationship URI-> ignored", e);\r
continue;\r
}\r
addRelationship(target, targetMode, type, id);\r
}\r
} catch (Exception e) {\r
- logger.error(e);\r
+ logger.log(POILogger.ERROR, e);\r
throw new InvalidFormatException(e.getMessage());\r
}\r
}\r
}\r
\r
/**\r
- * Combine les deux URI.\r
+ * Combine two URIs.\r
* \r
- * @param prefix\r
- * L'URI de pr�fixe.\r
- * @param suffix\r
- * L'URI de suffixe.\r
- * @return\r
+ * @param prefix the prefix URI\r
+ * @param suffix the suffix URI\r
+ *\r
+ * @return the combined URI\r
*/\r
public static URI combine(URI prefix, URI suffix) {\r
URI retUri = null;\r
URI relationshipPartUri) {\r
if (relationshipPartUri == null)\r
throw new IllegalArgumentException(\r
- "Le param�tre relationshipPartUri ne doit pas �tre null !");\r
+ "Must not be null");\r
\r
if (!isRelationshipPartURI(relationshipPartUri))\r
throw new IllegalArgumentException(\r
- "L'URI ne doit pas �tre celle d'une partie de type relation.");\r
+ "Must be a relationship part");\r
\r
if (relationshipPartUri.compareTo(PACKAGE_RELATIONSHIPS_ROOT_URI) == 0)\r
return PACKAGE_ROOT_URI;\r
/**
* Add a relationship to a part (except relationships part).
- *
+ * <p>
* Check rule M1.25: The Relationships part shall not have relationships to
* any other part. Package implementers shall enforce this requirement upon
* the attempt to create such a relationship and shall treat any such
* relationship as invalid.
- *
+ * </p>
* @param targetPartName
* Name of the target part. This one must be relative to the
* source root directory of the part.
import java.util.zip.ZipInputStream;\r
import java.util.zip.ZipOutputStream;\r
\r
-import org.apache.log4j.Logger;\r
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;\r
import org.apache.poi.openxml4j.exceptions.InvalidOperationException;\r
import org.apache.poi.openxml4j.exceptions.OpenXML4JException;\r
import org.apache.poi.openxml4j.util.ZipEntrySource;\r
import org.apache.poi.openxml4j.util.ZipFileZipEntrySource;\r
import org.apache.poi.openxml4j.util.ZipInputStreamZipEntrySource;\r
+import org.apache.poi.util.POILogger;\r
+import org.apache.poi.util.POILogFactory;\r
\r
/**\r
* Physical zip package.\r
*/\r
public final class ZipPackage extends Package {\r
\r
- private static Logger logger = Logger.getLogger("org.openxml4j");\r
+ private static POILogger logger = POILogFactory.getLogger(ZipPackage.class);\r
\r
/**\r
* Zip archive, as either a file on disk,\r
}\r
} catch (Exception e) {\r
// We assume we can continue, even in degraded mode ...\r
- logger.warn("Entry "\r
+ logger.log(POILogger.WARN,"Entry "\r
+ entry.getName()\r
+ " is not valid, so this part won't be add to the package.");\r
return null;\r
// temporary file\r
if (!tempFile.delete()) {\r
logger\r
- .warn("The temporary file: '"\r
+ .log(POILogger.WARN,"The temporary file: '"\r
+ targetFile.getAbsolutePath()\r
+ "' cannot be deleted ! Make sure that no other application use it.");\r
}\r
* current package\r
* \r
* \r
- * @see #getPart(URI)\r
+ * @see #getPart(PackageRelationship)\r
*/\r
@Override\r
protected PackagePart getPartImpl(PackagePartName partName) {\r
* The stream use to save this package.\r
* \r
* @see #save(OutputStream)\r
- * @see #saveInZip(ZipOutputStream)\r
*/\r
@Override\r
public void saveImpl(OutputStream outputStream) {\r
// we save it as well\r
if (this.getPartsByRelationshipType(\r
PackageRelationshipTypes.CORE_PROPERTIES).size() == 0) {\r
- logger.debug("Save core properties part");\r
+ logger.log(POILogger.DEBUG,"Save core properties part");\r
\r
// We have to save the core properties part ...\r
new ZipPackagePropertiesMarshaller().marshall(\r
}\r
\r
// Save package relationships part.\r
- logger.debug("Save package relationships");\r
+ logger.log(POILogger.DEBUG,"Save package relationships");\r
ZipPartMarshaller.marshallRelationshipPart(this.getRelationships(),\r
PackagingURIHelper.PACKAGE_RELATIONSHIPS_ROOT_PART_NAME,\r
zos);\r
\r
// Save content type part.\r
- logger.debug("Save content types part");\r
+ logger.log(POILogger.DEBUG,"Save content types part");\r
this.contentTypeManager.save(zos);\r
\r
// Save parts.\r
if (part.isRelationshipPart())\r
continue;\r
\r
- logger.debug("Save part '"\r
+ logger.log(POILogger.DEBUG,"Save part '"\r
+ ZipHelper.getZipItemNameFromOPCName(part\r
.getPartName().getName()) + "'");\r
PartMarshaller marshaller = partMarshallers\r
zos.close();\r
} catch (Exception e) {\r
logger\r
- .error("Fail to save: an error occurs while saving the package : "\r
+ .log(POILogger.ERROR,"Fail to save: an error occurs while saving the package : "\r
+ e.getMessage());\r
}\r
}\r
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;\r
\r
/**\r
- * Represents a immutable MIME ContentType value (RFC 2616 �3.7)\r
- * \r
+ * Represents a immutable MIME ContentType value (RFC 2616 §3.7)\r
+ * <p>\r
* media-type = type "/" subtype *( ";" parameter ) type = token<br>\r
* subtype = token<br>\r
- * \r
+ * </p><p>\r
* Rule M1.13 : Package implementers shall only create and only recognize parts\r
* with a content type; format designers shall specify a content type for each\r
* part included in the format. Content types for package parts shall fit the\r
- * definition and syntax for media types as specified in RFC 2616,��3.7.\r
- * \r
+ * definition and syntax for media types as specified in RFC 2616, \§3.7.\r
+ * </p><p>\r
* Rule M1.14: Content types shall not use linear white space either between the\r
* type and subtype or between an attribute and its value. Content types also\r
* shall not have leading or trailing white spaces. Package implementers shall\r
* create only such content types and shall require such content types when\r
* retrieving a part from a package; format designers shall specify only such\r
* content types for inclusion in the format.\r
- * \r
+ * </p>\r
* @author Julien Chable\r
* @version 0.1\r
* \r
- * @see http://www.ietf.org/rfc/rfc2045.txt\r
- * @see http://www.ietf.org/rfc/rfc2616.txt\r
+ * @see <a href="http://www.ietf.org/rfc/rfc2045.txt">http://www.ietf.org/rfc/rfc2045.txt</a>\r
+ * @see <a href="http://www.ietf.org/rfc/rfc2616.txt">http://www.ietf.org/rfc/rfc2616.txt</a>\r
*/\r
public final class ContentType {\r
\r
import java.util.Map.Entry;\r
import java.util.zip.ZipOutputStream;\r
\r
-import org.apache.log4j.Logger;\r
import org.dom4j.Document;\r
import org.dom4j.DocumentException;\r
import org.dom4j.DocumentHelper;\r
import org.apache.poi.openxml4j.opc.PackagePart;\r
import org.apache.poi.openxml4j.opc.PackagePartName;\r
import org.apache.poi.openxml4j.opc.PackagingURIHelper;\r
+import org.apache.poi.util.POILogger;\r
+import org.apache.poi.util.POILogFactory;\r
\r
/**\r
* Manage package content types ([Content_Types].xml part).\r
*/\r
public abstract class ContentTypeManager {\r
\r
- protected static Logger logger = Logger.getLogger("org.openxml4j");\r
+ private static POILogger logger = POILogFactory.getLogger(ContentTypeManager.class);\r
\r
/**\r
* Reference to the package using this content type manager.\r
/**\r
* Constructor. Parses the content of the specified input stream.\r
* \r
- * @param archive\r
+ * @param in\r
* If different of <i>null</i> then the content types part is\r
* retrieve and parse.\r
* @throws InvalidFormatException\r
/**\r
* Build association extention-> content type (will be stored in\r
* [Content_Types].xml) for example ContentType="image/png" Extension="png"\r
- * \r
+ * <p>\r
* [M2.8]: When adding a new part to a package, the package implementer\r
* shall ensure that a content type for that part is specified in the\r
* Content Types stream; the package implementer shall perform the steps\r
- * described in��9.1.2.3:\r
- * \r
+ * described in §9.1.2.3:\r
+ * </p><p>\r
* 1. Get the extension from the part name by taking the substring to the\r
* right of the rightmost occurrence of the dot character (.) from the\r
* rightmost segment.\r
- * \r
+ * </p><p>\r
* 2. If a part name has no extension, a corresponding Override element\r
* shall be added to the Content Types stream.\r
- * \r
+ * </p><p>\r
* 3. Compare the resulting extension with the values specified for the\r
* Extension attributes of the Default elements in the Content Types stream.\r
* The comparison shall be case-insensitive ASCII.\r
- * \r
+ * </p><p>\r
* 4. If there is a Default element with a matching Extension attribute,\r
* then the content type of the new part shall be compared with the value of\r
* the ContentType attribute. The comparison might be case-sensitive and\r
* include every character regardless of the role it plays in the\r
* content-type grammar of RFC 2616, or it might follow the grammar of RFC\r
* 2616.\r
- * \r
+ * </p><p>\r
* a. If the content types match, no further action is required.\r
- * \r
+ * </p><p>\r
* b. If the content types do not match, a new Override element shall be\r
* added to the Content Types stream. .\r
- * \r
+ * </p><p>\r
* 5. If there is no Default element with a matching Extension attribute, a\r
* new Default element or Override element shall be added to the Content\r
* Types stream.\r
- * \r
- * \r
- * @param partUri\r
- * the uri that will be stored\r
- * @return <b>false</b> if an error occured.\r
+ * </p>\r
*/\r
public void addContentType(PackagePartName partName, String contentType) {\r
boolean defaultCTExists = false;\r
}\r
\r
/**\r
+ * <p>\r
* Delete a content type based on the specified part name. If the specified\r
* part name is register with an override content type, then this content\r
* type is remove, else the content type is remove in the default content\r
* type list if it exists and if no part is associated with it yet.\r
- * \r
+ * </p><p>\r
* Check rule M2.4: The package implementer shall require that the Content\r
* Types stream contain one of the following for every part in the package:\r
* One matching Default element One matching Override element Both a\r
* matching Default element and a matching Override element, in which case\r
* the Override element takes precedence.\r
- * \r
- * @param partUri\r
+ * </p>\r
+ * @param partName\r
* The part URI associated with the override content type to\r
* delete.\r
* @exception InvalidOperationException\r
\r
/**\r
* Get the content type for the specified part, if any.\r
- * \r
+ * <p>\r
* Rule [M2.9]: To get the content type of a part, the package implementer\r
- * shall perform the steps described in��9.1.2.4:\r
- * \r
+ * shall perform the steps described in §9.1.2.4:\r
+ * </p><p>\r
* 1. Compare the part name with the values specified for the PartName\r
* attribute of the Override elements. The comparison shall be\r
* case-insensitive ASCII.\r
- * \r
+ * </p><p>\r
* 2. If there is an Override element with a matching PartName attribute,\r
* return the value of its ContentType attribute. No further action is\r
* required.\r
- * \r
+ * </p><p>\r
* 3. If there is no Override element with a matching PartName attribute,\r
* then a. Get the extension from the part name by taking the substring to\r
* the right of the rightmost occurrence of the dot character (.) from the\r
* rightmost segment. b. Check the Default elements of the Content Types\r
* stream, comparing the extension with the value of the Extension\r
* attribute. The comparison shall be case-insensitive ASCII.\r
- * \r
+ * </p><p>\r
* 4. If there is a Default element with a matching Extension attribute,\r
* return the value of its ContentType attribute. No further action is\r
* required.\r
- * \r
+ * </p><p>\r
* 5. If neither Override nor Default elements with matching attributes are\r
* found for the specified part name, the implementation shall not map this\r
* part name to a part.\r
- * \r
- * @param partUri\r
+ * </p>\r
+ * @param partName\r
* The URI part to check.\r
* @return The content type associated with the URI (in case of an override\r
* content type) or the extension (in case of default content type),\r
* XML parent element use to append this override type element.\r
* @param entry\r
* The values to append.\r
- * @see #save(ZipOutputStream)\r
+ * @see #save(java.io.OutputStream)\r
*/\r
private void appendSpecificTypes(Element root,\r
Entry<PackagePartName, String> entry) {\r
* XML parent element use to append this default type element.\r
* @param entry\r
* The values to append.\r
- * @see #save(ZipOutputStream)\r
+ * @see #save(java.io.OutputStream)\r
*/\r
private void appendDefaultType(Element root, Entry<String, String> entry) {\r
root.addElement(DEFAULT_TAG_NAME).addAttribute(\r
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;\r
import org.apache.poi.openxml4j.opc.Package;\r
import org.apache.poi.openxml4j.opc.StreamHelper;\r
+import org.apache.poi.util.POILogger;\r
+import org.apache.poi.util.POILogFactory;\r
\r
/**\r
* Zip implementation of the ContentTypeManager.\r
* @see ContentTypeManager\r
*/\r
public class ZipContentTypeManager extends ContentTypeManager {\r
+ private static POILogger logger = POILogFactory.getLogger(ZipContentTypeManager.class);\r
\r
/**\r
* Delegate constructor to the super constructor.\r
}\r
zos.closeEntry();\r
} catch (IOException ioe) {\r
- logger.error("Cannot write: " + CONTENT_TYPES_PART_NAME\r
+ logger.log(POILogger.ERROR, "Cannot write: " + CONTENT_TYPES_PART_NAME\r
+ " in Zip !", ioe);\r
return false;\r
}\r
import java.util.zip.ZipEntry;\r
import java.util.zip.ZipOutputStream;\r
\r
-import org.apache.log4j.Logger;\r
import org.dom4j.Document;\r
import org.dom4j.DocumentHelper;\r
import org.dom4j.Element;\r
import org.apache.poi.openxml4j.opc.TargetMode;\r
import org.apache.poi.openxml4j.opc.internal.PartMarshaller;\r
import org.apache.poi.openxml4j.opc.internal.ZipHelper;\r
+import org.apache.poi.util.POILogger;\r
+import org.apache.poi.util.POILogFactory;\r
\r
/**\r
* Zip part marshaller. This marshaller is use to save any part in a zip stream.\r
* @version 0.1\r
*/\r
public class ZipPartMarshaller implements PartMarshaller {\r
- private static Logger logger = Logger.getLogger("org.openxml4j");\r
+ private static POILogger logger = POILogFactory.getLogger(ZipPartMarshaller.class);\r
\r
/**\r
* Save the specified part.\r
public boolean marshall(PackagePart part, OutputStream os)\r
throws OpenXML4JException {\r
if (!(os instanceof ZipOutputStream)) {\r
- logger.error("Unexpected class " + os.getClass().getName());\r
+ logger.log(POILogger.ERROR,"Unexpected class " + os.getClass().getName());\r
throw new OpenXML4JException("ZipOutputStream expected !");\r
// Normally should happen only in developpement phase, so just throw\r
// exception\r
}\r
zos.closeEntry();\r
} catch (IOException ioe) {\r
- logger.error("Cannot write: " + part.getPartName() + ": in ZIP",\r
+ logger.log(POILogger.ERROR,"Cannot write: " + part.getPartName() + ": in ZIP",\r
ioe);\r
return false;\r
}\r
* \r
* @param rels\r
* The relationships collection to marshall.\r
- * @param relPartURI\r
+ * @param relPartName\r
* Part name of the relationship part to marshall.\r
* @param zos\r
* Zip output stream in which to save the XML content of the\r
.getSourcePartUriFromRelationshipPartUri(relPartName.getURI());\r
\r
for (PackageRelationship rel : rels) {\r
- // L'�l�ment de la relation\r
+ // the relationship element\r
Element relElem = root\r
.addElement(PackageRelationship.RELATIONSHIP_TAG_NAME);\r
\r
- // L'attribut ID\r
+ // the relationship ID\r
relElem.addAttribute(PackageRelationship.ID_ATTRIBUTE_NAME, rel\r
.getId());\r
\r
- // L'attribut Type\r
+ // the relationship Type\r
relElem.addAttribute(PackageRelationship.TYPE_ATTRIBUTE_NAME, rel\r
.getRelationshipType());\r
\r
- // L'attribut Target\r
+ // the relationship Target\r
String targetValue;\r
URI uri = rel.getTargetURI();\r
if (rel.getTargetMode() == TargetMode.EXTERNAL) {\r
// alter it etc\r
targetValue = uri.toString();\r
\r
- // add TargetMode attribut (as it is external link external)\r
+ // add TargetMode attribute (as it is external link external)\r
relElem.addAttribute(\r
PackageRelationship.TARGET_MODE_ATTRIBUTE_NAME,\r
"External");\r
ZipEntry ctEntry = new ZipEntry(ZipHelper.getZipURIFromOPCName(\r
relPartName.getURI().toASCIIString()).getPath());\r
try {\r
- // Cr�ation de l'entr�e dans le fichier ZIP\r
zos.putNextEntry(ctEntry);\r
if (!StreamHelper.saveXmlInStream(xmlOutDoc, zos)) {\r
return false;\r
}\r
zos.closeEntry();\r
} catch (IOException e) {\r
- logger.error("Cannot create zip entry " + relPartName, e);\r
+ logger.log(POILogger.ERROR,"Cannot create zip entry " + relPartName, e);\r
return false;\r
}\r
return true; // success\r
return false;\r
}\r
\r
- // TODO Introduire le concept de partie typ�e d�s cette partie\r
}\r
\r
/**\r
* Check the element for the following OPC compliance rules:\r
- * \r
+ * <p>\r
* Rule M4.2: A format consumer shall consider the use of the Markup\r
* Compatibility namespace to be an error.\r
- * \r
+ * </p><p>\r
* Rule M4.3: Producers shall not create a document element that contains\r
* refinements to the Dublin Core elements, except for the two specified in\r
* the schema: <dcterms:created> and <dcterms:modified> Consumers shall\r
* consider a document element that violates this constraint to be an error.\r
- * \r
+ * </p><p>\r
* Rule M4.4: Producers shall not create a document element that contains\r
* the xml:lang attribute. Consumers shall consider a document element that\r
* violates this constraint to be an error.\r
- * \r
+ * </p><p>\r
* Rule M4.5: Producers shall not create a document element that contains\r
* the xsi:type attribute, except for a <dcterms:created> or\r
* <dcterms:modified> element where the xsi:type attribute shall be present\r
* and shall hold the value dcterms:W3CDTF, where dcterms is the namespace\r
* prefix of the Dublin Core namespace. Consumers shall consider a document\r
* element that violates this constraint to be an error.\r
+ * </p>\r
*/\r
public void checkElementForOPCCompliance(Element el)\r
throws InvalidFormatException {\r
/**\r
* Get the store value if any.\r
* \r
- * @return\r
+ * @return the store value\r
*/\r
public E getValue() {\r
return value;\r
* recognize parts with a content type; format designers shall specify a\r
* content type for each part included in the format. Content types for\r
* package parts shall fit the definition and syntax for media types as\r
- * specified in RFC 2616, §3.7.\r
+ * specified in RFC 2616, \u00A73.7.\r
*/\r
public void testContentTypeValidation() throws InvalidFormatException {\r
String[] contentTypesToTest = new String[] { "text/xml",\r
* recognize parts with a content type; format designers shall specify a\r
* content type for each part included in the format. Content types for\r
* package parts shall fit the definition and syntax for media types as\r
- * specified in RFC 2616, §3.7.\r
+ * specified in RFC 2616, \u00A3.7.\r
* \r
* Check rule M1.14: Content types shall not use linear white space either\r
* between the type and subtype or between an attribute and its value.\r