xsddoc/src/net/sf/xframe/xsddoc Task.java,1.22,1.23

Kurt Riede <[email protected]> Fri, 30 Sep 2005 17:54:14 +0000
Newsgroups gmane.text.xml.xframe.xsddoc.devel
Message-ID <[email protected]>
Update of /cvsroot/xframe/xsddoc/src/net/sf/xframe/xsddoc
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20843/src/net/sf/xframe/xsddoc

Modified Files:
	Task.java 
Log Message:
fixes for the following bugs:
[1228808] Question about ant task when using FileSets
[1307377] Correction for Task.java to address FileSet issues

Index: Task.java
===================================================================
RCS file: /cvsroot/xframe/xsddoc/src/net/sf/xframe/xsddoc/Task.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** Task.java	22 Apr 2005 14:46:08 -0000	1.22
--- Task.java	30 Sep 2005 17:54:12 -0000	1.23
***************
*** 265,268 ****
--- 265,269 ----
          try {
              final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+             factory.setNamespaceAware(true);
              builder = factory.newDocumentBuilder();
              return builder;
***************
*** 300,306 ****
       */
      private void addSchema(final Document mediatorSchema, final String base, final String schemaLocation) {
!         String namespace = null;
!         namespace = getNamespace(base, schemaLocation);
!         if (namespace == null) {
              if (debug) {
                  System.out.println("Seems not to be a schema, ignoring " + schemaLocation);
--- 301,307 ----
       */
      private void addSchema(final Document mediatorSchema, final String base, final String schemaLocation) {
!         String targetNamespace = null;
!         targetNamespace = getTargetNamespace(base, schemaLocation);
!         if (targetNamespace == null) {
              if (debug) {
                  System.out.println("Seems not to be a schema, ignoring " + schemaLocation);
***************
*** 327,331 ****
          }
          importNode.setAttribute("schemaLocation", schemaLoc);
!         importNode.setAttribute("namespace", namespace);
          mediatorSchema.getDocumentElement().appendChild(importNode);
      }
--- 328,332 ----
          }
          importNode.setAttribute("schemaLocation", schemaLoc);
!         importNode.setAttribute("namespace", targetNamespace);
          mediatorSchema.getDocumentElement().appendChild(importNode);
      }
***************
*** 341,351 ****
       * @return target namespace of schema or <tt>null</tt> if the document is not a schema
       */
!     private String getNamespace(final String base, final String filename) {
          try {
              final Document schema = getDocumentBuilder().parse(new File(base, filename));
              final Element root = schema.getDocumentElement();
-             if (!root.getLocalName().equals("schema") || !root.getNamespaceURI().equals(Task.SCHEMA_NS)) {
-                 return null;
-             }
              return root.getAttribute("targetNamespace");
          } catch (Exception e) {
--- 342,349 ----
       * @return target namespace of schema or <tt>null</tt> if the document is not a schema
       */
!     private String getTargetNamespace(final String base, final String filename) {
          try {
              final Document schema = getDocumentBuilder().parse(new File(base, filename));
              final Element root = schema.getDocumentElement();
              return root.getAttribute("targetNamespace");
          } catch (Exception e) {



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl