Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Very basic XML question, I am sure... >Thread Next - Re: Very basic XML question, I am sure... Re: Very basic XML question, I am sure...To: NULL Date: 8/2/2004 10:30:00 AM
"Craig" <brokenleg@h...> wrote in message
news:410e01c8$0$7133$db0fefd9@n......
> I am new to XML, and am trying to create a brand new document. I don't
want
> to use myXML.load('....');
>
> I need to create the nodes with functions of MSXML.
>
> This is what I have. (Delphi code, but understandable)
>
> outMSXML.loadXML('<?xml version = ''1.0''?>');
> rootNode := outMSXML.DocumentElement;
>
> newNode := outMSXML.createNode(1, 'NLIS_MESSAGE',
> 'http://www.www.www/NS/2001-01-10');
> rootNode.appendChild( newNode );
>
> However, this is wrong. For a start, rootNode is nil, as there isn't a
node
> yet. How do I start it off? How do I create the first line? Below, os what
I
> am trying to obtain.
>
>
> <NLIS_MESSAGE xmlns="http://www.www.www/NS/2001-01-10"
> xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
> xsi:schemaLocation="http://www.www.www/NS/2001-01-10 LA_Requests.xsd">
> <NLIS_HEADER>
> <INTERFACE_VERSION_NUMBER>6.00</INTERFACE_VERSION_NUMBER>
You don't have to append to .documentelement, you can append to outMSXML
directly. The first element node you append to the root of the dom becomes
to document element.
outMSXML.loadXML('<?xml version = ''1.0''?>');
newNode := outMSXML.createNode(1,
'NLIS_MESSAGE','http://www.www.www/NS/2001-01-10');
outMSXML.appendChild(newNode);
rootNode := outMSXML.DocumentElement;
headernode =
outMSXML.createnode(1,"NLIS_HEADER","http://www.www.www/NS/2001-01-10")
rootnode.appenchild(headernode)
ivnnode =
outmsxml.createnode(1,"INTERFACE_VERSION_NUMBER","http://www.www.www/NS/2001
-01-10")
headernode.appendchild(ivnnode)
ivnnode.text = "6.00"
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
