summaryrefslogtreecommitdiffstats
path: root/kode/kwsdl/schema/parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kode/kwsdl/schema/parser.cpp')
-rw-r--r--kode/kwsdl/schema/parser.cpp176
1 files changed, 88 insertions, 88 deletions
diff --git a/kode/kwsdl/schema/parser.cpp b/kode/kwsdl/schema/parser.cpp
index ec0daabe..7ec3804f 100644
--- a/kode/kwsdl/schema/parser.cpp
+++ b/kode/kwsdl/schema/parser.cpp
@@ -20,20 +20,20 @@
Boston, MA 02110-1301, USA.
*/
-#include <qdir.h>
-#include <qfile.h>
-#include <qurl.h>
+#include <tqdir.h>
+#include <tqfile.h>
+#include <tqurl.h>
#include "fileprovider.h"
#include "parser.h"
using namespace Schema;
-const QString soapEncUri = "http://schemas.xmlsoap.org/soap/encoding/";
-const QString wsdlUri = "http://schemas.xmlsoap.org/wsdl/";
+const TQString soapEncUri = "http://schemas.xmlsoap.org/soap/encoding/";
+const TQString wsdlUri = "http://schemas.xmlsoap.org/wsdl/";
-Parser::Parser( const QString &nameSpace )
+Parser::Parser( const TQString &nameSpace )
: mNameSpace( nameSpace )
{
mElementQualified = false;
@@ -113,24 +113,24 @@ void Parser::clear()
delete mAttributes[ i ];
}
-void Parser::setSchemaBaseUrl( const QString &url )
+void Parser::setSchemaBaseUrl( const TQString &url )
{
mSchemaBaseUrl = url;
}
-void Parser::parseNameSpace( const QDomElement &element )
+void Parser::parseNameSpace( const TQDomElement &element )
{
- QDomNamedNodeMap attributes = element.attributes();
+ TQDomNamedNodeMap attributes = element.attributes();
for ( uint i = 0; i < attributes.count(); ++i ) {
- QDomNode node = attributes.item( i );
- QDomAttr attribute = node.toAttr();
+ TQDomNode node = attributes.item( i );
+ TQDomAttr attribute = node.toAttr();
if ( attribute.name().startsWith( "xmlns:" ) )
mNameSpaceMap.insert( attribute.value(), attribute.name().mid( 6 ) );
}
}
-bool Parser::parseSchemaTag( const QDomElement &root )
+bool Parser::parseSchemaTag( const TQDomElement &root )
{
QualifiedName name = root.tagName();
if ( name.localName() != "schema" )
@@ -140,7 +140,7 @@ bool Parser::parseSchemaTag( const QDomElement &root )
mNameSpace = root.attribute( "targetNamespace" );
if ( root.hasAttribute( "elementFormDefault" ) ) {
- const QString value = root.attribute( "elementFormDefault" );
+ const TQString value = root.attribute( "elementFormDefault" );
if ( value == "unqualified" )
mElementQualified = false;
else if ( value == "qualified" )
@@ -156,9 +156,9 @@ bool Parser::parseSchemaTag( const QDomElement &root )
m_tnsPrefix = xParser->getNamespacePrefix(i);
*/
- QDomNode node = root.firstChild();
+ TQDomNode node = root.firstChild();
while ( !node.isNull() ) {
- QDomElement element = node.toElement();
+ TQDomElement element = node.toElement();
if ( !element.isNull() ) {
QualifiedName name = element.tagName();
@@ -195,9 +195,9 @@ bool Parser::parseSchemaTag( const QDomElement &root )
return true;
}
-void Parser::parseImport( const QDomElement &element )
+void Parser::parseImport( const TQDomElement &element )
{
- QString location = element.attribute( "schemaLocation" );
+ TQString location = element.attribute( "schemaLocation" );
if ( !location.isEmpty() ) {
// don't import a schema twice
if ( mImportedSchemas.contains( location ) )
@@ -209,15 +209,15 @@ void Parser::parseImport( const QDomElement &element )
}
}
-void Parser::parseAnnotation( const QDomElement& )
+void Parser::parseAnnotation( const TQDomElement& )
{
}
-void Parser::parseAnnotation( const QDomElement &element, QString &documentation )
+void Parser::parseAnnotation( const TQDomElement &element, TQString &documentation )
{
- QDomNode node = element.firstChild();
+ TQDomNode node = element.firstChild();
while ( !node.isNull() ) {
- QDomElement childElement = node.toElement();
+ TQDomElement childElement = node.toElement();
if ( !childElement.isNull() ) {
QualifiedName name = childElement.tagName();
if ( name.localName() == "documentation" )
@@ -228,11 +228,11 @@ void Parser::parseAnnotation( const QDomElement &element, QString &documentation
}
}
-void Parser::parseAnnotation( const QDomElement &element, ComplexType *complexType )
+void Parser::parseAnnotation( const TQDomElement &element, ComplexType *complexType )
{
- QDomNode node = element.firstChild();
+ TQDomNode node = element.firstChild();
while ( !node.isNull() ) {
- QDomElement childElement = node.toElement();
+ TQDomElement childElement = node.toElement();
if ( !childElement.isNull() ) {
QualifiedName name = childElement.tagName();
if ( name.localName() == "documentation" )
@@ -243,11 +243,11 @@ void Parser::parseAnnotation( const QDomElement &element, ComplexType *complexTy
}
}
-void Parser::parseAnnotation( const QDomElement &element, SimpleType *simpleType )
+void Parser::parseAnnotation( const TQDomElement &element, SimpleType *simpleType )
{
- QDomNode node = element.firstChild();
+ TQDomNode node = element.firstChild();
while ( !node.isNull() ) {
- QDomElement childElement = node.toElement();
+ TQDomElement childElement = node.toElement();
if ( !childElement.isNull() ) {
QualifiedName name = childElement.tagName();
if ( name.localName() == "documentation" )
@@ -258,7 +258,7 @@ void Parser::parseAnnotation( const QDomElement &element, SimpleType *simpleType
}
}
-XSDType *Parser::parseComplexType( const QDomElement &element )
+XSDType *Parser::parseComplexType( const TQDomElement &element )
{
ComplexType *newType = new ComplexType( mNameSpace );
@@ -266,9 +266,9 @@ XSDType *Parser::parseComplexType( const QDomElement &element )
if ( element.hasAttribute( "mixed" ) )
newType->setContentModel( newType->MIXED );
- QDomNode node = element.firstChild();
+ TQDomNode node = element.firstChild();
while ( !node.isNull() ) {
- QDomElement childElement = node.toElement();
+ TQDomElement childElement = node.toElement();
if ( !childElement.isNull() ) {
QualifiedName name = childElement.tagName();
@@ -297,18 +297,18 @@ XSDType *Parser::parseComplexType( const QDomElement &element )
return newType;
}
-void Parser::all( const QDomElement &element, ComplexType * ct )
+void Parser::all( const TQDomElement &element, ComplexType * ct )
{
int min, max;
- QString tmp;
+ TQString tmp;
min = element.attribute( "minOccurs", "1" ).toInt();
max = element.attribute( "maxOccurs", "1" ).toInt();
ct->setCompositor( ct->ALL, true, min, max );
- QDomNode node = element.firstChild();
+ TQDomNode node = element.firstChild();
while ( !node.isNull() ) {
- QDomElement childElement = node.toElement();
+ TQDomElement childElement = node.toElement();
if ( !childElement.isNull() ) {
QualifiedName name = childElement.tagName();
@@ -332,14 +332,14 @@ void Parser::all( const QDomElement &element, ComplexType * ct )
}
-void Parser::cs( const QDomElement &element, ComplexType *ct )
+void Parser::cs( const TQDomElement &element, ComplexType *ct )
{
int min = 1, max = 1;
QualifiedName name = element.tagName();
if ( name.localName() == "choice" || name.localName() == "sequence" ) {
min = element.attribute( "minOccurs", "1" ).toInt();
- QString value = element.attribute( "maxOccurs", "1" );
+ TQString value = element.attribute( "maxOccurs", "1" );
if ( value == "unbounded" )
max = UNBOUNDED;
else
@@ -350,9 +350,9 @@ void Parser::cs( const QDomElement &element, ComplexType *ct )
else
ct->setCompositor( ct->SEQ, true, min, max );
- QDomNode node = element.firstChild();
+ TQDomNode node = element.firstChild();
while ( !node.isNull() ) {
- QDomElement childElement = node.toElement();
+ TQDomElement childElement = node.toElement();
if ( !childElement.isNull() ) {
QualifiedName csName = childElement.tagName();
if ( csName.localName() == "element" )
@@ -377,9 +377,9 @@ void Parser::cs( const QDomElement &element, ComplexType *ct )
return;
}
-void Parser::addElement( const QDomElement &element, ComplexType *cType )
+void Parser::addElement( const TQDomElement &element, ComplexType *cType )
{
- QString name, fixedValue, defaultValue, documentation;
+ TQString name, fixedValue, defaultValue, documentation;
QualifiedName refName;
int type_id = 0, minOccurs = 1, maxOccurs = 1;
bool qualified = false, added = false, nill = false;
@@ -418,7 +418,7 @@ void Parser::addElement( const QDomElement &element, ComplexType *cType )
}
minOccurs = element.attribute( "minOccurs", "1" ).toInt();
- QString value = element.attribute( "maxOccurs", "1" );
+ TQString value = element.attribute( "maxOccurs", "1" );
if ( value == "unbounded" )
maxOccurs = UNBOUNDED;
else
@@ -430,9 +430,9 @@ void Parser::addElement( const QDomElement &element, ComplexType *cType )
if ( element.hasAttribute( "nillable" ) )
nill = true;
- QDomNode node = element.firstChild();
+ TQDomNode node = element.firstChild();
while ( !node.isNull() ) {
- QDomElement childElement = node.toElement();
+ TQDomElement childElement = node.toElement();
if ( !childElement.isNull() ) {
QualifiedName childName = childElement.tagName();
@@ -476,14 +476,14 @@ void Parser::addElement( const QDomElement &element, ComplexType *cType )
}
}
-void Parser::addAny( const QDomElement &element, ComplexType *cType )
+void Parser::addAny( const TQDomElement &element, ComplexType *cType )
{
- QString ns, any( "any" );
+ TQString ns, any( "any" );
int type_id = XSDType::ANY, min = 1, max = 1;
ns = element.attribute( "namespace" );
min = element.attribute( "minOccurs", "1" ).toInt();
- QString value = element.attribute( "maxOccurs", "1" );
+ TQString value = element.attribute( "maxOccurs", "1" );
if ( value == "unbounded" )
max = UNBOUNDED;
else
@@ -492,18 +492,18 @@ void Parser::addAny( const QDomElement &element, ComplexType *cType )
cType->addElement( any, type_id, min, max, false, ns );
}
-void Parser::addAnyAttribute( const QDomElement &element, ComplexType *cType )
+void Parser::addAnyAttribute( const TQDomElement &element, ComplexType *cType )
{
- QString ns, anyAttribute( "anyAttribute" );
+ TQString ns, anyAttribute( "anyAttribute" );
ns = element.attribute( "namespace" );
cType->addAttribute( anyAttribute, XSDType::ANY, false, ns );
}
-void Parser::addAttribute( const QDomElement &element, ComplexType *cType )
+void Parser::addAttribute( const TQDomElement &element, ComplexType *cType )
{
- QString name, fixedVal, defaultVal;
+ TQString name, fixedVal, defaultVal;
int type_id = 0;
bool qualified = false, use = false, added = false;
QualifiedName refAttribute;
@@ -553,9 +553,9 @@ void Parser::addAttribute( const QDomElement &element, ComplexType *cType )
use = true;
}
- QDomNode node = element.firstChild();
+ TQDomNode node = element.firstChild();
while ( !node.isNull() ) {
- QDomElement childElement = node.toElement();
+ TQDomElement childElement = node.toElement();
if ( !childElement.isNull() ) {
QualifiedName childName = childElement.tagName();
@@ -579,7 +579,7 @@ void Parser::addAttribute( const QDomElement &element, ComplexType *cType )
cType->addAttributeRef( refAttribute, qualified, use );
}
-XSDType *Parser::parseSimpleType( const QDomElement &element )
+XSDType *Parser::parseSimpleType( const TQDomElement &element )
{
SimpleType *st = new SimpleType( mNameSpace );
@@ -587,9 +587,9 @@ XSDType *Parser::parseSimpleType( const QDomElement &element )
st->setName( element.attribute( "name" ) );
- QDomNode node = element.firstChild();
+ TQDomNode node = element.firstChild();
while ( !node.isNull() ) {
- QDomElement childElement = node.toElement();
+ TQDomElement childElement = node.toElement();
if ( !childElement.isNull() ) {
QualifiedName name = childElement.tagName();
@@ -624,14 +624,14 @@ XSDType *Parser::parseSimpleType( const QDomElement &element )
return st;
}
-void Parser::parseRestriction( const QDomElement &element, SimpleType *st )
+void Parser::parseRestriction( const TQDomElement &element, SimpleType *st )
{
if ( st->baseType() == 0 )
qDebug( "<restriction>:unkown BaseType" );
- QDomNode node = element.firstChild();
+ TQDomNode node = element.firstChild();
while ( !node.isNull() ) {
- QDomElement childElement = node.toElement();
+ TQDomElement childElement = node.toElement();
if ( !childElement.isNull() ) {
if ( !st->isValidFacet( childElement.tagName() ) ) {
@@ -646,7 +646,7 @@ void Parser::parseRestriction( const QDomElement &element, SimpleType *st )
}
}
-void Parser::parseComplexContent( const QDomElement &element, ComplexType *ct )
+void Parser::parseComplexContent( const TQDomElement &element, ComplexType *ct )
{
QualifiedName typeName;
@@ -657,9 +657,9 @@ void Parser::parseComplexContent( const QDomElement &element, ComplexType *ct )
ct->setContentModel( ct->COMPLEX );
- QDomNode node = element.firstChild();
+ TQDomNode node = element.firstChild();
while ( !node.isNull() ) {
- QDomElement childElement = node.toElement();
+ TQDomElement childElement = node.toElement();
if ( !childElement.isNull() ) {
QualifiedName name = childElement.tagName();
@@ -680,16 +680,16 @@ void Parser::parseComplexContent( const QDomElement &element, ComplexType *ct )
// if the base soapenc:Array, then read only the arrayType attribute and nothing else
if ( typeName.localName() == "Array" ) {
- QDomElement arrayElement = childElement.firstChild().toElement();
+ TQDomElement arrayElement = childElement.firstChild().toElement();
ct->setIsArray( true );
QualifiedName arrayType( arrayElement.attribute( "arrayType" ) );
// arrayType.setNamespace(xParser->getNamespace(arrayType.getPrefix()));
ct->addElement( "item", typeId( arrayType, true ), 0, UNBOUNDED );
} else {
- QDomNode childNode = childElement.firstChild();
+ TQDomNode childNode = childElement.firstChild();
while ( !childNode.isNull() ) {
- QDomElement ctElement = childNode.toElement();
+ TQDomElement ctElement = childNode.toElement();
if ( !ctElement.isNull() ) {
QualifiedName name = ctElement.tagName();
@@ -716,11 +716,11 @@ void Parser::parseComplexContent( const QDomElement &element, ComplexType *ct )
}
}
-void Parser::parseSimpleContent( const QDomElement &element, ComplexType *ct )
+void Parser::parseSimpleContent( const TQDomElement &element, ComplexType *ct )
{
ct->setContentModel( ct->SIMPLE );
- const QDomElement childElement = element.firstChild().toElement();
+ const TQDomElement childElement = element.firstChild().toElement();
QualifiedName name = childElement.tagName();
if ( name.localName() == "restriction" ) {
@@ -753,9 +753,9 @@ void Parser::parseSimpleContent( const QDomElement &element, ComplexType *ct )
// typeName.setNamespace(xParser->getNamespace(typeName.getPrefix()));
ct->setContentType( basetype_id = typeId( typeName, true ) );
- QDomNode childNode = childElement.firstChild();
+ TQDomNode childNode = childElement.firstChild();
while ( !childNode.isNull() ) {
- QDomElement ctElement = childNode.toElement();
+ TQDomElement ctElement = childNode.toElement();
if ( !ctElement.isNull() ) {
QualifiedName name = ctElement.tagName();
if ( name.localName() == "attribute" )
@@ -776,7 +776,7 @@ bool Parser::isBasicType( int type ) const
return true;
}
-void Parser::parseElement( const QDomElement &element )
+void Parser::parseElement( const TQDomElement &element )
{
ComplexType *ct = new ComplexType( mNameSpace );
addElement( element, ct );
@@ -793,7 +793,7 @@ void Parser::parseElement( const QDomElement &element )
mElements.append( elementPtr );
}
-void Parser::parseAttribute( const QDomElement &element )
+void Parser::parseAttribute( const TQDomElement &element )
{
ComplexType *ct = new ComplexType( mNameSpace );
addAttribute( element, ct );
@@ -805,7 +805,7 @@ void Parser::parseAttribute( const QDomElement &element )
mAttributes.append( attributePtr );
}
-int Parser::addExternalElement( const QString &name, int localTypeId )
+int Parser::addExternalElement( const TQString &name, int localTypeId )
{
Element *element = new Element( name, localTypeId );
mElements.append( element );
@@ -817,7 +817,7 @@ int Parser::typeId( const QualifiedName &type, bool create )
{
QualifiedName typeName( type );
- QString typens = typeName.nameSpace();
+ TQString typens = typeName.nameSpace();
if ( typens.isEmpty() )
typeName.setNameSpace( typens = mNameSpace );
@@ -828,7 +828,7 @@ int Parser::typeId( const QualifiedName &type, bool create )
}
}
-QString Parser::typeName( int id ) const
+TQString Parser::typeName( int id ) const
{
return mTypesTable.typeName( id );
}
@@ -880,7 +880,7 @@ void Parser::resolveForwardDerivations()
int id;
ComplexType *type = 0;
- QValueList<ForwardDerivation>::ConstIterator it;
+ TQValueList<ForwardDerivation>::ConstIterator it;
for ( it = mForwardDerivations.begin(); it != mForwardDerivations.end(); ++it ) {
if ( ( id = typeId( (*it).type, false ) ) == 0 )
continue;
@@ -898,7 +898,7 @@ int Parser::elementId( const QualifiedName &type )
{
QualifiedName typeName( type );
- QString typens = typeName.nameSpace();
+ TQString typens = typeName.nameSpace();
if ( typens.isEmpty() )
typeName.setNameSpace( typens = mNameSpace );
@@ -930,7 +930,7 @@ Element *Parser::element( const QualifiedName &name ) const
{
QualifiedName elementName( name );
- QString typens = elementName.nameSpace();
+ TQString typens = elementName.nameSpace();
if ( typens.isEmpty() )
elementName.setNameSpace( typens = mNameSpace );
@@ -965,7 +965,7 @@ int Parser::attributeId( const QualifiedName &type ) const
{
QualifiedName typeName( type );
- QString typens = typeName.nameSpace();
+ TQString typens = typeName.nameSpace();
if ( typens.isEmpty() )
typeName.setNameSpace( typens = mNameSpace );
@@ -1012,7 +1012,7 @@ Attribute *Parser::attribute( const QualifiedName &name ) const
return 0;
}
-QString Parser::targetNamespace() const
+TQString Parser::targetNamespace() const
{
return mNameSpace;
}
@@ -1052,27 +1052,27 @@ bool Parser::shouldResolve()
return true;
}
-void Parser::importSchema( const QString &location )
+void Parser::importSchema( const TQString &location )
{
FileProvider provider;
- QString fileName;
- QString schemaLocation( location );
+ TQString fileName;
+ TQString schemaLocation( location );
- QUrl url( location );
- QDir dir( location );
+ TQUrl url( location );
+ TQDir dir( location );
if ( (url.protocol().isEmpty() || url.protocol() == "file") && dir.isRelative() )
schemaLocation = mSchemaBaseUrl + "/" + location;
if ( provider.get( schemaLocation, fileName ) ) {
- QFile file( fileName );
+ TQFile file( fileName );
if ( !file.open( IO_ReadOnly ) ) {
qDebug( "Unable to open file %s", file.name().latin1() );
return;
}
- QDomDocument doc( "kwsdl" );
- QString errorMsg;
+ TQDomDocument doc( "kwsdl" );
+ TQString errorMsg;
int errorLine, errorColumn;
bool ok = doc.setContent( &file, true, &errorMsg, &errorLine, &errorColumn );
if ( !ok ) {
@@ -1080,9 +1080,9 @@ void Parser::importSchema( const QString &location )
return;
}
- QDomNodeList nodes = doc.elementsByTagName( "schema" );
+ TQDomNodeList nodes = doc.elementsByTagName( "schema" );
if ( nodes.count() > 0 ) {
- QDomElement schemaElement = nodes.item( 0 ).toElement();
+ TQDomElement schemaElement = nodes.item( 0 ).toElement();
parseSchemaTag( schemaElement );
} else {
qDebug( "No schema tag found in schema file" );