Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - need a help to create XML node with text and sub child. [Thread Next] Re: need a help to create XML node with text and sub child.To: NULL Date: 3/5/2008 3:17:00 PM
erbrmn@g... wrote:
> I want to create "ADDR" node with text and child node.
> (First child node and then text.)
>
> <?xml version="1.0" encoding="UTF-8" ?>
> - <ROOT>
> - <NODE>
> <child-1 attr="attr-value">This is child text</child-1>
> - <ADDR>
> <postcode>12345</postcode>
> Address information
> </ADDR>
Set addr = xmlDoc.createElement("ADDR")
Set postcode = xmlDoc.createElement("postcode")
postcode.text = "12345"
addr.appendChild postcode
addr.appendChild xmlDoc.createTextNode("Address information")
Note that your XML is poorly structured, mixed contents of an ADDR
element with a child element and a child text node is not a good
structure, you might want to use a second child element instead of the
text node.
--
Martin Honnen
http://JavaScript.FAQTs.com/
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
