Hi, Bojan
I would do it this way:

    XMLDocument myXML = new XMLDocument();
    XMLNode n;
    ;
    n = myXML.createElement("tn");
    myXML.appendChild(n);
    myXML.save("C:\\mile.xml");

Result file will contain only this string:
<tn/>

If you want some sub-nodes under "tn" section, append children the same way to "n" node.

If you want to create attributes, use XMLAttribute:
    /* ... */
    XMLAttribute  xAttribute;
    ;
    n = myXML.createElement("tn");
    xAttribute = myXML.createAttribute("Attribute_1");
    xAttribute.setNodeTypedValue("value1");
    n.attributes().setNamedItem(xAttribute);
    myXML.appendChild(n);
    myXML.save("C:\\mile.xml");

Not tested, but hope this helps :-)

--- In [EMAIL PROTECTED], Bojan Jovicic <[EMAIL PROTECTED]> wrote:
> Has anyone tried export data to XML?
> How do you assign name to a node?
> Here is some sample code, that doesn't to much:
>     XMLDocument myXML = new XMLDocument();
>     XMLNode n;
>     ;
>    
>    
>     myXML.createTextNode("tn");
>     n = myXML.createTextNode("tn");
>     n.nodeValue("aaaa2");
>     // This doesnt work, and I dont know how to assign value/name to root node
>     myXML.root().appendChild(n);
>     myXML.save("C:\\mile.xml");
>
>            
> ---------------------------------
> Do you Yahoo!?
> Yahoo! Mail Address AutoComplete - You start. We finish.
>
> [Non-text portions of this message have been removed]



Yahoo! Groups Sponsor
ADVERTISEMENT
click here


Yahoo! Groups Links

Reply via email to