Create Element from XML String - XML SOAP

This is a discussion on Create Element from XML String - XML SOAP ; Hi, I have a string like "<DATA attr1=100><Item id=1 value=hello /></ DATA>" and I have an XML document such as the following: <Document> <Content> <!-- I need to insert the DATA tag here --> </Content> </Document> The document is already ...

+ Reply to Thread
Results 1 to 2 of 2

Create Element from XML String

  1. Default Create Element from XML String

    Hi,

    I have a string like "<DATA attr1=100><Item id=1 value=hello /></
    DATA>" and I have an XML document such as the following:
    <Document>
    <Content>
    <!-- I need to insert the DATA tag here -->
    </Content>
    </Document>

    The document is already loaded into an XMLDOMDocument object. I would
    like to insert the XML in the string within the <Content> element. How
    do I do it using MSXML? Is there a way to create an element directly
    from its XML definition?


  2. Default Re: Create Element from XML String

    T wrote:

    > I have a string like "<DATA attr1=100><Item id=1 value=hello /></
    > DATA>"


    Attribute values need to be quoted so that snippet is not well-formed
    and therefore can't be parsed successfully as XML.


    > and I have an XML document such as the following:
    > <Document>
    > <Content>
    > <!-- I need to insert the DATA tag here -->
    > </Content>
    > </Document>
    >
    > The document is already loaded into an XMLDOMDocument object. I would
    > like to insert the XML in the string within the <Content> element. How
    > do I do it using MSXML? Is there a way to create an element directly
    > from its XML definition?


    You need to use a second document and call loadXML on it, then you can
    move or import (MSXML 5/6) the nodes to the original document.


    --

    Martin Honnen --- MVP XML
    http://JavaScript.FAQTs.com/

+ Reply to Thread

Similar Threads

  1. Create Permutations from Dictionary<string, List<string>>
    By Application Development in forum CSharp
    Replies: 2
    Last Post: 11-30-2007, 02:50 PM
  2. Replies: 0
    Last Post: 10-24-2007, 11:40 AM
  3. Strange string in XML element
    By Application Development in forum RUBY
    Replies: 3
    Last Post: 09-12-2007, 02:21 PM
  4. Re: finding an element in a string
    By Application Development in forum Python
    Replies: 0
    Last Post: 06-25-2007, 03:21 PM
  5. How to create element in namespace
    By Application Development in forum XML SOAP
    Replies: 4
    Last Post: 04-21-2006, 12:55 PM