Hi,
           I'm looking for a solution of setencoding for parsing a xml file.
Writing a wrapper like module for xerces which will help to parse XML string
comming from the network. So i have used DOMLSinput for setStringdata(); 
           I can parse files with encoding="UTF-8" by default. But when i use a
sample file with encoding='" MEMPARSE_ENCODING "' Im getting segmentation fault.
I have searched and tried some options from "XMLUni" but result is same. 

1) Can you point me out which one have to be set for encode?
2) How I can understand that type on the fly before setting it to be parsed?

XMLFILE:
<?xml version='1.0' encoding='" MEMPARSE_ENCODING "'?>
<!DOCTYPE company [
<!ELEMENT company     (product,category,developedAt)>
<!ELEMENT product     (#PCDATA)>
<!ELEMENT category    (#PCDATA)>
<!ATTLIST category idea CDATA #IMPLIED>
<!ELEMENT developedAt (#PCDATA)>
]>
<company>
    <product>XML4C</product>
    <category idea='great'>XML Parsing Tools</category>
    <developedAt>
      IBM Center for Java Technology, Silicon Valley, Cupertino, CA
    </developedAt>
</company>


code segment:

MemBufInputSource is((XMLByte*)memblock, strlen(memblock), "bufId");
XMLString::transcode(memblock,XMLstr,fSize-1);
impl = DOMImplementationRegistry::getDOMImplementation(gLS);
parser = (impl)->createLSParser(DOMImplementationLS::MODE_SYNCHRONOUS,0);
input = ((DOMImplementationLS*)impl)->createLSInput();
input->setStringData(XMLstr);/*********************************************/
//input->setEncoding(XMLUni::fgAnyString); /*we have to set proper encoding by
checking b4 it to be parsed!*/

thanking you
MCM





Reply via email to