Help in libxml++ for Linux


 
Thread Tools Search this Thread
Top Forums Programming Help in libxml++ for Linux
# 1  
Old 07-27-2011
Help in libxml++ for Linux

Hi,

Using libxml++-2.6, is it possible to change the xsi:noNamespaceSchemaLocation in the root element node?
e.g.
from
Code:
<myxml xsi:noNamespaceSchemaLocation="ABC.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   :
   :
</myxml>

to
Code:
<myxml xsi:noNamespaceSchemaLocation="XYZ.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   :
   :
</myxml>

I tried to set the attribute value after getting the attribute pointer from the node element as follows:
Code:
Element* nodeElement = dynamic_cast<const Element*>(rootNode)
Attribute* attribute = nodeElement->get_attribute("xsi:noNamespaceSchemaLocation")
if (attribute)
     attribute->set_value("XYZ.xsd:);
else
     cout << "Attribute NOT found" << endl;

The output shows "Attribute NOT found" Smilie
# 2  
Old 07-27-2011
I am not familiar with libxml++ but am very familiar with libxml. It looks like you are using the wrong method to access the namespace nodes as far as libxml is concerned.

I understand that libxml++ is simply a C++ wrapper around libxml. I glanced at the libxml++ API documentation and as far as I can see libxml++ does not provide wrappers for the libxml namespace APIs. I could be wrong - I only spent a few minutes looking for namespace manipulation methods. You should examine the limxml++ documentation yourself carefully.
Login or Register to Ask a Question

Previous Thread | Next Thread

4 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to nodetype as "ELEMENT_NODE" using xml::libxml in perl?

Hi, I am using xml::libxml. Here is the code. my $parser = XML::LibXML->new(); my $xmldoc = $parser->parse_file ("file.xml") || die("Could not parse config xml file\n"); my $root = $xmldoc->getDocumentElement()|| die("Could not get Document Element \n"); $id="121313131"; # For example... (2 Replies)
Discussion started by: vanitham
2 Replies

2. Programming

[libxml++] DOmParser get node value

Hi I wrote the follow code: this->domParser = new xmlpp::DomParser(); this->domParser->set_validate(true); this->domParser->parse_file(*this->xmlFileName); this->doc = this->domParser->get_document(); xmlpp::Node* rootNode = this->doc->get_root_node(); xmlpp::Node::NodeList list =... (0 Replies)
Discussion started by: takeo.kikuta
0 Replies

3. Programming

libxml c

I've just started using libxml in c++, so far im able to parse a xml string. now i would like to replace <cms:CMSContent id="leftNav" /> with the string "left" and write the new xml out to cout; any ideas? string.xml <html xmlns:cms="http://www.test.com"> <body> <cms:CMSContent id="leftNav"... (1 Reply)
Discussion started by: spids
1 Replies

4. Programming

libxml c

i have xml file like this <root> <sree> <cnu value="cprogramming"\> </sree> </root> to retrieve the valuse of cnu element i tried the following code Code: void parseDoc() { xmlDocPtr doc; xmlNodePtr cur; doc = xmlParseFile("/usr/share/1.xml"); if (doc == NULL ) {... (1 Reply)
Discussion started by: phani_sree
1 Replies
Login or Register to Ask a Question