[Uml-devel] kdesdk/umbrello/umbrello

Jonathan Riddell jri at jriddell.org
Tue Mar 18 17:50:24 UTC 2003


CVS commit by jriddell: 

Patch by Brian Thomas to fix my meddling and make vital XML headers
hard coded rather than taken from the heading file


  M +16 -7     codegenerators/xmlschemawriter.cpp   1.4
  M +0 -3      headings/heading.xsd   1.2


--- kdesdk/umbrello/umbrello/codegenerators/xmlschemawriter.cpp  #1.3:1.4
@@ -32,7 +32,6 @@
 // Constructor
 XMLSchemaWriter::XMLSchemaWriter( QObject *parent, const char *name ) : CodeGenerator(parent, name) {
-
         packageNamespaceTag = "tns";
-        packageNamespaceURI = "http://change.this.value/";
+        packageNamespaceURI = "http://foo.example.com/";
         schemaNamespaceTag = "xs";
         schemaNamespaceURI = "http://www.w3.org/2001/XMLSchema";
@@ -79,4 +77,8 @@ void XMLSchemaWriter::writeClass(UMLClas
         // START WRITING
 
+        // 0. FIRST THING: open the xml processing instruction. This MUST be
+        // the first thing in the file
+        XMLschema<<"<?xml version=\"1.0\"?>"<<endl;
+
         // 1. create the header
         QString headerText = getHeadingFile(".xsd");
@@ -88,7 +90,14 @@ void XMLSchemaWriter::writeClass(UMLClas
                 XMLschema<<headerText<<endl;
 
+        // 2. Open schema element node with appropriate namespace decl
+        XMLschema<<"<"<<makeSchemaTag("schema");
+        // common namespaces we know will be in the file..
+        XMLschema<<" xmlns:"<<schemaNamespaceTag<<"=\""<<schemaNamespaceURI<<"\"";
+        XMLschema<<" xmlns:"<<packageNamespaceTag<<"=\""<<packageNamespaceURI+packageNamespaceTag<<"\"";
+        XMLschema<<">"<<endl; // close opening declaration
+
         indentLevel++;
 
-        // 2? IMPORT statements -- do we need to do anything here? I suppose if
+        // 3? IMPORT statements -- do we need to do anything here? I suppose if
         // our document has more than one package, which is possible, we are missing
         // the correct import statements. Leave that for later at this time.
@@ -102,5 +111,5 @@ void XMLSchemaWriter::writeClass(UMLClas
         */
 
-        // 3. BODY of the schema.
+        // 4. BODY of the schema.
         // start the writing by sending this classifier, the "root" for this particular
         // schema, to writeClassifier method, which will subsequently call itself on all
@@ -108,9 +117,9 @@ void XMLSchemaWriter::writeClass(UMLClas
         writeClassifier(c, XMLschema);
 
-        // 4. What remains is to make the root node declaration
+        // 5. What remains is to make the root node declaration
         XMLschema<<endl;
         writeElementDecl(getElementName(c), getElementTypeName(c), XMLschema);
 
-        // 5. Finished: now we may close schema decl
+        // 6. Finished: now we may close schema decl
         indentLevel--;
         XMLschema<<getIndent()<<"</"<<makeSchemaTag("schema")<<">"<<endl; // finished.. close schema node

--- kdesdk/umbrello/umbrello/headings/heading.xsd  #1.1:1.2
@@ -1,5 +1,2 @@
-<?xml version="1.0"?>
-<xs:schema targetNamespace="http://foo.example.com/tns" xmlns:xs="http://www.w3.org/2001/XMLSchema" 
-xmlns:tns="http://foo.example.com/tns">
 <!--
 This heading is genearated using the file at






More information about the umbrello-devel mailing list