MSXML

I am trying to add an element to an xml document:

<MSCommerceCatalogCollection2 version ="2.0"/>

MSXML does not want to...it screams about having quote marks in the follwing code:

"MSCommerceCatalogCollection2 version =\"2.0\""

How do I get it to work?



rossryanAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
AvonWyssConnect With a Mentor Commented:
Okay, I rewrote pretty much the whole thing. Does this what you wanted?

using System;
using System.Collections;
using System.Xml;

namespace Shutters {
      /// <summary>
      /// Summary description for Shutters.
      /// </summary>
      public class Shutters {
            #region constants
            public static readonly string[] Style = new string[] {
                                                                                                                                                                               "Warwick",
                                                                                                                                                                               "Cottage",
                                                                                                                                                                               "Oriole",
                                                                                                                                                                               "Devon",
                                                                                                                                                                               "Georgian",
                                                                                                                                                                               "Coventry",
                                                                                                                                                                               "Federal",
                                                                                                                                                                               "Colonial",
                                                                                                                                                                               "Parliament",
                                                                                                                                                                               "Garrison",
                                                                                                                                                                               "Charleston",
                                                                                                                                                                               "Hampton",
                                                                                                                                                                               "Roanoke",
                                                                                                                                                                               "Sheffield",
                                                                                                                                                                               "Richmond",
                                                                                                                                                                               "Orleans"};

            public static readonly double[][] Matrix=new double[][] {new double[] {167.00, 176.00, 185.00, 194.00, 201.00, 218.00, 228.00, 238.00, 248.00, 259.00, 268.00, 278.00},
                                                                                                                                                                                          new double[] {177.00, 187.00, 197.00, 207.00, 216.00, 233.00, 244.00, 255.00, 266.00, 277.00, 289.00, 300.00},
                                                                                                                                                                                          new double[] {187.00, 198.00, 209.00, 220.00, 230.00, 248.00, 260.00, 272.00, 284.00, 297.00, 309.00, 321.00},
                                                                                                                                                                                          new double[] {197.00, 209.00, 221.00, 233.00, 244.00, 263.00, 276.00, 289.00, 303.00, 316.00, 330.00, 343.00},
                                                                                                                                                                                          new double[] {207.00, 220.00, 233.00, 245.00, 259.00, 277.00, 292.00, 306.00, 321.00, 336.00, 350.00, 363.00},
                                                                                                                                                                                          new double[] {218.00, 231.00, 245.00, 259.00, 272.00, 293.00, 308.00, 323.00, 339.00, 354.00, 370.00, 386.00},
                                                                                                                                                                                          new double[] {228.00, 243.00, 257.00, 272.00, 286.00, 307.00, 325.00, 341.00, 358.00, 374.00, 391.00, 407.00},
                                                                                                                                                                                          new double[] {238.00, 254.00, 270.00, 285.00, 300.00, 323.00, 340.00, 358.00, 375.00, 393.00, 411.00, 429.00},
                                                                                                                                                                                          new double[] {248.00, 265.00, 282.00, 298.00, 315.00, 338.00, 356.00, 375.00, 394.00, 413.00, 431.00, 442.00},
                                                                                                                                                                                          new double[] {257.00, 276.00, 295.00, 311.00, 329.00, 352.00, 372.00, 392.00, 411.00, 431.00, 451.00, 472.00},
                                                                                                                                                                                          new double[] {267.00, 287.00, 306.00, 325.00, 343.00, 367.00, 388.00, 409.00, 430.00, 451.00, 472.00, 493.00},
                                                                                                                                                                                          new double[] {277.00, 298.00, 318.00, 338.00, 356.00, 382.00, 404.00, 424.00, 449.00, 471.00, 492.00, 515.00},
                                                                                                                                                                                          new double[] {288.00, 306.00, 330.00, 351.00, 371.00, 397.00, 420.00, 443.00, 466.00, 486.00, 513.00, 536.00},
                                                                                                                                                                                          new double[] {298.00, 320.00, 342.00, 364.00, 385.00, 413.00, 437.00, 461.00, 485.00, 509.00, 534.00, 558.00},
                                                                                                                                                                                          new double[] {314.00, 341.00, 367.00, 393.00, 418.00, 448.00, 476.00, 506.00, 535.00, 564.00, 593.00, 623.00},
                                                                                                                                                                                          new double[] {325.00, 353.00, 381.00, 408.00, 435.00, 464.00, 495.00, 525.00, 556.00, 586.00, 617.00, 648.00},
                                                                                                                                                                                          new double[] {337.00, 365.00, 395.00, 422.00, 450.00, 482.00, 514.00, 545.00, 576.00, 608.00, 640.00, 672.00},
                                                                                                                                                                                          new double[] {382.00, 416.00, 449.00, 481.00, 513.00, 549.00, 585.00, 622.00, 658.00, 693.00, 727.00, 763.00},
                                                                                                                                                                                          new double[] {395.00, 430.00, 464.00, 497.00, 530.00, 568.00, 605.00, 642.00, 680.00, 718.00, 756.00, 793.00},
                                                                                                                                                                                          new double[] {407.00, 443.00, 479.00, 514.00, 548.00, 586.00, 625.00, 664.00, 703.00, 741.00, 780.00, 820.00},
                                                                                                                                                                                          new double[] {419.00, 458.00, 494.00, 530.00, 564.00, 605.00, 646.00, 685.00, 726.00, 767.00, 806.00, 847.00},
                                                                                                                                                                                          new double[] {432.00, 471.00, 508.00, 546.00, 582.00, 624.00, 666.00, 707.00, 749.00, 791.00, 833.00, 875.00},
                                                                                                                                                                                          new double[] {444.00, 486.00, 524.00, 563.00, 601.00, 644.00, 686.00, 730.00, 773.00, 816.00, 859.00, 903.00}
                                                                                                                                                                                    };
            #endregion

            [STAThread]
            public static void Main() {
                  //' ******* Build an Address Validation Request *****************
                  //'Adding Nodes to the XML document that was previously created.
                  XmlDocument shutters=new XmlDocument();
                  shutters.AppendChild(shutters.CreateXmlDeclaration("1.0", System.Text.Encoding.UTF8.BodyName, string.Empty));
                  shutters.AppendChild(shutters.CreateElement("MSCommerceCatalogCollection2"));
                  shutters.DocumentElement.SetAttribute("version", "2.0");
                  shutters.DocumentElement.AppendChild(shutters.CreateElement("CatalogSchema"));
                  XmlElement catalog=shutters.CreateElement("Catalog");
                  catalog.SetAttribute("name", "Shutters");
                  catalog.SetAttribute("startDate", DateTime.Now.ToString("yyyy-mm-dd"));
                  catalog.SetAttribute("endDate", DateTime.Now.AddYears(1).ToString("yyyy-mm-dd"));
                  catalog.SetAttribute("variantUID", "SKU");
                  catalog.SetAttribute("productUID", "Shutter Style");
                  catalog.SetAttribute("currency", "USD");
                  catalog.SetAttribute("weight_measuring_unit", "lbs");
                  catalog.SetAttribute("DateChanged", DateTime.Now.ToString("s"));
                  catalog.SetAttribute("DefaultLanguage", "en-US");
                  catalog.SetAttribute("ReportingLanguage", "en-US");
                  catalog.SetAttribute("languages", "en-US");
                  shutters.DocumentElement.AppendChild(catalog);

                  foreach (string style in Style) {
                        XmlElement product=shutters.CreateElement("Product");
                        product.SetAttribute("Definition", "Shutters");
                        product.SetAttribute("Style", style);
                        product.SetAttribute("Image_filename", "");
                        product.SetAttribute("id", "");
                        product.AppendChild(shutters.CreateElement("ParentCategory"));
                        XmlElement description=shutters.CreateElement("Description");
                        description.SetAttribute("Value", "Crafted from the finest.");
                        description.SetAttribute("language", "en-US");
                        product.AppendChild(description);
                        XmlElement name=shutters.CreateElement("Name");
                        name.SetAttribute("Value", style);
                        name.SetAttribute("language", "en-US");
                        product.AppendChild(name);
                        catalog.AppendChild(product);
                        for (int height=28; height<121; height++) {
                              for (int width= 22; width<73; width++) {
                                    XmlElement variant=shutters.CreateElement("ProductVariant");
                                    variant.SetAttribute("listprice", SelectMatrix(height, width, style).ToString());
                                    variant.SetAttribute("ShutterWidth", width.ToString());
                                    variant.SetAttribute("ShutterHeight", height.ToString());
                                    product.AppendChild(variant);
                              }
                        }
                  }
                  XmlTextWriter formattedWriter=new XmlTextWriter(@"C:\TESTER.XML", System.Text.Encoding.UTF8);
                  formattedWriter.Formatting=Formatting.Indented;
                  formattedWriter.Indentation=1;
                  formattedWriter.IndentChar='\t';
                  shutters.Save(formattedWriter);
            }

            public static double SelectMatrix(int height, int width, string style) {
                  double matrixcost=Matrix[Math.Min(Math.Max(0, (height-28)/4), Matrix.GetUpperBound(0))][Math.Min(Math.Max(0, (width-29)/4), Matrix[0].GetUpperBound(0))];

                  switch (style) {
                  case "Devon":
                  case "Georgian":
                  case "Coventry":
                  case "Federal":
                  case "Colonial":
                  case "Parliament":
                  case "Garrison":
                  case "Orleans":
                        matrixcost += 30.00;
                        break;
                  case "Board & Batten":
                        matrixcost += 50.00;
                        break;
                  case "Heavy Board & Batten":
                        matrixcost += 220.00;
                        break;
                  }
                  return matrixcost;
            }
      }
}
0
 
AvonWyssCommented:
Please post some code. Also note that you shouldn't be using MSXML anyways if you're writing C# code.
0
 
rama_krishna580Commented:
you can use like this...

<?xml version="1.0" ?>
-    <MSCommerceCatalogCollection2 version="2.0">
-       <CatalogSchema>
<AttributeDefinition Name="Unitofmeasure" dataType="string"
maxlength="20" />        
<PropertyName ="myproperty" datatype = "string" Unitofmeasure="lbs"/>
  </CatalogSchema>
  </MSCommerceCatalogCollection2>

R.K
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
Vaishali_chaudhryCommented:
i think if you post your code bit we can help!!
0
 
rossryanAuthor Commented:
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("MSCommerceCatalogCollection2 version =\"2.0\"", ref shutters1))
                  {
                        //' ******* Build an Address Validation Request *****************
                        //'Adding Nodes to the XML document that was previously created.
                  
                        AddNode(shutters1, "MSCommerceCatalogCollection2", "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=\"lbs\" DateChanged=\"2004-04-01T15:07:33\" DefaultLanguage=\"en-US\" ReportingLanguage=\"en-US\" languages=\"en-US\"";
                        AddNode(shutters1, "MSCommerceCatalogCollection2", 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(shutter.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_NODE", "", "");
                                                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.IXMLDOMProcessingInstruction Prop;
                  string temp1;
                  string temp2;
                  string temp3;
                  //System.Diagnostics.Debug Debug;
                  docXML.async = false;
                  root = docXML.createElement(rootname);
                  docXML.loadXML(root.xml);
                  parentNode = root;
                  Prop = docXML.createProcessingInstruction("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.Description)
            }

            public static bool AddNode(MSXML2.DOMDocument40 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(strParentTag);
                  if (N1.length > 0)
                  {
                        Parent = (MSXML2.IXMLDOMElement)N1[N1.length - 1];
                  }
                  else
                  {
                        Parent = (MSXML2.IXMLDOMElement)parentTag;
                  }
                                                                                                      
                  if (!(string.Compare(textString, "") == 0))
                  {
                        Node = doc.createNode(MSXML2.tagDOMNodeType.NODE_ELEMENT, newTagName, "");
                        if (!(string.Compare(textString, "EMPTY_NODE") == 0))
                        {
                              Node.nodeTypedValue = textString;
                        }
                        Parent.appendChild(Node);
                        return true;
                  }
                  else
                  {
                        if (!(((string.Compare(attrName, "") == 0) || (string.Compare(AttrValue, "") == 0))))
                        {
                              oAttr = doc.createAttribute(attrName);
                              Parent.setAttribute(attrName, 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;
      }
}
0
 
rossryanAuthor Commented:
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.
0
 
rossryanAuthor Commented:
Very nice. Thanks.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.