Iterate through the underlying PackagePart and create child POIXMLFactory instances using the specified factory @param factory the factory object that creates POIXMLFactory instances @param context context map containing already visited noted keyed by targetURI
(POIXMLFactory factory, Map<PackagePart, POIXMLDocumentPart> context)
| 253 | * @param context context map containing already visited noted keyed by targetURI |
| 254 | */ |
| 255 | protected void read(POIXMLFactory factory, Map<PackagePart, POIXMLDocumentPart> context) throws OpenXML4JException { |
| 256 | PackageRelationshipCollection rels = packagePart.getRelationships(); |
| 257 | for (PackageRelationship rel : rels) { |
| 258 | if(rel.getTargetMode() == TargetMode.INTERNAL){ |
| 259 | URI uri = rel.getTargetURI(); |
| 260 | |
| 261 | PackagePart p; |
| 262 | if(uri.getRawFragment() != null) { |
| 263 | /* |
| 264 | * For internal references (e.g. '#Sheet1!A1') the package part is null |
| 265 | */ |
| 266 | p = null; |
| 267 | } else { |
| 268 | PackagePartName relName = PackagingURIHelper.createPartName(uri); |
| 269 | p = packagePart.getPackage().getPart(relName); |
| 270 | if(p == null) { |
| 271 | logger.log(POILogger.ERROR, "Skipped invalid entry " + rel.getTargetURI()); |
| 272 | continue; |
| 273 | } |
| 274 | } |
| 275 | |
| 276 | if (!context.containsKey(p)) { |
| 277 | POIXMLDocumentPart childPart = factory.createDocumentPart(rel, p); |
| 278 | childPart.parent = this; |
| 279 | addRelation(childPart); |
| 280 | if(p != null){ |
| 281 | context.put(p, childPart); |
| 282 | if(p.hasRelationships()) childPart.read(factory, context); |
| 283 | } |
| 284 | } |
| 285 | else { |
| 286 | addRelation(context.get(p)); |
| 287 | } |
| 288 | } |
| 289 | } |
| 290 | } |
| 291 | |
| 292 | /** |
| 293 | * Fired when a new package part is created |
nothing calls this directly
no test coverage detected