<?xml version="1.0" encoding="UTF-8"?>
<WorkSheetContent>
  <WorkSheetData>
    <WorkSheetNo>111111111111111</WorkSheetNo>
    <ProjName>95199</ProjName>
    <DelType>1</DelType>
    <EnvFlg>O</EnvFlg>
    <ProgTypeNo>0</ProgTypeNo>
    <ServiceNo>0</ServiceNo>
    <ClassFlg>T</ClassFlg>
    <OccurDate>20090819093000</OccurDate>
    <DataOperType>D</DataOperType>
    <WorkDesc>95199 update 20090817</WorkDesc>
    <SuporProc>dsfdsf</SuporProc>
    <Attatchments>
    </Attatchments>
    <DeadLine>20090820173000</DeadLine>
    <TradeCode>1000900011</TradeCode>
    <OrgCode>123456789012</OrgCode>
    <CustomsCode>5300</CustomsCode>
    <OrgName>北京企业</OrgName>
    <CustName>李四</CustName>
    <DistrictCode>1021</DistrictCode>
    <Extension>681184</Extension>
    <TelePhone>65194135</TelePhone>
    <Mobile>667046</Mobile>
    <FaxDistrictCode>4544</FaxDistrictCode>
    <FaxExtension>5456</FaxExtension>
    <Fax>4415665</Fax>
    <Email>
    </Email>
    <Note>
    </Note>
  </WorkSheetData>
  <DeptNo>5300</DeptNo>
  <SignData>dsfs</SignData>
</WorkSheetContent>

解决方案 »

  1.   

     XmlDocument doc = new XmlDocument();
     doc.LoadXml(strXML.Trim());
     就是如何操作doc获得所有节点的值
      

  2.   

     protected void Page_Load(object sender, EventArgs e)
            {
                string xml = @"<?xml version=""1.0"" encoding=""UTF-8""?> 
    <WorkSheetContent> 
      <WorkSheetData> 
        <WorkSheetNo>111111111111111 </WorkSheetNo> 
        <ProjName>95199 </ProjName> 
        <DelType>1 </DelType> 
        <EnvFlg>O </EnvFlg> 
        <ProgTypeNo>0 </ProgTypeNo> 
        <ServiceNo>0 </ServiceNo> 
        <ClassFlg>T </ClassFlg> 
        <OccurDate>20090819093000 </OccurDate> 
        <DataOperType>D </DataOperType> 
        <WorkDesc>95199 update 20090817 </WorkDesc> 
        <SuporProc>dsfdsf </SuporProc> 
        <Attatchments> 
        </Attatchments> 
        <DeadLine>20090820173000 </DeadLine> 
        <TradeCode>1000900011 </TradeCode> 
        <OrgCode>123456789012 </OrgCode> 
        <CustomsCode>5300 </CustomsCode> 
        <OrgName>北京企业 </OrgName> 
        <CustName>李四 </CustName> 
        <DistrictCode>1021 </DistrictCode> 
        <Extension>681184 </Extension> 
        <TelePhone>65194135 </TelePhone> 
        <Mobile>667046 </Mobile> 
        <FaxDistrictCode>4544 </FaxDistrictCode> 
        <FaxExtension>5456 </FaxExtension> 
        <Fax>4415665 </Fax> 
        <Email> 
        </Email> 
        <Note> 
        </Note> 
      </WorkSheetData> 
      <DeptNo>5300 </DeptNo> 
      <SignData>dsfs </SignData> 
    </WorkSheetContent> ";            System.Xml.XmlDocument dom = new System.Xml.XmlDocument();
                dom.LoadXml(xml);
                foreach (System.Xml.XmlNode node in dom.ChildNodes)
                {   
                    if(node.Name !="xml")
                    Response.Write(GetNodeText(node)+"<BR>");
                     
                }             
            }        string GetNodeText(System.Xml.XmlNode node)
            {
                string str = node.InnerText;
                if (node.HasChildNodes)
                {
                    str = "";
                    foreach (System.Xml.XmlNode n in node.ChildNodes)
                    {
                        str += GetNodeText(n);
                    }
                    str += "<BR>";
                }
                return str;
            }
      

  3.   

    我的意思是:
    string WorkSheetNo =
    string ProjName =
      

  4.   

     string xml = @"<?xml version=""1.0"" encoding=""UTF-8""?> 
    <WorkSheetContent> 
      <WorkSheetData> 
        <WorkSheetNo>111111111111111 </WorkSheetNo> 
        <ProjName>95199 </ProjName> 
        <DelType>1 </DelType> 
        <EnvFlg>O </EnvFlg> 
        <ProgTypeNo>0 </ProgTypeNo> 
        <ServiceNo>0 </ServiceNo> 
        <ClassFlg>T </ClassFlg> 
        <OccurDate>20090819093000 </OccurDate> 
        <DataOperType>D </DataOperType> 
        <WorkDesc>95199 update 20090817 </WorkDesc> 
        <SuporProc>dsfdsf </SuporProc> 
        <Attatchments> 
        </Attatchments> 
        <DeadLine>20090820173000 </DeadLine> 
        <TradeCode>1000900011 </TradeCode> 
        <OrgCode>123456789012 </OrgCode> 
        <CustomsCode>5300 </CustomsCode> 
        <OrgName>北京企业 </OrgName> 
        <CustName>李四 </CustName> 
        <DistrictCode>1021 </DistrictCode> 
        <Extension>681184 </Extension> 
        <TelePhone>65194135 </TelePhone> 
        <Mobile>667046 </Mobile> 
        <FaxDistrictCode>4544 </FaxDistrictCode> 
        <FaxExtension>5456 </FaxExtension> 
        <Fax>4415665 </Fax> 
        <Email> 
        </Email> 
        <Note> 
        </Note> 
      </WorkSheetData> 
      <DeptNo>5300 </DeptNo> 
      <SignData>dsfs </SignData> 
    </WorkSheetContent> ";            System.Xml.XmlDocument dom = new System.Xml.XmlDocument();
                dom.LoadXml(xml);             
                System.Xml.XmlNode node = dom.SelectSingleNode("//ProjName");
                if (node != null)
                {
                    Response.Write(node.InnerText);
                }