You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Matteo Vega <ve...@yahoo.com> on 2005/02/22 01:22:38 UTC

parsing a schema file

Hi,

I am trying to parse a schema file and create the DOM
tree from it. I am using XSDDOMParser, but when I
call:

DOMDocument *pDocument = parser.getDocument();

it returns undefined value. This is the code sniplet
showing how I create the parser:

----------------------------------------

XSDDOMParser parser(0,
XMLPlatformUtils::fgMemoryManager, 0);

parser.setValidationScheme(XercesDOMParser::Val_Never);
parser.setDoNamespaces(true);

ErrorHandler* errHandler = (ErrorHandler*) new
HandlerBase();
parser.setErrorHandler(errHandler);

char* xsdFile = "example.xsd";

parser.parse(xsdFile);

DOMDocument *pDoc = parser.getDocument();

--------------

What am I doing wrong? Any help would be highly
appreciated. 

TIA,


Matt.


	
		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - You care about security. So do we. 
http://promotions.yahoo.com/new_mail

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: parsing a schema file

Posted by Matteo Vega <ve...@yahoo.com>.
Hi,

I am getting no errors during parsing. The actual
implementation uses a try-catch block for parsing
phase.

-------------
try {
        parser.parse(xsdFile);
    }
    catch (const XMLException& toCatch) {
        char* message =
XMLString::transcode(toCatch.getMessage());
        XERCES_STD_QUALIFIER cout << "Exception
message is: \n"
                << message << "\n";
        XMLString::release(&message);
		XMLPlatformUtils::Terminate();
        return -1;
    }
    catch (const DOMException& toCatch) {
        char* message =
XMLString::transcode(toCatch.msg);
        XERCES_STD_QUALIFIER cout << "Exception
message is: \n"
                << message << "\n";
        XMLString::release(&message);
		XMLPlatformUtils::Terminate();
        return -1;
    }
    catch (...) {
        XERCES_STD_QUALIFIER cout << "Unexpected
Exception \n" ;
		XMLPlatformUtils::Terminate();
        return -1;
    }
-------------

The program also workes when I use a XercesDOMParser
instead XSDDOMParser, which is a XercesDOMParser???

TIA


Matt.

--- Gareth Reakes <ga...@parthenoncomputing.com>
wrote:

> Hi,
> 
> 	Are any errors reported during the parse? Do you
> have your error 
> handler printing anything out?
> 
> Gareth
> 
> Matteo Vega wrote:
> > Hi,
> > 
> > I am trying to parse a schema file and create the
> DOM
> > tree from it. I am using XSDDOMParser, but when I
> > call:
> > 
> > DOMDocument *pDocument = parser.getDocument();
> > 
> > it returns undefined value. This is the code
> sniplet
> > showing how I create the parser:
> > 
> > ----------------------------------------
> > 
> > XSDDOMParser parser(0,
> > XMLPlatformUtils::fgMemoryManager, 0);
> > 
> >
>
parser.setValidationScheme(XercesDOMParser::Val_Never);
> > parser.setDoNamespaces(true);
> > 
> > ErrorHandler* errHandler = (ErrorHandler*) new
> > HandlerBase();
> > parser.setErrorHandler(errHandler);
> > 
> > char* xsdFile = "example.xsd";
> > 
> > parser.parse(xsdFile);
> > 
> > DOMDocument *pDoc = parser.getDocument();
> > 
> > --------------
> > 
> > What am I doing wrong? Any help would be highly
> > appreciated. 
> > 
> > TIA,
> > 
> > 
> > Matt.
> > 
> > 
> > 	
> > 		
> > __________________________________ 
> > Do you Yahoo!? 
> > Yahoo! Mail - You care about security. So do we. 
> > http://promotions.yahoo.com/new_mail
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> xerces-c-dev-unsubscribe@xml.apache.org
> > For additional commands, e-mail:
> xerces-c-dev-help@xml.apache.org
> > 
> > 
> 
> -- 
> Gareth Reakes, Managing Director      Parthenon
> Computing
> +44-1865-811184                 
> http://www.parthcomp.com
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail:
> xerces-c-dev-help@xml.apache.org
> 
> 



		
__________________________________ 
Do you Yahoo!? 
The all-new My Yahoo! - Get yours free! 
http://my.yahoo.com 
 


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: parsing a schema file

Posted by Gareth Reakes <ga...@parthenoncomputing.com>.
Hi,

	Are any errors reported during the parse? Do you have your error 
handler printing anything out?

Gareth

Matteo Vega wrote:
> Hi,
> 
> I am trying to parse a schema file and create the DOM
> tree from it. I am using XSDDOMParser, but when I
> call:
> 
> DOMDocument *pDocument = parser.getDocument();
> 
> it returns undefined value. This is the code sniplet
> showing how I create the parser:
> 
> ----------------------------------------
> 
> XSDDOMParser parser(0,
> XMLPlatformUtils::fgMemoryManager, 0);
> 
> parser.setValidationScheme(XercesDOMParser::Val_Never);
> parser.setDoNamespaces(true);
> 
> ErrorHandler* errHandler = (ErrorHandler*) new
> HandlerBase();
> parser.setErrorHandler(errHandler);
> 
> char* xsdFile = "example.xsd";
> 
> parser.parse(xsdFile);
> 
> DOMDocument *pDoc = parser.getDocument();
> 
> --------------
> 
> What am I doing wrong? Any help would be highly
> appreciated. 
> 
> TIA,
> 
> 
> Matt.
> 
> 
> 	
> 		
> __________________________________ 
> Do you Yahoo!? 
> Yahoo! Mail - You care about security. So do we. 
> http://promotions.yahoo.com/new_mail
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> 
> 

-- 
Gareth Reakes, Managing Director      Parthenon Computing
+44-1865-811184                  http://www.parthcomp.com

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org