![]() ![]() The example uses the file, booksort.xml, as input. ![]() #using īook = root->SelectSingleNode( "descendant::book" ) Ĭonsole::WriteLine( "Display the modified XML document." ) īook=root.SelectSingleNode("descendant::book") Ĭonsole.WriteLine("Display the modified XML document.") ĭim doc as XmlDocument = new XmlDocument()ĭim root as XmlNode = doc.DocumentElementīook=root.SelectSingleNode("descendant::book")Ĭonsole.WriteLine("Display the modified XML document.") The following example changes the price of the first Jane Austen book. If the XPath expression includes a prefix, the prefix and namespace URI pair must be added to the XmlNamespaceManager. Namespace resolution is supported using the XmlNamespaceManager. XPath expressions can include namespaces. The example uses the file, newbooks.xml, as input. 'Select the book written by an author whose last name is Atwood.ĭim root As XmlElement = doc.DocumentElementīook = root.SelectSingleNode("descendant::bk:book", nsmgr) Nsmgr.AddNamespace("bk", "urn:newbooks-schema") 'Create an XmlNamespaceManager for resolving namespaces.ĭim nsmgr As XmlNamespaceManager = New XmlNamespaceManager(doc.NameTable) Nsmgr.AddNamespace("bk", "urn:newbooks-schema") īook = root.SelectSingleNode("descendant::bk:book", nsmgr) ĭim doc As XmlDocument = New XmlDocument() XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable) Select the first book written by an author whose last name is Atwood.īook = root->SelectSingleNode( L"descendant::bk:book", nsmgr ) Nsmgr->AddNamespace( L"bk", L"urn:newbooks-schema" ) XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager( doc->NameTable ) Create an XmlNamespaceManager to resolve the default namespace. The XmlNamespaceManager resolves the default namespace in the XPath expression. The following example returns the first book with the matching author name. Any prefixes found in the XPath expression are resolved using the supplied XmlNamespaceManager. Selects the first XmlNode that matches the XPath expression. SelectSingleNode(String, XmlNamespaceManager) ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |