diff --git a/src/dtd2schema.cpp b/src/dtd2schema.cpp index 4fcfb86..56211c7 100644 --- a/src/dtd2schema.cpp +++ b/src/dtd2schema.cpp @@ -59,8 +59,9 @@ const wxString &Dtd2Schema::convert ( const wxString &dtdFile ) return mSchema; } - mSchema << _T("\n") - _T("") + << wxTextFile::GetEOL() + << _T("::iterator itr; itr = mNameSpaceMap.find ( _T("xml") ); @@ -92,15 +95,18 @@ const wxString &Dtd2Schema::convert ( const wxString &dtdFile ) itr->second = wxString::FromUTF8 ( (const char *) XML_XML_NAMESPACE ); for ( itr = mNameSpaceMap.begin(); itr != mNameSpaceMap.end(); ++itr ) { - mSchema << _T("\n xmlns:") << itr->first << _T("=\"") + mSchema << wxTextFile::GetEOL() + << _T(" xmlns:") << itr->first << _T("=\"") << itr->second << _T("\""); importNS << _T(" second.empty() ? itr->first : itr->second ) - << _T("\"/>\n"); + << _T("\"/>") + << wxTextFile::GetEOL(); } - mSchema << _T(">\n") + mSchema << _T(">") + << wxTextFile::GetEOL() << importNS - << _T("\n") + << wxTextFile::GetEOL() << elements; #if 0 @@ -119,7 +125,7 @@ const wxString &Dtd2Schema::convert ( const wxString &dtdFile ) mSchema << convertNotation ( notationEnum.nextElement(), nIndent ); } - mSchema << _T("\n"); + mSchema << _T("") << wxTextFile::GetEOL(); return mSchema; } @@ -154,17 +160,20 @@ wxString Dtd2Schema::convertElement } if ( pcdata ) { - schema << _T("\" type=\"xs:string\"/>\n\n"); + schema << _T("\" type=\"xs:string\"/>") + << wxTextFile::GetEOL() + << wxTextFile::GetEOL(); return schema; } } // else Complex type - schema << _T("\">\n"); + schema << _T("\">") << wxTextFile::GetEOL(); // Content XmlSchemaGenerator::addIndent ( schema, nIndent + 1 ); - schema << _T("\n") + schema << _T("") + << wxTextFile::GetEOL() << convertContent ( contentSpec, nIndent + 2 ); // Attributes @@ -178,10 +187,12 @@ wxString Dtd2Schema::convertElement } XmlSchemaGenerator::addIndent ( schema, nIndent + 1); - schema << _T("\n"); + schema << _T("") << wxTextFile::GetEOL(); XmlSchemaGenerator::addIndent ( schema, nIndent ); - schema << _T("\n\n"); + schema << _T("") + << wxTextFile::GetEOL() + << wxTextFile::GetEOL(); return schema; } @@ -206,9 +217,9 @@ wxString Dtd2Schema::convertContent break; } XmlSchemaGenerator::addIndent ( schema, nIndent ); - schema << _T("\n"); + schema << _T("") << wxTextFile::GetEOL(); XmlSchemaGenerator::addIndent ( suffix, nIndent ); - suffix << _T("\n"); + suffix << _T("") << wxTextFile::GetEOL(); break; case ContentSpecNode::ZeroOrMore: @@ -218,9 +229,10 @@ wxString Dtd2Schema::convertContent break; } XmlSchemaGenerator::addIndent ( schema, nIndent ); - schema << _T("\n"); + schema << _T("") + << wxTextFile::GetEOL(); XmlSchemaGenerator::addIndent ( suffix, nIndent ); - suffix << _T("\n"); + suffix << _T("") << wxTextFile::GetEOL(); break; case ContentSpecNode::OneOrMore: @@ -230,9 +242,10 @@ wxString Dtd2Schema::convertContent break; } XmlSchemaGenerator::addIndent ( schema, nIndent ); - schema << _T("\n"); + schema << _T("") + << wxTextFile::GetEOL(); XmlSchemaGenerator::addIndent ( suffix, nIndent ); - suffix << _T("\n"); + suffix << _T("") << wxTextFile::GetEOL(); break; case ContentSpecNode::Choice: @@ -245,10 +258,10 @@ wxString Dtd2Schema::convertContent break; } XmlSchemaGenerator::addIndent ( schema, nIndent ); - schema << _T("\n"); + schema << _T("") + << wxTextFile::GetEOL(); XmlSchemaGenerator::addIndent ( suffix, nIndent ); - suffix << _T("\n"); + suffix << _T("") << wxTextFile::GetEOL(); break; case ContentSpecNode::Sequence: @@ -261,17 +274,18 @@ wxString Dtd2Schema::convertContent break; } XmlSchemaGenerator::addIndent ( schema, nIndent ); - schema << _T("\n"); + schema << _T("") << wxTextFile::GetEOL(); XmlSchemaGenerator::addIndent ( suffix, nIndent ); - suffix << _T("\n"); + suffix << _T("") << wxTextFile::GetEOL(); break; case ContentSpecNode::Any: XmlSchemaGenerator::addIndent ( schema, nIndent ); - schema << _T("\n"); + schema << _T("") + << wxTextFile::GetEOL(); XmlSchemaGenerator::addIndent ( suffix, nIndent ); - suffix << _T("\n"); + suffix << _T("") << wxTextFile::GetEOL(); break; case ContentSpecNode::All: @@ -284,9 +298,10 @@ wxString Dtd2Schema::convertContent break; } XmlSchemaGenerator::addIndent ( schema, nIndent ); - schema << _T("\n"); + schema << _T("") + << wxTextFile::GetEOL(); XmlSchemaGenerator::addIndent ( suffix, nIndent ); - suffix << _T("\n"); + suffix << _T("") << wxTextFile::GetEOL(); break; default: @@ -306,11 +321,10 @@ wxString Dtd2Schema::convertContent } XmlSchemaGenerator::addIndent ( schema, nIndent ); - schema << _T("\n"); + << _T("/>") + << wxTextFile::GetEOL(); size_t index = name.Index ( ':' ); if ( index != wxString::npos ) @@ -362,7 +376,7 @@ wxString Dtd2Schema::convertAttribute if ( att.getType() == XMLAttDef::Any_Any ) { XmlSchemaGenerator::addIndent ( schema, nIndent ); - schema << _T("\n"); + schema << _T("") << wxTextFile::GetEOL(); return schema; } @@ -406,7 +420,8 @@ wxString Dtd2Schema::convertAttribute mNameSpaceMap [ ns ]; // Initialize it } XmlSchemaGenerator::addIndent ( schema, nIndent ); - schema << _T("\n"); + schema << _T("") + << wxTextFile::GetEOL(); return schema; } @@ -417,16 +432,18 @@ wxString Dtd2Schema::convertAttribute //if ( att.getType() == XMLAttDef::Enumeration ) { schema << convertAttValue ( att ) - << _T(">\n") + << _T(">") + << wxTextFile::GetEOL() << convertAttType ( att, nIndent + 1 ); XmlSchemaGenerator::addIndent ( schema, nIndent ); - schema << _T("\n"); + schema << _T("") << wxTextFile::GetEOL(); } else { schema << convertAttType ( att, nIndent + 1 ) << convertAttValue ( att ) - << _T("/>\n"); + << _T("/>") + << wxTextFile::GetEOL(); } return schema; @@ -441,9 +458,10 @@ wxString Dtd2Schema::convertAttType ( const XMLAttDef &att, size_t nIndent ) //case XMLAttDef::Enumeration: { XmlSchemaGenerator::addIndent ( type, nIndent ); - type << _T("\n"); + type << _T("") << wxTextFile::GetEOL(); XmlSchemaGenerator::addIndent ( type, nIndent + 1 ); - type << _T("\n"); + type << _T("") + << wxTextFile::GetEOL(); wxStringTokenizer tokens ( WrapXerces::toString ( att.getEnumeration() ), _T(" ") ); @@ -452,13 +470,14 @@ wxString Dtd2Schema::convertAttType ( const XMLAttDef &att, size_t nIndent ) XmlSchemaGenerator::addIndent ( type, nIndent + 2); type << _T("\n"); + << _T("\"/>") + << wxTextFile::GetEOL(); } XmlSchemaGenerator::addIndent ( type, nIndent + 1 ); - type << _T("\n"); + type << _T("") << wxTextFile::GetEOL(); XmlSchemaGenerator::addIndent ( type, nIndent ); - type << _T("\n"); + type << _T("") << wxTextFile::GetEOL(); return type; } @@ -580,7 +599,7 @@ wxString Dtd2Schema::convertNotation if ( id != NULL ) schema << _T("\" system=\"") << WrapXerces::toString ( id ); - schema << _T("\"/>\n\n"); + schema << _T("\"/>") << wxTextFile::GetEOL() << wxTextFile::GetEOL(); return schema; }