~ubuntu-branches/ubuntu/karmic/batik/karmic

« back to all changes in this revision

Viewing changes to sources/org/apache/batik/dom/svg/XMLBaseSupport.java

  • Committer: Bazaar Package Importer
  • Author(s): Matvey Kozhev, Onkar Shinde, Matvey Kozhev
  • Date: 2008-07-19 01:03:05 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20080719010305-0b24skqy185kdsb9
Tags: 1.7.dfsg-0ubuntu1
[ Onkar Shinde ]
* New upstream version (LP: #147818)
* debian/control
  - Add Sun JDK 1.5 as build dependency. Fixes FTBFS on buildd. (LP: #150484)
    Also add Sun JRE as runtime dependencies.
  - Add ant-optional as build dependency.
  - Add libxml-commons-external-java and libxmlgraphics-commons-java as
    build and runtime dependencies.
  - Add 'Homepage' field and correct the url.
  - Change standards version to 3.8.0.
  - Modify Maintainer value to match the DebianMaintainerField
    specification.
* debian/rules
  - Change JAVA_HOME_DIRS for Sun JDK.
  - Add jar file names to DEB_JARS to match new build requirements.
  - Extract version from changelog.
  - Delete bundled jar files in clean target.
  - Don't use hardcoded version in install target.
  - Add get-orig-source target.
* debian/README.Debian-source
  - Change the fo tag name to the one used for this version.
* debian/watch
  - Change expression to match src distribution.
* debian/patches/
  - 01_build_xml.patch, 02_fix_jar_target.patch - Refresh for current source.
  - 03_fix_lib_dirs.patch - Fix the library and classpath references needed
    for pdf transcoder build.
  - 04_fix_transcoder_pkg.patch - Fix transcoder-pkg target to not copy
    files from other jar files.

[ Matvey Kozhev ]
* debian/changelog:
  - Added ".dfsg" to version.
* debian/control, debian/rules:
  - Build with openjdk-6-jdk, depend on openjdk-6-jre.
  - Added java-6-sun as an alternate build JAVA_HOME directory.
  - Fixed get-orig-source to not include debian/ and delete the source dir,
    and made it delete jars from lib/, as done in the current batik package.
* debian/wrappers.sh:
  - Changed java-7-icedtea reference to java-6-openjdk, as the former has been
    removed back in Hardy.
  - Added newline.
* debian/libbatik-java.install:
  - Added newline.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 
3
 
   Copyright 1999-2003  The Apache Software Foundation 
4
 
 
5
 
   Licensed under the Apache License, Version 2.0 (the "License");
6
 
   you may not use this file except in compliance with the License.
7
 
   You may obtain a copy of the License at
8
 
 
9
 
       http://www.apache.org/licenses/LICENSE-2.0
10
 
 
11
 
   Unless required by applicable law or agreed to in writing, software
12
 
   distributed under the License is distributed on an "AS IS" BASIS,
13
 
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 
   See the License for the specific language governing permissions and
15
 
   limitations under the License.
16
 
 
17
 
*/
18
 
 
19
 
package org.apache.batik.dom.svg;
20
 
 
21
 
import java.net.URL;
22
 
 
23
 
import org.apache.batik.css.engine.CSSImportedElementRoot;
24
 
import org.apache.batik.util.ParsedURL;
25
 
import org.apache.batik.util.XMLConstants;
26
 
import org.w3c.dom.Attr;
27
 
import org.w3c.dom.Element;
28
 
import org.w3c.dom.Node;
29
 
 
30
 
/**
31
 
 * This class provides support for the xml:base attribute.
32
 
 *
33
 
 * @author <a href="mailto:Thomas.DeWeeese@Kodak.com">Thomas DeWeese</a>
34
 
 * @version $Id: XMLBaseSupport.java,v 1.6 2004/10/30 18:38:04 deweese Exp $
35
 
 */
36
 
public class XMLBaseSupport implements XMLConstants {
37
 
    
38
 
    /**
39
 
     * This class does not need to be instanciated.
40
 
     */
41
 
    protected XMLBaseSupport() {
42
 
    }
43
 
 
44
 
    /**
45
 
     * Returns the xml:base attribute value of the given element.
46
 
     */
47
 
    public static String getXMLBase(Element elt) {
48
 
        return elt.getAttributeNS(XML_NAMESPACE_URI, "base");
49
 
    }
50
 
 
51
 
    /**
52
 
     * Returns the xml:base attribute value of the given element
53
 
     * Resolving any dependency on parent bases if needed.
54
 
     */
55
 
    public static String getCascadedXMLBase(Element elt) {
56
 
        String base = null;
57
 
        Node n = elt.getParentNode();
58
 
        while (n != null) {
59
 
            if (n.getNodeType() == Node.ELEMENT_NODE) {
60
 
                base = getCascadedXMLBase((Element)n);
61
 
                break;
62
 
            }
63
 
            if (n instanceof CSSImportedElementRoot) {
64
 
                n = ((CSSImportedElementRoot)n).getCSSParentElement();
65
 
            } else {
66
 
                n = n.getParentNode();
67
 
            }
68
 
        }
69
 
        if (base == null) {
70
 
            SVGOMDocument svgDoc;
71
 
            svgDoc = (SVGOMDocument)elt.getOwnerDocument();
72
 
            URL url = svgDoc.getURLObject();
73
 
            if (url != null) {
74
 
                base = url.toString();
75
 
            }
76
 
        }
77
 
        Attr attr = elt.getAttributeNodeNS(XML_NAMESPACE_URI, "base");
78
 
        if (attr != null) {
79
 
            if (base == null) {
80
 
                base = attr.getNodeValue();
81
 
            } else {
82
 
                base = new ParsedURL(base, attr.getNodeValue()).toString();
83
 
            }
84
 
        }
85
 
        return base;
86
 
    }
87
 
 
88
 
}