rossryan
asked on
MSXML
I am trying to add an element to an xml document:
<MSCommerceCatalogCollecti on2 version ="2.0"/>
MSXML does not want to...it screams about having quote marks in the follwing code:
"MSCommerceCatalogCollecti on2 version =\"2.0\""
How do I get it to work?
<MSCommerceCatalogCollecti
MSXML does not want to...it screams about having quote marks in the follwing code:
"MSCommerceCatalogCollecti
How do I get it to work?
Please post some code. Also note that you shouldn't be using MSXML anyways if you're writing C# code.
you can use like this...
<?xml version="1.0" ?>
- <MSCommerceCatalogCollecti on2 version="2.0">
- <CatalogSchema>
<AttributeDefinition Name="Unitofmeasure" dataType="string"
maxlength="20" />
<PropertyName ="myproperty" datatype = "string" Unitofmeasure="lbs"/>
</CatalogSchema>
</MSCommerceCatalogCollect ion2>
R.K
<?xml version="1.0" ?>
- <MSCommerceCatalogCollecti
- <CatalogSchema>
<AttributeDefinition Name="Unitofmeasure" dataType="string"
maxlength="20" />
<PropertyName ="myproperty" datatype = "string" Unitofmeasure="lbs"/>
</CatalogSchema>
</MSCommerceCatalogCollect
R.K
i think if you post your code bit we can help!!
ASKER
Here's the complete code. I am trying to automatically generate a Commerce Catalog, and it needs to fit the above for output.
using System;
using System.Collections;
namespace Shutters
{
/// <summary>
/// Summary description for Shutters.
/// </summary>
public class Shutters
{
[STAThread]
public static void Main()
{
Shutters shutter = new Shutters();
shutter.AddOptions();
shutter.AddMatrix();
MSXML2.DOMDocument40 shutters1 = new MSXML2.DOMDocument40();
if (createXMLDocument("MSComm erceCatalo gCollectio n2 version =\"2.0\"", ref shutters1))
{
//' ******* Build an Address Validation Request *****************
//'Adding Nodes to the XML document that was previously created.
AddNode(shutters1, "MSCommerceCatalogCollecti on2", "CatalogSchema", "EMPTY_NODE", "", "");
string Catalog = "Catalog name=\"Shutters\" startDate=\"2004-04-01\" endDate=\"2005-04-01\" variantUID=\"SKU\" productUID=\"Shutter Style\" currency=\"USD\" weight_measuring_unit=\"lb s\" DateChanged=\"2004-04-01T1 5:07:33\" DefaultLanguage=\"en-US\" ReportingLanguage=\"en-US\ " languages=\"en-US\"";
AddNode(shutters1, "MSCommerceCatalogCollecti on2", Catalog, "EMPTY_NODE", "", "");
for(int i = 0; i < shutter.Style.Count; i++)
{
shutter.style = (string)(shutter.Style[i]) ;
for(int e = 28; e < 121; e++)
{
shutter.height = e;
for(int z = 22; z < 73; z++)
{
shutter.width = z;
shutter.price = shutter.SelectMatrix(shutt er.height, shutter.width, shutter.style);
double listprice = shutter.price;
string style = shutter.style;
string id ="";
double width = shutter.width;
double height = shutter.height;
string Product ="";
if(e ==28)
{
Product = "Product Definition=\"Shutters\" listprice =\"" + listprice + "\" Shutter Style =\"" + style + "\" Image_filename=\" \" id=\"" + "\" ";
AddNode(shutters1, Catalog, Product, "EMPTY_NODE", "", "");
AddNode(shutters1, Product, "ParentCategory","EMPTY_NO DE", "", "");
AddNode(shutters1, Product, "Description Value=\"Crafted from the finest.\" language=\"en-US\"","EMPTY _NODE", "", "");
AddNode(shutters1, Product, "Name Value=\"" + style + "\" language=\"en-US\"","EMPTY _NODE", "", "");
}
AddNode(shutters1, Product, "ProductVariant listprice=\"" + listprice + "\" Shutter_x0020_Width=\"" + width + "\" Shutter_x0020_Height=\"" + height + "\"", "EMPTY_NODE", "", "");
}
}
}
}
shutters1.save("C:\\TESTER .XML");
}
public Shutters()
{
//
// TODO: Add constructor logic here
//
}
public void AddOptions()
{
Style.Add("Newark");
Style.Add("Warwick");
Style.Add("Cottage");
Style.Add("Oriole");
Style.Add("Devon");
Style.Add("Georgian");
Style.Add("Coventry");
Style.Add("Federal");
Style.Add("Colonial");
Style.Add("Parliament");
Style.Add("Garrison");
Style.Add("Charleston");
Style.Add("Hampton");
Style.Add("Roanoke");
Style.Add("Sheffield");
Style.Add("Richmond");
Style.Add("Orleans");
}
public void AddMatrix()
{
double[] row1 = {167.00, 176.00, 185.00, 194.00, 201.00, 218.00, 228.00, 238.00, 248.00, 259.00, 268.00, 278.00};
double[] row2 = {177.00, 187.00, 197.00, 207.00, 216.00, 233.00, 244.00, 255.00, 266.00, 277.00, 289.00, 300.00};
double[] row3 = {187.00, 198.00, 209.00, 220.00, 230.00, 248.00, 260.00, 272.00, 284.00, 297.00, 309.00, 321.00};
double[] row4 = {197.00, 209.00, 221.00, 233.00, 244.00, 263.00, 276.00, 289.00, 303.00, 316.00, 330.00, 343.00};
double[] row5 = {207.00, 220.00, 233.00, 245.00, 259.00, 277.00, 292.00, 306.00, 321.00, 336.00, 350.00, 363.00};
double[] row6 = {218.00, 231.00, 245.00, 259.00, 272.00, 293.00, 308.00, 323.00, 339.00, 354.00, 370.00, 386.00};
double[] row7 = {228.00, 243.00, 257.00, 272.00, 286.00, 307.00, 325.00, 341.00, 358.00, 374.00, 391.00, 407.00};
double[] row8 = {238.00, 254.00, 270.00, 285.00, 300.00, 323.00, 340.00, 358.00, 375.00, 393.00, 411.00, 429.00};
double[] row9 = {248.00, 265.00, 282.00, 298.00, 315.00, 338.00, 356.00, 375.00, 394.00, 413.00, 431.00, 442.00};
double[] row10 = {257.00, 276.00, 295.00, 311.00, 329.00, 352.00, 372.00, 392.00, 411.00, 431.00, 451.00, 472.00};
double[] row11 = {267.00, 287.00, 306.00, 325.00, 343.00, 367.00, 388.00, 409.00, 430.00, 451.00, 472.00, 493.00};
double[] row12 = {277.00, 298.00, 318.00, 338.00, 356.00, 382.00, 404.00, 424.00, 449.00, 471.00, 492.00, 515.00};
double[] row13 = {288.00, 306.00, 330.00, 351.00, 371.00, 397.00, 420.00, 443.00, 466.00, 486.00, 513.00, 536.00};
double[] row14 = {298.00, 320.00, 342.00, 364.00, 385.00, 413.00, 437.00, 461.00, 485.00, 509.00, 534.00, 558.00};
double[] row15 = {314.00, 341.00, 367.00, 393.00, 418.00, 448.00, 476.00, 506.00, 535.00, 564.00, 593.00, 623.00};
double[] row16 = {325.00, 353.00, 381.00, 408.00, 435.00, 464.00, 495.00, 525.00, 556.00, 586.00, 617.00, 648.00};
double[] row17 = {337.00, 365.00, 395.00, 422.00, 450.00, 482.00, 514.00, 545.00, 576.00, 608.00, 640.00, 672.00};
double[] row18 = {382.00, 416.00, 449.00, 481.00, 513.00, 549.00, 585.00, 622.00, 658.00, 693.00, 727.00, 763.00};
double[] row19 = {395.00, 430.00, 464.00, 497.00, 530.00, 568.00, 605.00, 642.00, 680.00, 718.00, 756.00, 793.00};
double[] row20 = {407.00, 443.00, 479.00, 514.00, 548.00, 586.00, 625.00, 664.00, 703.00, 741.00, 780.00, 820.00};
double[] row21 = {419.00, 458.00, 494.00, 530.00, 564.00, 605.00, 646.00, 685.00, 726.00, 767.00, 806.00, 847.00};
double[] row22 = {432.00, 471.00, 508.00, 546.00, 582.00, 624.00, 666.00, 707.00, 749.00, 791.00, 833.00, 875.00};
double[] row23 = {444.00, 486.00, 524.00, 563.00, 601.00, 644.00, 686.00, 730.00, 773.00, 816.00, 859.00, 903.00};
Matrix.Add(row1);
Matrix.Add(row2);
Matrix.Add(row3);
Matrix.Add(row4);
Matrix.Add(row5);
Matrix.Add(row6);
Matrix.Add(row7);
Matrix.Add(row8);
Matrix.Add(row9);
Matrix.Add(row10);
Matrix.Add(row11);
Matrix.Add(row12);
Matrix.Add(row13);
Matrix.Add(row14);
Matrix.Add(row15);
Matrix.Add(row16);
Matrix.Add(row17);
Matrix.Add(row18);
Matrix.Add(row19);
Matrix.Add(row20);
Matrix.Add(row21);
Matrix.Add(row22);
Matrix.Add(row23);
}
public double SelectMatrix(int height, int width, string style)
{
int mheight = 0;
int mwidth = 0;
if(height <= 31)
{
mheight = 0;
}
else if(height <= 35)
{
mheight = 1;
}
else if(height <= 39)
{
mheight = 2;
}
else if(height <= 43)
{
mheight = 3;
}
else if(height <= 47)
{
mheight = 4;
}
else if(height <= 51)
{
mheight = 5;
}
else if(height <= 55)
{
mheight = 6;
}
else if(height <= 59)
{
mheight = 7;
}
else if(height <= 63)
{
mheight = 8;
}
else if(height <= 67)
{
mheight = 9;
}
else if(height <= 71)
{
mheight = 10;
}
else if(height <= 75)
{
mheight = 11;
}
else if(height <= 79)
{
mheight = 12;
}
else if(height <= 83)
{
mheight = 13;
}
else if(height <= 87)
{
mheight = 14;
}
else if(height <= 91)
{
mheight = 15;
}
else if(height <= 95)
{
mheight = 16;
}
else if(height <= 99)
{
mheight = 17;
}
else if(height <= 103)
{
mheight = 18;
}
else if(height <= 107)
{
mheight = 19;
}
else if(height <= 111)
{
mheight = 20;
}
else if(height <= 115)
{
mheight = 21;
}
else
{
mheight = 22;
}
if(width <= 28)
{
mwidth = 0;
}
else if (width <= 32)
{
mwidth = 1;
}
else if (width <= 36)
{
mwidth = 2;
}
else if (width <= 40)
{
mwidth = 3;
}
else if (width <= 44)
{
mwidth = 4;
}
else if (width <= 48)
{
mwidth = 5;
}
else if (width <= 52)
{
mwidth = 6;
}
else if (width <= 56)
{
mwidth = 7;
}
else if (width <= 60)
{
mwidth = 8;
}
else if (width <= 64)
{
mwidth = 9;
}
else if (width <= 68)
{
mwidth = 10;
}
else
{
mwidth = 11;
}
double matrixcost;
matrixcost = ((double[])(Matrix[mheight ]))[mwidth ];
if(style == "Devon" || style == "Georgian" || style == "Coventry" || style == "Federal"
|| style == "Colonial" || style == "Parliament" || style == "Garrison" || style == "Orleans")
{
matrixcost += 30.00;
}
else if(style == "Board & Batten")
{
matrixcost += 50.00;
}
else if(style == "Heavy Board & Batten")
{
matrixcost += 220.00;
}
return matrixcost;
}
public static bool createXMLDocument(string rootname, ref MSXML2.DOMDocument40 xml)
{
//On Error GoTo ErrHand
MSXML2.DOMDocument40 docXML;
docXML = new MSXML2.DOMDocument40();
MSXML2.IXMLDOMNode parentNode;
MSXML2.IXMLDOMElement root;
MSXML2.IXMLDOMProcessingIn struction Prop;
string temp1;
string temp2;
string temp3;
//System.Diagnostics.Debug Debug;
docXML.async = false;
root = docXML.createElement(rootn ame);
docXML.loadXML(root.xml);
parentNode = root;
Prop = docXML.createProcessingIns truction(" xml", "version = '1.0'");
temp1 = Prop.xml;
temp2 = root.xml;
temp3 = temp1 + temp2;
docXML.loadXML(temp3);
xml = docXML;
return true;
//ErrHand:
//Debug.Write("Error creating Document (" & rootname & ")")
//createXMLDocument = False
//Debug.Write(Err.Descript ion)
}
public static bool AddNode(MSXML2.DOMDocument 40 doc, string strParentTag, string newTagName,
string textString, string attrName, string AttrValue)
{
//On Error GoTo ErrHand
//MSXML2.IXMLDOMElement Item;
//MSXML2.IXMLDOMElement root;
MSXML2.IXMLDOMAttribute oAttr;
MSXML2.IXMLDOMNode parentTag;
MSXML2.IXMLDOMNode Node;
//MSXML2.IXMLDOMNode pNode;
//MSXML2.IXMLDOMNode child;
//MSXML2.IXMLDOMText ThisNode;
MSXML2.IXMLDOMElement Parent;
//System.Diagnostics.Debug Debug;
//AddNode = true;
//' we are getting a nodelist because it allows us to specify the parent element
//' by its string name; that way, we don't have to pass Elements around
MSXML2.IXMLDOMNodeList N1;
parentTag = doc;
N1 = doc.getElementsByTagName(s trParentTa g);
if (N1.length > 0)
{
Parent = (MSXML2.IXMLDOMElement)N1[ N1.length - 1];
}
else
{
Parent = (MSXML2.IXMLDOMElement)par entTag;
}
if (!(string.Compare(textStri ng, "") == 0))
{
Node = doc.createNode(MSXML2.tagD OMNodeType .NODE_ELEM ENT, newTagName, "");
if (!(string.Compare(textStri ng, "EMPTY_NODE") == 0))
{
Node.nodeTypedValue = textString;
}
Parent.appendChild(Node);
return true;
}
else
{
if (!(((string.Compare(attrNa me, "") == 0) || (string.Compare(AttrValue, "") == 0))))
{
oAttr = doc.createAttribute(attrNa me);
Parent.setAttribute(attrNa me, AttrValue);
return true;
}
else
{
return false;
}
}
}
public ArrayList Style = new ArrayList();
public ArrayList Matrix = new ArrayList();
public string style;
public int height;
public int width;
public double price;
}
}
using System;
using System.Collections;
namespace Shutters
{
/// <summary>
/// Summary description for Shutters.
/// </summary>
public class Shutters
{
[STAThread]
public static void Main()
{
Shutters shutter = new Shutters();
shutter.AddOptions();
shutter.AddMatrix();
MSXML2.DOMDocument40 shutters1 = new MSXML2.DOMDocument40();
if (createXMLDocument("MSComm
{
//' ******* Build an Address Validation Request *****************
//'Adding Nodes to the XML document that was previously created.
AddNode(shutters1, "MSCommerceCatalogCollecti
string Catalog = "Catalog name=\"Shutters\" startDate=\"2004-04-01\" endDate=\"2005-04-01\" variantUID=\"SKU\" productUID=\"Shutter Style\" currency=\"USD\" weight_measuring_unit=\"lb
AddNode(shutters1, "MSCommerceCatalogCollecti
for(int i = 0; i < shutter.Style.Count; i++)
{
shutter.style = (string)(shutter.Style[i])
for(int e = 28; e < 121; e++)
{
shutter.height = e;
for(int z = 22; z < 73; z++)
{
shutter.width = z;
shutter.price = shutter.SelectMatrix(shutt
double listprice = shutter.price;
string style = shutter.style;
string id ="";
double width = shutter.width;
double height = shutter.height;
string Product ="";
if(e ==28)
{
Product = "Product Definition=\"Shutters\" listprice =\"" + listprice + "\" Shutter Style =\"" + style + "\" Image_filename=\" \" id=\"" + "\" ";
AddNode(shutters1, Catalog, Product, "EMPTY_NODE", "", "");
AddNode(shutters1, Product, "ParentCategory","EMPTY_NO
AddNode(shutters1, Product, "Description Value=\"Crafted from the finest.\" language=\"en-US\"","EMPTY
AddNode(shutters1, Product, "Name Value=\"" + style + "\" language=\"en-US\"","EMPTY
}
AddNode(shutters1, Product, "ProductVariant listprice=\"" + listprice + "\" Shutter_x0020_Width=\"" + width + "\" Shutter_x0020_Height=\"" + height + "\"", "EMPTY_NODE", "", "");
}
}
}
}
shutters1.save("C:\\TESTER
}
public Shutters()
{
//
// TODO: Add constructor logic here
//
}
public void AddOptions()
{
Style.Add("Newark");
Style.Add("Warwick");
Style.Add("Cottage");
Style.Add("Oriole");
Style.Add("Devon");
Style.Add("Georgian");
Style.Add("Coventry");
Style.Add("Federal");
Style.Add("Colonial");
Style.Add("Parliament");
Style.Add("Garrison");
Style.Add("Charleston");
Style.Add("Hampton");
Style.Add("Roanoke");
Style.Add("Sheffield");
Style.Add("Richmond");
Style.Add("Orleans");
}
public void AddMatrix()
{
double[] row1 = {167.00, 176.00, 185.00, 194.00, 201.00, 218.00, 228.00, 238.00, 248.00, 259.00, 268.00, 278.00};
double[] row2 = {177.00, 187.00, 197.00, 207.00, 216.00, 233.00, 244.00, 255.00, 266.00, 277.00, 289.00, 300.00};
double[] row3 = {187.00, 198.00, 209.00, 220.00, 230.00, 248.00, 260.00, 272.00, 284.00, 297.00, 309.00, 321.00};
double[] row4 = {197.00, 209.00, 221.00, 233.00, 244.00, 263.00, 276.00, 289.00, 303.00, 316.00, 330.00, 343.00};
double[] row5 = {207.00, 220.00, 233.00, 245.00, 259.00, 277.00, 292.00, 306.00, 321.00, 336.00, 350.00, 363.00};
double[] row6 = {218.00, 231.00, 245.00, 259.00, 272.00, 293.00, 308.00, 323.00, 339.00, 354.00, 370.00, 386.00};
double[] row7 = {228.00, 243.00, 257.00, 272.00, 286.00, 307.00, 325.00, 341.00, 358.00, 374.00, 391.00, 407.00};
double[] row8 = {238.00, 254.00, 270.00, 285.00, 300.00, 323.00, 340.00, 358.00, 375.00, 393.00, 411.00, 429.00};
double[] row9 = {248.00, 265.00, 282.00, 298.00, 315.00, 338.00, 356.00, 375.00, 394.00, 413.00, 431.00, 442.00};
double[] row10 = {257.00, 276.00, 295.00, 311.00, 329.00, 352.00, 372.00, 392.00, 411.00, 431.00, 451.00, 472.00};
double[] row11 = {267.00, 287.00, 306.00, 325.00, 343.00, 367.00, 388.00, 409.00, 430.00, 451.00, 472.00, 493.00};
double[] row12 = {277.00, 298.00, 318.00, 338.00, 356.00, 382.00, 404.00, 424.00, 449.00, 471.00, 492.00, 515.00};
double[] row13 = {288.00, 306.00, 330.00, 351.00, 371.00, 397.00, 420.00, 443.00, 466.00, 486.00, 513.00, 536.00};
double[] row14 = {298.00, 320.00, 342.00, 364.00, 385.00, 413.00, 437.00, 461.00, 485.00, 509.00, 534.00, 558.00};
double[] row15 = {314.00, 341.00, 367.00, 393.00, 418.00, 448.00, 476.00, 506.00, 535.00, 564.00, 593.00, 623.00};
double[] row16 = {325.00, 353.00, 381.00, 408.00, 435.00, 464.00, 495.00, 525.00, 556.00, 586.00, 617.00, 648.00};
double[] row17 = {337.00, 365.00, 395.00, 422.00, 450.00, 482.00, 514.00, 545.00, 576.00, 608.00, 640.00, 672.00};
double[] row18 = {382.00, 416.00, 449.00, 481.00, 513.00, 549.00, 585.00, 622.00, 658.00, 693.00, 727.00, 763.00};
double[] row19 = {395.00, 430.00, 464.00, 497.00, 530.00, 568.00, 605.00, 642.00, 680.00, 718.00, 756.00, 793.00};
double[] row20 = {407.00, 443.00, 479.00, 514.00, 548.00, 586.00, 625.00, 664.00, 703.00, 741.00, 780.00, 820.00};
double[] row21 = {419.00, 458.00, 494.00, 530.00, 564.00, 605.00, 646.00, 685.00, 726.00, 767.00, 806.00, 847.00};
double[] row22 = {432.00, 471.00, 508.00, 546.00, 582.00, 624.00, 666.00, 707.00, 749.00, 791.00, 833.00, 875.00};
double[] row23 = {444.00, 486.00, 524.00, 563.00, 601.00, 644.00, 686.00, 730.00, 773.00, 816.00, 859.00, 903.00};
Matrix.Add(row1);
Matrix.Add(row2);
Matrix.Add(row3);
Matrix.Add(row4);
Matrix.Add(row5);
Matrix.Add(row6);
Matrix.Add(row7);
Matrix.Add(row8);
Matrix.Add(row9);
Matrix.Add(row10);
Matrix.Add(row11);
Matrix.Add(row12);
Matrix.Add(row13);
Matrix.Add(row14);
Matrix.Add(row15);
Matrix.Add(row16);
Matrix.Add(row17);
Matrix.Add(row18);
Matrix.Add(row19);
Matrix.Add(row20);
Matrix.Add(row21);
Matrix.Add(row22);
Matrix.Add(row23);
}
public double SelectMatrix(int height, int width, string style)
{
int mheight = 0;
int mwidth = 0;
if(height <= 31)
{
mheight = 0;
}
else if(height <= 35)
{
mheight = 1;
}
else if(height <= 39)
{
mheight = 2;
}
else if(height <= 43)
{
mheight = 3;
}
else if(height <= 47)
{
mheight = 4;
}
else if(height <= 51)
{
mheight = 5;
}
else if(height <= 55)
{
mheight = 6;
}
else if(height <= 59)
{
mheight = 7;
}
else if(height <= 63)
{
mheight = 8;
}
else if(height <= 67)
{
mheight = 9;
}
else if(height <= 71)
{
mheight = 10;
}
else if(height <= 75)
{
mheight = 11;
}
else if(height <= 79)
{
mheight = 12;
}
else if(height <= 83)
{
mheight = 13;
}
else if(height <= 87)
{
mheight = 14;
}
else if(height <= 91)
{
mheight = 15;
}
else if(height <= 95)
{
mheight = 16;
}
else if(height <= 99)
{
mheight = 17;
}
else if(height <= 103)
{
mheight = 18;
}
else if(height <= 107)
{
mheight = 19;
}
else if(height <= 111)
{
mheight = 20;
}
else if(height <= 115)
{
mheight = 21;
}
else
{
mheight = 22;
}
if(width <= 28)
{
mwidth = 0;
}
else if (width <= 32)
{
mwidth = 1;
}
else if (width <= 36)
{
mwidth = 2;
}
else if (width <= 40)
{
mwidth = 3;
}
else if (width <= 44)
{
mwidth = 4;
}
else if (width <= 48)
{
mwidth = 5;
}
else if (width <= 52)
{
mwidth = 6;
}
else if (width <= 56)
{
mwidth = 7;
}
else if (width <= 60)
{
mwidth = 8;
}
else if (width <= 64)
{
mwidth = 9;
}
else if (width <= 68)
{
mwidth = 10;
}
else
{
mwidth = 11;
}
double matrixcost;
matrixcost = ((double[])(Matrix[mheight
if(style == "Devon" || style == "Georgian" || style == "Coventry" || style == "Federal"
|| style == "Colonial" || style == "Parliament" || style == "Garrison" || style == "Orleans")
{
matrixcost += 30.00;
}
else if(style == "Board & Batten")
{
matrixcost += 50.00;
}
else if(style == "Heavy Board & Batten")
{
matrixcost += 220.00;
}
return matrixcost;
}
public static bool createXMLDocument(string rootname, ref MSXML2.DOMDocument40 xml)
{
//On Error GoTo ErrHand
MSXML2.DOMDocument40 docXML;
docXML = new MSXML2.DOMDocument40();
MSXML2.IXMLDOMNode parentNode;
MSXML2.IXMLDOMElement root;
MSXML2.IXMLDOMProcessingIn
string temp1;
string temp2;
string temp3;
//System.Diagnostics.Debug
docXML.async = false;
root = docXML.createElement(rootn
docXML.loadXML(root.xml);
parentNode = root;
Prop = docXML.createProcessingIns
temp1 = Prop.xml;
temp2 = root.xml;
temp3 = temp1 + temp2;
docXML.loadXML(temp3);
xml = docXML;
return true;
//ErrHand:
//Debug.Write("Error creating Document (" & rootname & ")")
//createXMLDocument = False
//Debug.Write(Err.Descript
}
public static bool AddNode(MSXML2.DOMDocument
string textString, string attrName, string AttrValue)
{
//On Error GoTo ErrHand
//MSXML2.IXMLDOMElement Item;
//MSXML2.IXMLDOMElement root;
MSXML2.IXMLDOMAttribute oAttr;
MSXML2.IXMLDOMNode parentTag;
MSXML2.IXMLDOMNode Node;
//MSXML2.IXMLDOMNode pNode;
//MSXML2.IXMLDOMNode child;
//MSXML2.IXMLDOMText ThisNode;
MSXML2.IXMLDOMElement Parent;
//System.Diagnostics.Debug
//AddNode = true;
//' we are getting a nodelist because it allows us to specify the parent element
//' by its string name; that way, we don't have to pass Elements around
MSXML2.IXMLDOMNodeList N1;
parentTag = doc;
N1 = doc.getElementsByTagName(s
if (N1.length > 0)
{
Parent = (MSXML2.IXMLDOMElement)N1[
}
else
{
Parent = (MSXML2.IXMLDOMElement)par
}
if (!(string.Compare(textStri
{
Node = doc.createNode(MSXML2.tagD
if (!(string.Compare(textStri
{
Node.nodeTypedValue = textString;
}
Parent.appendChild(Node);
return true;
}
else
{
if (!(((string.Compare(attrNa
{
oAttr = doc.createAttribute(attrNa
Parent.setAttribute(attrNa
return true;
}
else
{
return false;
}
}
}
public ArrayList Style = new ArrayList();
public ArrayList Matrix = new ArrayList();
public string style;
public int height;
public int width;
public double price;
}
}
ASKER
If you know how to swap out the above code for .NET code, I'd really appreciate it. Just make sure I can create an xml docoument with a base element, and be able to add elements to that.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Very nice. Thanks.