xsddoc/src/net/sf/xframe/xsddoc/util DomUtil.java,1.1,1.2 FileUtil.java,1.4,1.5

Kurt Riede <[email protected]>
Newsgroups gmane.text.xml.xframe.xsddoc.devel
Message-ID <[email protected]>
Update of /cvsroot/xframe/xsddoc/src/net/sf/xframe/xsddoc/util
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2381/src/net/sf/xframe/xsddoc/util

Modified Files:
	DomUtil.java FileUtil.java 
Log Message:
some unifications

Index: FileUtil.java
===================================================================
RCS file: /cvsroot/xframe/xsddoc/src/net/sf/xframe/xsddoc/util/FileUtil.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** FileUtil.java	27 Mar 2004 21:14:50 -0000	1.4
--- FileUtil.java	30 Aug 2004 07:11:57 -0000	1.5
***************
*** 37,40 ****
--- 37,43 ----
      private static final int COPY_BUFFER_SIZE = 8192;
  
+     /** file separator from <code>File.separator</code>. */
+     private static final String FILE_SEP = File.separator;
+ 
      /**
       * Private default constructor to prevent instantiation.
***************
*** 91,93 ****
--- 94,116 ----
          copyFile(in, new File(destFile));
      }
+ 
+     /**
+      * Returns the location of a file relative to a base file.
+      *
+      * @param baseFile the base file
+      * @param file the file to be resolved
+      * @return resolved location
+      */
+     public static String getLocation(final String baseFile, final String file) {
+         if (baseFile == null || file.indexOf(':') > 0) {
+             return file;
+         } else {
+             final String parent = new File(baseFile).getParent();
+             if (parent == null) {
+                 return file;
+             } else {
+                 return parent + FILE_SEP + file;
+             }
+         }
+     }
  }

Index: DomUtil.java
===================================================================
RCS file: /cvsroot/xframe/xsddoc/src/net/sf/xframe/xsddoc/util/DomUtil.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** DomUtil.java	16 Jun 2004 14:35:03 -0000	1.1
--- DomUtil.java	30 Aug 2004 07:11:57 -0000	1.2
***************
*** 59,68 ****
       *
       * @param node an element node
!      * @param attributeName the name of an attribute
       * @return the attributes value or <code>null</code> if the attribute doesn't exist.
       */
!     public static String getAttributeValue(final Node node, final String attributeName) {
          try {
!             return node.getAttributes().getNamedItem(attributeName).getNodeValue();
          } catch (NullPointerException e) {
              return null;
--- 59,68 ----
       *
       * @param node an element node
!      * @param name the name of an attribute
       * @return the attributes value or <code>null</code> if the attribute doesn't exist.
       */
!     public static String getAttributeValue(final Node node, final String name) {
          try {
!             return node.getAttributes().getNamedItem(name).getNodeValue();
          } catch (NullPointerException e) {
              return null;



-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.