<?xml version="1.0" encoding="utf-8"?>
<?mso-infoPathSolution name="urn:schemas-microsoft-com:office:infopath:g7EXE:-myXSD-2007-11-28T07-29-38" solutionVersion="1.0.0.11" productVersion="12.0.0.0" PIVersion="1.0.0.0" href="http://itlp1:2020/DocLib3/Forms/template.xsn"?>
<?mso-application progid="InfoPath.Document" versionProgid="InfoPath.Document.2"?>
<my:myFields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2007-11-28T07:29:38" xmlns:xd="http://schemas.microsoft.com/office/infopath/2003" xml:lang="zh-CN">
<my:date> 2007-12-19T00:00:00 </my:date>
<my:applyer>
<my:username> test </my:username>
<my:dept> 人力资源部 </my:dept>
</my:applyer>
<my:info>
<my:begin_date> 2007-12-19T00:00:00 </my:begin_date>
<my:end_date> 2007-12-19T00:00:00 </my:end_date>
<my:type> 病假 </my:type>
<my:note> 阿飞上的嘎斯蛋糕 </my:note>
<my:tianshu> 1 </my:tianshu>
</my:info>
</my:myFields>
能否帮下,读出代码,编码是UTF-8的,编码不能变,谁帮我实现下,谢谢大家
<?mso-infoPathSolution name="urn:schemas-microsoft-com:office:infopath:g7EXE:-myXSD-2007-11-28T07-29-38" solutionVersion="1.0.0.11" productVersion="12.0.0.0" PIVersion="1.0.0.0" href="http://itlp1:2020/DocLib3/Forms/template.xsn"?>
<?mso-application progid="InfoPath.Document" versionProgid="InfoPath.Document.2"?>
<my:myFields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2007-11-28T07:29:38" xmlns:xd="http://schemas.microsoft.com/office/infopath/2003" xml:lang="zh-CN">
<my:date> 2007-12-19T00:00:00 </my:date>
<my:applyer>
<my:username> test </my:username>
<my:dept> 人力资源部 </my:dept>
</my:applyer>
<my:info>
<my:begin_date> 2007-12-19T00:00:00 </my:begin_date>
<my:end_date> 2007-12-19T00:00:00 </my:end_date>
<my:type> 病假 </my:type>
<my:note> 阿飞上的嘎斯蛋糕 </my:note>
<my:tianshu> 1 </my:tianshu>
</my:info>
</my:myFields>
能否帮下,读出代码,编码是UTF-8的,编码不能变,谁帮我实现下,谢谢大家
<?mso-infoPathSolution name="urn:schemas-microsoft-com:office:infopath:g7EXE:-myXSD-2007-11-28T07-29-38" solutionVersion="1.0.0.11" productVersion="12.0.0.0" PIVersion="1.0.0.0" href="http://itlp1:2020/DocLib3/Forms/template.xsn"?>
<?mso-application progid="InfoPath.Document" versionProgid="InfoPath.Document.2"?>
<my:myFields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2007-11-28T07:29:38" xmlns:xd="http://schemas.microsoft.com/office/infopath/2003" xml:lang="zh-CN">
<my:date>2007-12-19T00:00:00</my:date>
<my:applyer>
<my:username>test</my:username>
<my:dept>人力资源部</my:dept>
</my:applyer>
<my:info>
<my:begin_date>2007-12-19T00:00:00</my:begin_date>
<my:end_date>2007-12-19T00:00:00</my:end_date>
<my:type>病假</my:type>
<my:note>阿飞上的嘎斯蛋糕</my:note>
<my:tianshu>1</my:tianshu>
</my:info>
</my:myFields>//用ASP.NET实现
protected void Page_Load(object sender, EventArgs e)
{
System.Xml.XmlDocument doc = new XmlDocument();
doc.Load(Server.MapPath("XMLFile.xml")); ParseXML(doc.DocumentElement);
}//解析XML
private void ParseXML(System.Xml.XmlNode element)
{
if (element.NodeType == System.Xml.XmlNodeType.Text)
{
Response.Write(string.Format("{0}<br />", element.Value));
}
else
{
foreach (System.Xml.XmlNode ele in element.ChildNodes)
{
ParseXML(ele);
}
}
}
给定编码中的字符无效。 行 7,位置 16。
------------
楼主所想要的是那些值?楼主可以参考下一XmlDocument doc = new XmlDocument(); doc.Load(Server.MapPath("data2.xml"));
XPathNavigator oXPathNav;
oXPathNav = doc.CreateNavigator(); XPathExpression Expr;
Expr = oXPathNav.Compile("//my:myFields"); XmlNamespaceManager oxmlNSManager = new XmlNamespaceManager(oXPathNav.NameTable);
oxmlNSManager.AddNamespace("my", "http://schemas.microsoft.com/office/infopath/2003/myXSD/2007-11-28T07:29:38");
Expr.SetContext(oxmlNSManager); XPathNodeIterator iterator = oXPathNav.Select(Expr); while (iterator.MoveNext())
{
Response.Write(iterator.Current.Name+":"+iterator.Current.Value+"\r\n");
} oxmlNSManager = null;
oXPathNav = null;
doc = null;
xd.Load(@"C:\Inetpub\wwwroot\number\read.xml"); //load all movies
XmlNodeList xnl = xd.SelectNodes("//movie");
foreach(XmlNode xn in xnl)
{
//load all attributes of current movie
foreach (XmlAttribute xa in xn.Attributes)
{
Response.Write("<b>" + xa.Name + "</b>:" + xa.InnerText + ",");
}
Response.Write ("<hr size=\"1\" />"); //the child nodes of current node which named movie
foreach (XmlNode xcn in xn.ChildNodes)
{
Response.Write("<b>" +xcn.Name + "</b>:" + xcn.InnerText + "<br/>"); if (xcn.HasChildNodes)
{
Response.Write("<br/>------------------------<br/>");
} //load nodes named file
foreach (XmlNode xccn in xcn.ChildNodes)
{
Response.Write("<b>" + xccn.Name + "</b>:" + xccn.InnerText + "<br/>");
}
}
Response.Write("<br/><br/><br/>");
}lz 参考一下下哈
http://www.cnblogs.com/weekzero/archive/2005/06/21/178140.html
xd.Load(@"C:\Inetpub\wwwroot\number\xml\XMLFile1.xml"); XmlNamespaceManager oxmlNSManager = new XmlNamespaceManager(xd.NameTable);
oxmlNSManager.AddNamespace("my", "http://schemas.microsoft.com/office/infopath/2003/myXSD/2007-11-28T07:29:38");
XmlNodeList xnl = xd.SelectNodes("//my:myFields",oxmlNSManager); foreach(XmlNode xn in xnl)
{
//load all attributes of current movie
foreach (XmlAttribute xa in xn.Attributes)
{
Response.Write("<b>" + xa.Name + "</b>:" + xa.InnerText + ",");
}
Response.Write ("<hr size=\"1\" />"); //the child nodes of current node which named movie
foreach (XmlNode xcn in xn.ChildNodes)
{
Response.Write("<b>" +xcn.Name + "</b>:" + xcn.InnerText + "<br/>"); if (xcn.HasChildNodes)
{
Response.Write("<br/>------------------------<br/>");
} //load nodes named file
foreach (XmlNode xccn in xcn.ChildNodes)
{
Response.Write("<b>" + xccn.Name + "</b>:" + xccn.InnerText + "<br/>");
}
}
Response.Write("<br/><br/><br/>");
}