2014-07-20 4 views

답변

0

PSVIHandler을 상속하는 MyPSVIHandler 클래스를 만들고 setPSVIHandler 메서드를 사용하여 설치할 수 있습니다.

MyPSVIHandler psvi_handler; 
sax2xmlreader->setPSVIHandler(&psvi_handler); 
void MyPSVIHandler::handleAttributesPSVI(
    const XMLCh *const /* localName */, 
    const XMLCh *const /* uri */, 
    PSVIAttributeList *psviAttributes) { 
    for (XMLSize_t i = 0; i < psviAttributes->getLength(); i++) { 
    if (XMLString::equals(psviAttributes->getAttributeNamespaceAtIndex(i), 
          SchemaSymbols::fgURI_XSI)) { 
     const XMLCh *attr_name(psviAttributes->getAttributeNameAtIndex(i)); 
     if (XMLString::equals(attr_name, SchemaSymbols::fgXSI_SCHEMALOCATION)) { 
     const XMLCh *str = psviAttributes-> 
      getAttributePSVIAtIndex(i)->getSchemaNormalizedValue(); 
     char *transcoded_str = xercesc::XMLString::transcode(str); 
     std::cout << "schemaLocation = " << transcoded_str << "\n"; 
     xercesc::XMLString::release(&transcoded_str); 
     } 
    } 
    } 
}