2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 package org
.libreoffice
.report
.pentaho
.parser
;
20 import org
.jfree
.report
.structure
.Element
;
22 import org
.pentaho
.reporting
.libraries
.xmlns
.parser
.AbstractXmlReadHandler
;
24 import org
.xml
.sax
.Attributes
;
25 import org
.xml
.sax
.SAXException
;
28 * Creation-Date: 03.07.2006, 14:22:34
31 public abstract class ElementReadHandler
extends AbstractXmlReadHandler
37 * @param attrs the attributes.
38 * @throws org.xml.sax.SAXException if there is a parsing error.
41 protected void startParsing(final Attributes attrs
) throws SAXException
43 final Element element
= getElement();
44 copyElementType(element
);
45 copyAttributes(attrs
, element
);
48 protected void copyElementType(final Element element
)
50 element
.setType(getTagName());
51 element
.setNamespace(getUri());
54 protected void copyAttributes(final Attributes attrs
, final Element element
)
56 final int length
= attrs
.getLength();
57 for (int i
= 0; i
< length
; i
++)
59 final String value
= attrs
.getValue(i
);
60 final String namespace
= attrs
.getURI(i
);
61 final String attr
= attrs
.getLocalName(i
);
62 element
.setAttribute(namespace
, attr
, value
);
67 * Returns the object for this element or null, if this element does not
72 public Object
getObject() throws SAXException
77 public abstract Element
getElement();