scheu 02/03/18 14:37:34 Modified: java/src/org/apache/axis/wsdl/toJava JavaDeployWriter.java JavaStubWriter.java JavaWriterFactory.java SymbolTable.java Utils.java Log: Following changes are made ...and will soon be put into Beta1. 1) Changed anon separator from . to > 2) Changed deploy/stub writers to register the correct qname for an anonType of a root element. 3) Code changes to make sure isOnlyLiteralReference is set properly in the anon type. Revision Changes Path 1.27 +12 -2 xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaDeployWriter.java Index: JavaDeployWriter.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaDeployWriter.java,v retrieving revision 1.26 retrieving revision 1.27 diff -u -r1.26 -r1.27 --- JavaDeployWriter.java 13 Mar 2002 15:19:26 -0000 1.26 +++ JavaDeployWriter.java 18 Mar 2002 22:37:34 -0000 1.27 @@ -169,10 +169,20 @@ process = false; } + // If a root Element named Foo has an anon type, the + // anon type is named ">Foo". The following hack + // uses the name "Foo" so that the right qname gets + // registered. + String localPart = type.getQName().getLocalPart(); + if (localPart.startsWith(SymbolTable.ANON_TOKEN)) { + localPart = localPart.substring(1); + } + QName qName = new QName(type.getQName().getNamespaceURI(), localPart); + if (process) { pw.println(" <typeMapping"); - pw.println(" xmlns:ns=\"" + type.getQName().getNamespaceURI() + "\""); - pw.println(" qname=\"ns:" + type.getQName().getLocalPart() + '"'); + pw.println(" xmlns:ns=\"" + qName.getNamespaceURI() + "\""); + pw.println(" qname=\"ns:" + qName.getLocalPart() + '"'); pw.println(" type=\"java:" + type.getName() + '"'); if (type.getName().endsWith("[]")) { pw.println(" serializer=\"org.apache.axis.encoding.ser.ArraySerializerFactory\""); 1.46 +10 -1 xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaStubWriter.java Index: JavaStubWriter.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaStubWriter.java,v retrieving revision 1.45 retrieving revision 1.46 diff -u -r1.45 -r1.46 --- JavaStubWriter.java 15 Mar 2002 15:35:07 -0000 1.45 +++ JavaStubWriter.java 18 Mar 2002 22:37:34 -0000 1.46 @@ -433,7 +433,16 @@ } firstSer = false ; - QName qname = type.getQName(); + // If a root Element named Foo has an anon type, the + // anon type is named ">Foo". The following hack + // uses the name "Foo" so that the right qname gets + // registered. + String localPart = type.getQName().getLocalPart(); + if (localPart.startsWith(SymbolTable.ANON_TOKEN)) { + localPart = localPart.substring(1); + } + QName qname = new QName(type.getQName().getNamespaceURI(), localPart); + pw.println(" qName = new javax.xml.rpc.namespace.QName(\"" + qname.getNamespaceURI() + "\", \"" + qname.getLocalPart() + "\");"); 1.19 +5 -5 xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaWriterFactory.java Index: JavaWriterFactory.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaWriterFactory.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- JavaWriterFactory.java 13 Mar 2002 15:43:34 -0000 1.18 +++ JavaWriterFactory.java 18 Mar 2002 22:37:34 -0000 1.19 @@ -182,14 +182,14 @@ } // Get the QName to javify QName typeQName = tEntry.getQName(); - if (typeQName.getLocalPart().lastIndexOf('.') >= 0) { + if (typeQName.getLocalPart().lastIndexOf(SymbolTable.ANON_TOKEN) >= 0) { // This is an anonymous type name. - // Axis uses '.' as a nesting token to generate + // Axis uses '>' as a nesting token to generate // unique qnames for anonymous types. - // Only consider the localName after the last '.' when + // Only consider the localName after the last '>' when // generating the java name String localName = typeQName.getLocalPart(); - localName = localName.substring(localName.lastIndexOf('.')+1); + localName = localName.substring(localName.lastIndexOf(SymbolTable.ANON_TOKEN)+1); typeQName = new QName(typeQName.getNamespaceURI(), localName); // If there is already an existing type, there will be a // collision. If there is an existing anon type, there will be a @@ -273,7 +273,7 @@ // an anonymous type, then need to change the // java name of the anonymous type to match. QName anonQName = new QName(entry.getQName().getNamespaceURI(), - "." + entry.getQName().getLocalPart()); + SymbolTable.ANON_TOKEN + entry.getQName().getLocalPart()); TypeEntry anonType = symbolTable.getType(anonQName); if (anonType != null) { anonType.setName(entry.getName()); 1.45 +15 -7 xml-axis/java/src/org/apache/axis/wsdl/toJava/SymbolTable.java Index: SymbolTable.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/SymbolTable.java,v retrieving revision 1.44 retrieving revision 1.45 diff -u -r1.44 -r1.45 --- SymbolTable.java 13 Mar 2002 19:50:59 -0000 1.44 +++ SymbolTable.java 18 Mar 2002 22:37:34 -0000 1.45 @@ -141,7 +141,9 @@ // should we attempt to treat document/literal WSDL as "rpc-style" private boolean wrapped = false; - + + public static final String ANON_TOKEN = ">"; + /** * Construct a symbol table with the given Namespaces. */ @@ -1355,6 +1357,7 @@ } } + // If we don't want to emit stuff from imported files, only set the // isReferenced flag if this entry exists in the immediate WSDL file. Node node = entry.getNode(); @@ -1369,6 +1372,16 @@ setTypeReferences(referent, doc, literal); } } + // If the Defined Element has an anonymous type, + // process it with the current literal flag setting. + QName anonQName = SchemaUtils.getElementAnonQName(entry.getNode()); + if (anonQName != null) { + TypeEntry anonType = getType(anonQName); + if (anonType != null) { + setTypeReferences(anonType, doc, literal); + return; + } + } } } @@ -1580,15 +1593,10 @@ if (get(name, entry.getClass()) == null) { // An entry of the given qname of the given type doesn't exist yet. - if (debug) { - System.out.println("Symbol Table add " + name + " as " + - entry.getClass().getName().substring( - entry.getClass().getName().lastIndexOf(".") + 1)); - } if (entry instanceof Type && get(name, UndefinedType.class) != null) { - // A undefined type exists in the symbol table, which means + // A undefined type exists in the symbol table, which means // that the type is used, but we don't yet have a definition for // the type. Now we DO have a definition for the type, so // replace the existing undefined type with the real type. 1.20 +1 -1 xml-axis/java/src/org/apache/axis/wsdl/toJava/Utils.java Index: Utils.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/Utils.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- Utils.java 13 Mar 2002 19:50:59 -0000 1.19 +++ Utils.java 18 Mar 2002 22:37:34 -0000 1.20 @@ -247,7 +247,7 @@ if (kind.getLocalPart().equals("schema")) { search = null; } else if (kind.getLocalPart().equals("element")) { - localName = "." + getNodeNameQName(search).getLocalPart(); + localName = SymbolTable.ANON_TOKEN + getNodeNameQName(search).getLocalPart(); search = search.getParentNode(); } else if (kind.getLocalPart().equals("complexType") || kind.getLocalPart().equals("simpleType")) {