Hello,
Would you tell me if there is a way to extract a single node as a new
xmldocument?
Thanks. 4 1793
Carlos,
You would need to :
1) Create a new XmlDocument.
2) use the ImportNode method to bring in the node from the other XmlDocument.
See MSDN Library Help or online for code samples.
Peter
--
Co-founder, Eggheadcafe.com developer portal: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
"Carlos Albert" wrote: Hello,
Would you tell me if there is a way to extract a single node as a new xmldocument?
Thanks.
Tnx, but I tried to do this and I'm doing something very wrong (cause it
doesn't work at all):
Dim big_xml As New XmlDocument
big_xml.LoadXml(xml)
Dim small_xml As New XmlDocument
Dim result As XmlNode =
small_xml.ImportNode(big_xml.GetElementsByTagName( "node_tag_name").Item(0),
True)
small_xml.DocumentElement.AppendChild(result)
"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.com> wrote in message
news:88**********************************@microsof t.com... Carlos, You would need to : 1) Create a new XmlDocument. 2) use the ImportNode method to bring in the node from the other XmlDocument.
See MSDN Library Help or online for code samples.
Peter
-- Co-founder, Eggheadcafe.com developer portal: http://www.eggheadcafe.com UnBlog: http://petesbloggerama.blogspot.com
"Carlos Albert" wrote:
Hello,
Would you tell me if there is a way to extract a single node as a new xmldocument?
Thanks.
Break up your code into smaller pieces so it's easier to see what is happening
on each line with debugger step-through.
Also, ensure the new document has the correct processing instruction, root
element, etc. to be valid.
Also, it looks to me like you are trying to import your node from the new
document instead of the original!
Peter
--
Co-founder, Eggheadcafe.com developer portal: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
"Carlos Albert" wrote: Tnx, but I tried to do this and I'm doing something very wrong (cause it doesn't work at all):
Dim big_xml As New XmlDocument
big_xml.LoadXml(xml)
Dim small_xml As New XmlDocument
Dim result As XmlNode = small_xml.ImportNode(big_xml.GetElementsByTagName( "node_tag_name").Item(0), True)
small_xml.DocumentElement.AppendChild(result) "Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.com> wrote in message news:88**********************************@microsof t.com... Carlos, You would need to : 1) Create a new XmlDocument. 2) use the ImportNode method to bring in the node from the other XmlDocument.
See MSDN Library Help or online for code samples.
Peter
-- Co-founder, Eggheadcafe.com developer portal: http://www.eggheadcafe.com UnBlog: http://petesbloggerama.blogspot.com
"Carlos Albert" wrote:
Hello,
Would you tell me if there is a way to extract a single node as a new xmldocument?
Thanks.
Made it work, thanks! =)
Dim big_xml As New XmlDocument
big_xml.LoadXml(xml)
Dim small_xml As New XmlDocument
Dim result As XmlNode
result =
small_xml.ImportNode(big_xml.GetElementsByTagName( "small_xml").Item(0),
True)
small_xml.LoadXml("<small_xml>" & result.InnerXml & "</small_xml>")
"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.com> wrote in message
news:CA**********************************@microsof t.com... Break up your code into smaller pieces so it's easier to see what is happening on each line with debugger step-through. Also, ensure the new document has the correct processing instruction, root element, etc. to be valid. Also, it looks to me like you are trying to import your node from the new document instead of the original!
Peter
-- Co-founder, Eggheadcafe.com developer portal: http://www.eggheadcafe.com UnBlog: http://petesbloggerama.blogspot.com
"Carlos Albert" wrote:
Tnx, but I tried to do this and I'm doing something very wrong (cause it doesn't work at all):
Dim big_xml As New XmlDocument
big_xml.LoadXml(xml)
Dim small_xml As New XmlDocument
Dim result As XmlNode = small_xml.ImportNode(big_xml.GetElementsByTagName( "node_tag_name").Item(0), True)
small_xml.DocumentElement.AppendChild(result) "Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.com> wrote in message news:88**********************************@microsof t.com... > Carlos, > You would need to : > 1) Create a new XmlDocument. > 2) use the ImportNode method to bring in the node from the other > XmlDocument. > > See MSDN Library Help or online for code samples. > > Peter > > -- > Co-founder, Eggheadcafe.com developer portal: > http://www.eggheadcafe.com > UnBlog: > http://petesbloggerama.blogspot.com > > > > > "Carlos Albert" wrote: > >> Hello, >> >> Would you tell me if there is a way to extract a single node as a new >> xmldocument? >> >> Thanks. >> >> >> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Christian Schmidbauer |
last post by:
Hello!
I prepare my XML document like this way:
-------------------------------------------------------
PrintWriter writer;
Document domDocument;
Element domElement;
// Root tag
|
by: Donald Firesmith |
last post by:
I am having trouble having Google Adsense code stored in XSL converted
properly into HTML. The <> unfortunately become < and > and then
no longer work.
XSL code is:
<script...
|
by: Casper B |
last post by:
As the topic says, I am wondering how (in Java) I can extract a sub-tree
of a org.w3c.dom.Document and form a brand new one. I use Oracle's
XMLDocument implementation and have been playing around...
|
by: Wang, Jay |
last post by:
Hello, all,
I would like to enable some text between <SPAN
url="http://www.testserver.com/">WORD TO BE DRAGGED </SPAN>. I put some
javascript and it will extract http://www.testserver.com/ from...
|
by: bissatch |
last post by:
Hi,
I am currently writing a simple PHP program that uses an XML file to
output rows for a 'Whats New' page. Once written, I will only require
updating the XML file and any pages that use the...
|
by: Victor Hadianto |
last post by:
Hi,
If I have an XmlDocument DOM how do I insert
<?mso-application progid="ProgId.Here"?> programmatically?
--
Victor Hadianto
http://www.synop.com/Products/SauceReader/
|
by: hharry |
last post by:
Hello All,
I have the following xml file: which I read into a string (sXML)
<?xml version="1.0" ?>
- <BackgroundReports xmlns="http://ns.hr-xml.org/2004-08-02" userId=""
password="">
-...
|
by: David Thielen |
last post by:
Hi;
I have a node where it is "<w:t> </w:t>" and what I get from XmlTextReader
is Element, SignificantWhitespace, EndElement instead of Element, Text,
EndElement.
Question 1 is why? The text...
|
by: rrayfield |
last post by:
I have a XML file that contains content for an asp.net website. I need the quickest way to find the node and write the elements out to the page. Also how would I get the links section out of it? ...
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
| |