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 João Graça <jo...@l2f.inesc-id.pt> on 2005/03/16 04:01:20 UTC
Getting a parser from a string
Hello,
I am trying to start a parser from a std::string because this is what i
receive from a xml rpc channel.
The problem is that i already have tried to use DomBuilder,
MemBufInputSource with and without wrappers and i can't make it. Could
someone help me with this problem, like sugesting what i should properly
do.
I have read all the documentation several times and i can't figure it out.
I appreciate your atention,
Best regards,
João Graça
PS: I send i little bit of code from one of my experiment so that you
can see what i am trying to do.
DOMBuilder* parser =
((DOMImplementationLS*)_impl)->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS,
0);
const char * msg = analysisXml.c_str();
MemBufInputSource* memBufIS = new MemBufInputSource
(
(const XMLByte*)msg
, strlen(msg)
, "repository"
, false
);
Wrapper4DOMInputSource domISWrapper(memBufIS);
// Wrapper4DOMInputSource domISWrapper(inputSource);
DOMDocument *doc = 0;
try {
doc = parser->parse(domISWrapper);
}
catch (const XMLException& toCatch) {
char* message = XMLString::transcode(toCatch.getMessage());
cout << "Exception message is: \n"
<< message << "\n";
XMLString::release(&message);
return 0;
}
///Build domain model from dom node
return 0;
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
RE: Getting a parser from a string
Posted by Matthew Berry <ma...@apt.com>.
João,
I can't remember what the default encoding setting for MemBufInputSource is,
but it may be that you need to set the encoding to single-byte characters.
-----Original Message-----
From: João Graça [mailto:joao.graca@l2f.inesc-id.pt]
Sent: 16 March 2005 03:01
To: xerces-c-dev@xml.apache.org
Subject: Getting a parser from a string
Hello,
I am trying to start a parser from a std::string because this is what i
receive from a xml rpc channel.
The problem is that i already have tried to use DomBuilder,
MemBufInputSource with and without wrappers and i can't make it. Could
someone help me with this problem, like sugesting what i should properly
do.
I have read all the documentation several times and i can't figure it out.
I appreciate your atention,
Best regards,
João Graça
PS: I send i little bit of code from one of my experiment so that you
can see what i am trying to do.
DOMBuilder* parser =
((DOMImplementationLS*)_impl)->createDOMBuilder(DOMImplementationLS::MODE_SY
NCHRONOUS,
0);
const char * msg = analysisXml.c_str();
MemBufInputSource* memBufIS = new MemBufInputSource
(
(const XMLByte*)msg
, strlen(msg)
, "repository"
, false
);
Wrapper4DOMInputSource domISWrapper(memBufIS);
// Wrapper4DOMInputSource domISWrapper(inputSource);
DOMDocument *doc = 0;
try {
doc = parser->parse(domISWrapper);
}
catch (const XMLException& toCatch) {
char* message = XMLString::transcode(toCatch.getMessage());
cout << "Exception message is: \n"
<< message << "\n";
XMLString::release(&message);
return 0;
}
///Build domain model from dom node
return 0;
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org