Hi,
I am using Xerces ( C++, latest version i believe, i downloaded it about 3
months ago ) and am trying to get type info from my DOMElements. Right now
some apparently don't have type names (they return null), and the top level
element (Shield in this case, see below) returns type: "anyType"

I'm doing the following to try and get the type:

<pre>
DOMElement* elementRoot = doc->getDocumentElement();
const DOMTypeInfo *typeInfo = elementRoot->getTypeInfo();
char *typeName = XMLString::transcode( typeInfo->getName() );
cout << "typeName: " << typeName << endl;
</pre>

And I see:
typeName: anyType


ForPlay.xsd
-----------
<pre>
<?xml version="1.0" encoding="UTF-8"?>

<xs:schema elementFormDefault="qualified"
                        xmlns:xs="http://www.w3.org/2001/XMLSchema";
                        xmlns:forplay="http://www.medaverse.com/engines/forplay";
                        
targetNamespace="http://www.medaverse.com/engines/forplay";>

        <!-- define custom types -->
         .................


        <!-- definition of root level elements -->
        <xs:element name="GameObject2D" type="GameObject2D"/>
        <xs:element name="GameObject3D" type="GameObject3D"/>
        <xs:element name="GameObject" type="GameObject"/>
</xs:schema>
</pre>

Gravitronix.xsd
--------------
<pre>
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema elementFormDefault="qualified"
                                xmlns:xs="http://www.w3.org/2001/XMLSchema";
                                xmlns="http://www.medaverse.com/engines/forplay";
                                
xmlns:forplay="http://www.medaverse.com/engines/forplay";
                               
xmlns:grav="http://www.medaverse.com/games/gravitronix";
                                
targetNamespace="http://www.medaverse.com/games/gravitronix";>
        
        <!-- definition of elements -->
        <xs:element name="Paddle" type="GameObject3D"/>
        <xs:element name="Shield" type="GameObject3D"/>
</xs:schema>
</pre>


GOShield.xml
------------
<?xml version="1.0" encoding="UTF-8"?>

<Shield         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
                                xmlns="http://www.medaverse.com/engines/forplay";
                                
xmlns:forplay="http://www.medaverse.com/engines/forplay";
                                
xmlns:grav="http://www.medaverse.com/games/gravitronix";
                                
xsi:schemaLocation="http://www.medaverse.com/engines/forplay
                                                                        
file:///xml/ForPlay.xsd
                                                                        
http://www.medaverse.com/games/gravitronix
                                                                        
file:///xml/Gravitronix.xsd">
        <position x="0.0" y="0.0" z="0.0"/>
        <rotation roll="0.0" pitch="0.0" yaw="0.0"/>
        <model path="GoShield.lwo" />
</Shield>


and I'm setting up my parser the following way:
----------------------------------------------

                parser->cacheGrammarFromParse(true);
                parser->setDoSchema(true);
                parser->setDoNamespaces(true);
                parser->setValidationScheme(XercesDOMParser::Val_Always);    
                parser->useCachedGrammarInParse(true);
                parser->setValidationSchemaFullChecking(true);
                parser->setValidationConstraintFatal(true);
                parser->setIncludeIgnorableWhitespace(false);
                parser->setStandardUriConformant(true);
                parser->setIdentityConstraintChecking(true);
                parser->setCreateSchemaInfo(true);

                // Load XSD files
                vector<string>::iterator it;
                for( it = m_xsdFile.begin(); it != m_xsdFile.end(); ++it ) {
                        parser->loadGrammar( it->c_str(), 
Grammar::SchemaGrammarType, true);
                }

                ErrorHandler* errHandler = (ErrorHandler*) new 
XMLErrorHandler();
                parser->setErrorHandler(errHandler);

 at all would be greatly appreciated.
-- 
View this message in context: 
http://www.nabble.com/Incorrect-TypeInfo-from-DOMElement--tp17570700p17570700.html
Sent from the Xerces - C - Users mailing list archive at Nabble.com.

Reply via email to