Category : xerces

I want change an attribute value of a XML file. I already change a node value, in this manner: xercesc_3_2::XMLPlatformUtils::Initialize(); xercesc_3_2::XercesDOMParser* parser = new xercesc_3_2::XercesDOMParser; parser->setValidationScheme(xercesc_3_2::XercesDOMParser::Val_Never); parser->parse(fileName.c_str()); xercesc_3_2::DOMDocument* doc = parser->getDocument(); xercesc_3_2::DOMElement* root = doc->getDocumentElement(); xercesc_3_2::DOMXPathResult* result = doc->evaluate( xercesc_3_2::XMLString::transcode("/document/child1/child2"), root, NULL, xercesc_3_2::DOMXPathResult::ORDERED_NODE_SNAPSHOT_TYPE, NULL); result->getNodeValue()->getFirstChild()->setNodeValue(xercesc_3_2::XMLString::transcode(value.c_str())); But I don’t understand how to change the attribute value. ..

Read more

I was using Xerces C++ and I needed to validate XML files against multiple xsd files. For single XSD I am doing this and it’s working as well: MemBufInputSource schemasrcinmem((const XMLByte*)schemasrc.c_str(), static_cast<unsigned int>(schemasrc.size()), "schemafile", false); assert(mParserPtr->loadGrammar(schemasrcinmem,Grammar::SchemaGrammarType, true) != nullptr); I am storing the XSD file as a string in schemasrc. Now I have to test ..

Read more

I’m using xerces-c to write XML. By default it writes the entire DOM as a single line of text. I tried the pretty-print option, like below, and now it prints double-spaced lines – which isn’t very pretty, in my opinion. Is there a way to avoid the double-spacing? void configureWriter(DOMLSSerializer* writer) { writer->getDomConfig()->setParameter(XMLUni::fgDOMWRTFormatPrettyPrint, true); } ..

Read more