I'm using DOM and ASP to output an XML file, which should look like this:
<filmarchive>
<film film_id="">
<title>Donnie Darko</title>
</film>
</filmarchive>
I request the inputdata from a form:
strfilm_id = Request.Form( "film_id" )
strtitle = Request.Form( "title" )
I then do the following:
XMLnode = "<film>" & _
Chr(13) & Chr(10) & Chr(9) & _
"<film_id>" & strDatum & "</film_id>" & _
Chr(13) & Chr(10) & Chr(9) & _ "<titel>" & strtitel & "</titel>" & _
Chr(13) & Chr(10) & Chr(10) & Chr(10) & Chr(9) & _
"</film>" & _
The above code nicely puts each artikle below each other in the XML file.
However, 'film_id' is currently an element, and I want it to be an attibute of the <film> element. How should I do this?
Below is the code I use to generate the XML file:
Set rootContent = objXML.documentElement
Set objXML2 = Server.CreateObject("Microsoft.XMLDOM")
objXML2.loadXML(XMLnode)
Set rootNewNode = objXML2.documentElement
Set refNode = rootContent.firstChild
rootContent.insertBefore rootNewNode, refNode
Any help would be greatly appreciated!
<filmarchive>
<film film_id="">
<title>Donnie Darko</title>
</film>
</filmarchive>
I request the inputdata from a form:
strfilm_id = Request.Form( "film_id" )
strtitle = Request.Form( "title" )
I then do the following:
XMLnode = "<film>" & _
Chr(13) & Chr(10) & Chr(9) & _
"<film_id>" & strDatum & "</film_id>" & _
Chr(13) & Chr(10) & Chr(9) & _ "<titel>" & strtitel & "</titel>" & _
Chr(13) & Chr(10) & Chr(10) & Chr(10) & Chr(9) & _
"</film>" & _
The above code nicely puts each artikle below each other in the XML file.
However, 'film_id' is currently an element, and I want it to be an attibute of the <film> element. How should I do this?
Below is the code I use to generate the XML file:
Set rootContent = objXML.documentElement
Set objXML2 = Server.CreateObject("Microsoft.XMLDOM")
objXML2.loadXML(XMLnode)
Set rootNewNode = objXML2.documentElement
Set refNode = rootContent.firstChild
rootContent.insertBefore rootNewNode, refNode
Any help would be greatly appreciated!