XML

http://www.w3schools.com/xml/default.asp

http://www.devguru.com/Technologies/xmldom/quickref/xmldom_index.html

XPath

http://www.w3schools.com/xpath/default.asp


XML Examples...

xml use
'and,' 'or', =, !=,

//red - relative path to any 'red' node in document, even if at different levels
/red - selects 'red' nodes in first level
/catalog/red - selects 'red' nodes in second level when first level is 'catalog'
/*/red - selects 'red' nodes in second level
@ is used for attirbutes
//cd[@country] - selects all cd nodes with a country attribute

 

XML File for samples below

<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XML Spy v4.3 U (http://www.xmlspy.com) by Brian Johnston and Jared Johnson(PetroWeb) cac -->
<!--DOCTYPE ARCXML SYSTEM "D:\ArcIMS\AXL\ArcXml4.dtd"-->
<!--<!DOCTYPE ARCXML SYSTEM "http://arciis1srvr.petroweb.com/axl/ArcXml4.dtd[]">-->
<ARCXML version="1.1">
<CONFIG>
<ENVIRONMENT>
<LOCALE country="US" language="en" variant=""/>
<UIFONT color="70,70,70" name="Arial" size="12" style="regular"/>
<SCREEN dpi="96"/>
</ENVIRONMENT>
<MAP dynamic="true">
<PROPERTIES>.
<ENVELOPE minx="-179.999999667638" miny="-90.0000004851493" maxx="179.99999966763903" maxy="89.99999958381979" name="Extent_Limit"/>
<MAPUNITS units="decimal_degrees"/>
</PROPERTIES>
<WORKSPACES>
<SDEWORKSPACE name="PWAPP" server="10.0.0.2" instance="port:5151" database="SDE" user="SDE" encrypted="false" password="19WAZEE" geoindexdir="C:\Temp\"/>
<SHAPEWORKSPACE name="EH" directory="C:\ARCIMS\SHPWORKSPACE\WESTGECO_EH"/>
<SHAPEWORKSPACE name="WH" directory="C:\ARCIMS\SHPWORKSPACE\WESTGECO_WH"/>
</WORKSPACES>
<LAYER type="featureclass" name="Ocean" visible="true" id="Ocean">
<DATASET name="culture.culture.WORLD30" type="polygon" workspace="PWAPP"/>
</LAYER>
<!--CREATED BY XMLRCNL1-->
<LAYER type="featureclass" name="W1:Political:World wo US:Hi Res" visible="true" id="W1:Political:World wo US:Hi Res" maxscale="1:10000000">
<DATASET name="culture.culture.worldwous_hi_res" type="polygon" workspace="PWAPP"/>
</LAYER>
<!--CREATED BY XMLRCNL1-->
<LAYER type="featureclass" name="W1:Political:World Land:Low Res" visible="true" id="W1:Political:World Land:Low Res" minscale="1:10000000" maxscale="1:1000000000">
<DATASET name="culture.culture.worldlores" type="polygon" workspace="PWAPP"/>
<GROUPRENDERER>
<SCALEDEPENDENTRENDERER lower="1:55000000" upper="1:1000000000">
<SIMPLERENDERER>
<SIMPLEPOLYGONSYMBOL filltype="solid" fillcolor="255,255,224" boundarycolor="153,153,51" antialiasing="true"/>
</SIMPLERENDERER>
</SCALEDEPENDENTRENDERER>
</GROUPRENDERER>
</LAYER>
</MAP>
</CONFIG>
</ARCXML>

Code Sample

XmlDocument oDoc = new XmlDocument();
oDoc.Load(totalFile);

//look for xml for each layer group and write that node to new AXL

XmlNodeList oNodes = oDoc.SelectNodes("//LAYER[DATASET[contains(@name,'culture.culture')]]");
int intTest = oNodes.Count;
for(int i=0;i<oNodes.Count;i++)
{
string strNodes = oNodes.Item(i).OuterXml;
twCulture.Write(strNodes);
}

//get XML List
                  XmlDocument oDoc = new XmlDocument();
                  oDoc.Load(fileLoc + fileName);
                  XmlNodeList oNodes = oDoc.GetElementsByTagName("DATASET");
                  string test = oNodes.ToString();
                  string strDatasetName;
                  string strDataBaseNamePrev="";
                  string strDataBaseName;
                  string strDataTableName;
                  strDataBaseNamePrev = "culture"; //to start with
                  int dataBaseCount;
                 
                  //loop through xmlNodes and build array of all dataset Names
               
   for(int i=0;i<oNodes.Count;i++)
                  {
                        strDatasetName = oNodes.Item(i).Attributes.GetNamedItem("name").Value;
                        dataBaseCount = strDatasetName.IndexOf(".")+1;
                        strDatasetName = strDatasetName.Substring(dataBaseCount,strDatasetName.Length-dataBaseCount);
                       
                        alBig.Add(strDatasetName.ToUpper());
                  }          
                  int Nodecount = alBig.Count;
 
                  // *********************  parse then build the query nodes (not in any format)*********
               
   string[] alQusplit;
                  XmlNodeList oNodes2 = oDoc.GetElementsByTagName("QUERY");
                  for(int i5=0;i5<oNodes2.Count;i5++)
                  {
                        strDatasetName = oNodes2.Item(i5).Attributes.GetNamedItem("where").Value;
                        strDatasetName = strDatasetName.Replace("="," ");
                        strDatasetName = strDatasetName.Replace(" AND "," ");
                                         
                        alQusplit = Regex.Split(strDatasetName," ");
                       
                       
                        for(int i4=0;i4<alQusplit.Length;i4++)
                        {
                              int intDot = alQusplit[i4].IndexOf(".");
                       
                              if(intDot>0) // only use those with dots (which indicates table)
                              {
                                    alQusplit[i4]=alQusplit[i4].Substring(intDot+1);
                                    int thirdDot = alQusplit[i4].LastIndexOf(".");
                                    alQusplit[i4]=alQusplit[i4].Substring(0,thirdDot);
                             
                                    string tester2 = alQusplit[i4];
                                    alBig.Add(alQusplit[i4].ToUpper());
                              }
                        }                                        
                  }          
                 
                  Nodecount = alBig.Count;
                  alBig.Sort();    
                  //remove any duplicates.
                  for(int i6=1;i6<alBig.Count;i6++)
                  {
                        if(alBig[i6].Equals(alBig[i6-1]))
                        {
                              alBig.RemoveAt(i6);
                              i6=i6-1;
                        }                      
                  }
                  //sort the list
              
    alBig.Sort();          

 

 

 

XSL

http://www.w3schools.com/xsl/default.asp