public void startElement()

in fop-core/src/main/java/org/apache/fop/render/pdf/extensions/PDFExtensionHandler.java [61:158]


    public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
        if (PDFExtensionAttachment.CATEGORY.equals(uri)) {
            if (localName.equals(PDFEmbeddedFileAttachment.ELEMENT)) {
                lastAttributes = new AttributesImpl(attributes);
            } else if (PDFDictionaryType.Action.elementName().equals(localName)) {
                PDFActionExtension action = new PDFActionExtension();
                String id = attributes.getValue(PDFDictionaryElement.ATT_ID);
                if (id != null) {
                    action.setProperty(PDFDictionaryExtension.PROPERTY_ID, id);
                }
                String type = attributes.getValue(PDFActionElement.ATT_TYPE);
                if (type != null) {
                    action.setProperty(PDFActionExtension.PROPERTY_TYPE, type);
                }
                collections.push(action);
            } else if (PDFObjectType.Array.elementName().equals(localName)) {
                PDFArrayExtension array = new PDFArrayExtension();
                String key = attributes.getValue(PDFCollectionEntryElement.ATT_KEY);
                if (key != null) {
                    array.setKey(key);
                }
                collections.push(array);
            } else if (PDFDictionaryType.Catalog.elementName().equals(localName)) {
                PDFCatalogExtension catalog = new PDFCatalogExtension();
                collections.push(catalog);
            } else if (PDFDictionaryType.Dictionary.elementName().equals(localName)) {
                PDFDictionaryExtension dictionary = new PDFDictionaryExtension();
                String key = attributes.getValue(PDFCollectionEntryElement.ATT_KEY);
                if (key != null) {
                    dictionary.setKey(key);
                }
                collections.push(dictionary);
            } else if (PDFDictionaryType.Layer.elementName().equals(localName)) {
                PDFLayerExtension layer = new PDFLayerExtension();
                String id = attributes.getValue(PDFDictionaryElement.ATT_ID);
                if (id != null) {
                    layer.setProperty(PDFDictionaryExtension.PROPERTY_ID, id);
                }
                collections.push(layer);
            } else if (PDFDictionaryType.Navigator.elementName().equals(localName)) {
                PDFNavigatorExtension navigator = new PDFNavigatorExtension();
                String id = attributes.getValue(PDFDictionaryElement.ATT_ID);
                if (id != null) {
                    navigator.setProperty(PDFDictionaryExtension.PROPERTY_ID, id);
                }
                collections.push(navigator);
            } else if (PDFDictionaryType.Page.elementName().equals(localName)) {
                PDFPageExtension page = new PDFPageExtension();
                String pageNumbers = attributes.getValue(PDFPageElement.ATT_PAGE_NUMBERS);
                if (pageNumbers != null) {
                    page.setProperty(PDFPageExtension.PROPERTY_PAGE_NUMBERS, pageNumbers);
                }
                collections.push(page);
            } else if (PDFDictionaryType.Info.elementName().equals(localName)) {
                PDFDocumentInformationExtension info = new PDFDocumentInformationExtension();
                collections.push(info);
            } else if (PDFDictionaryType.VT.elementName().equals(localName)) {
                PDFVTExtension dictionary = new PDFVTExtension();
                collections.push(dictionary);
            } else if (PDFDictionaryType.PagePiece.elementName().equals(localName)) {
                PDFPagePieceExtension dictionary = new PDFPagePieceExtension();
                collections.push(dictionary);
            } else if (PDFObjectType.hasValueOfElementName(localName)) {
                PDFCollectionEntryExtension entry;
                if (PDFObjectType.Reference.elementName().equals(localName)) {
                    entry = new PDFReferenceExtension();
                } else {
                    entry = new PDFCollectionEntryExtension(PDFObjectType.valueOfElementName(localName));
                }
                String key = attributes.getValue(PDFCollectionEntryElement.ATT_KEY);
                if (key != null) {
                    entry.setKey(key);
                }
                if (entry instanceof PDFReferenceExtension) {
                    String refid = attributes.getValue(PDFReferenceElement.ATT_REFID);
                    if (refid != null) {
                        ((PDFReferenceExtension) entry).setReferenceId(refid);
                    }
                }
                if (!collections.empty()) {
                    PDFCollectionExtension collection = collections.peek();
                    collection.addEntry(entry);
                    if (!(entry instanceof PDFReferenceExtension)) {
                        captureContent = true;
                    }
                }
            } else {
                throw new SAXException("Unhandled element " + localName + " in namespace: " + uri);
            }
        } else if (XMPConstants.XMP_NAMESPACE.equals(uri) || xmpHandler != null) {
            if (xmpHandler == null) {
                xmpHandler = (XMPHandler) new XMPContentHandlerFactory().createContentHandler();
            }
            xmpHandler.startElement(uri, localName, qName, attributes);
        } else {
            log.warn("Unhandled element " + localName + " in namespace: " + uri);
        }
    }