我并不知道有什么区别,但是一位同事说有,尽管他无法支持.有什么区别?
我无法相信我网站上发生的事情.当我添加这一行时:
<html xmlns="http://www.w3.org/1999/xhtml">
<!DOCTYPE html>
<html>
<head>
Run Code Online (Sandbox Code Playgroud)
一切正常.当我不这样做时,CSS"混乱",一切都变得不同,布局变得"丑陋".
这条线如何解决所有问题?!
当我创建一个弹簧项目时,我总是遇到XLMNS的问题.什么是XMLNS?实际上这些是什么?
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"
Run Code Online (Sandbox Code Playgroud)
我在哪里可以获得这些参考?(xmlns的资源:xsi和xsi:schemeLocation.)是否有这些在线手册?我似乎无法找到它们.
注意 当我说引用时,我指的是适合它们的URL
更新
我在哪里可以看到Spring bean,Spring Transactions,Spring MVC等的XML命名空间?及其架构位置?
我的WSDL上有以下标记:
<?xml version='1.0' encoding='UTF-8'?>
<definitions name="" targetNamespace="http://xxxxx/ws"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:s0="http://xxxxx/ws"
xmlns:s1="http://schemas.xmlsoap.org/wsdl/soap/">
<types>
<xsd:schema attributeFormDefault="qualified"
elementFormDefault="qualified"
targetNamespace="http://xxxxx/ws/comments"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:s0="http://xxxxx/ws"
xmlns:s1="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="http://xxxxx/ws"
xmlns:tnsc="http://xxxxx/ws/comments"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:y="http://new.webservice.namespace">
Run Code Online (Sandbox Code Playgroud)
此后,类型被限定为s0,s1 ...名称空间中的类型.
问题是命名空间端点(="http:// xxxxx/ws")是否需要是有效的URL?
如果端点不再存在 - 是否意味着我们需要再次为Web服务重新生成存根代理?
注意:Web Service本身的端点与命名空间的端点不同,但仍然存在.
我尝试将新的"PropertyGroup"元素添加到以下XML文件中
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<ProjectGuid>{00AA7ECA-95A0-0000-0000-AD4D2E056BFE}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>testnS</RootNamespace>
<AssemblyName>testname</AssemblyName>
<PluginId>4B84E5C0-EC2B-4C0C-8B8E-3FAEB09F74C6</PluginId>
</PropertyGroup>
</Project>
Run Code Online (Sandbox Code Playgroud)
我使用的代码如下(注意还有其他逻辑已被删除):
XmlTextReader reader = new XmlTextReader(filename);
XmlDocument doc = new XmlDocument();
doc.Load(reader);
reader.Close();
XmlNamespaceManager ns = new XmlNamespaceManager(doc.NameTable);
ns.AddNamespace("x", "http://schemas.microsoft.com/developer/msbuild/2003");
XmlElement root = doc.DocumentElement;
XmlNode refNode = root.SelectSingleNode("x:Project", ns);
root.SelectSingleNode("Project", ns);
XmlElement newElement = doc.CreateElement("PropertyGroup", "http://schemas.microsoft.com/developer/msbuild/2003");
newElement.InnerXml = "<value>test</value>";
root.InsertAfter(newElement, refNode);
doc.Save(filename);
Run Code Online (Sandbox Code Playgroud)
这会在XML文档中生成以下新元素:
<PropertyGroup>
<value xmlns="">test</value>
</PropertyGroup>
Run Code Online (Sandbox Code Playgroud)
如何摆脱元素上的命名空间声明?
以下代码完美无缺.请参阅下面的XML文件.
XPathDocument xPathDoc = new XPathDocument(@"C:\Authors.xml");
XPathNavigator navigator = xPathDoc.CreateNavigator();
XPathNodeIterator iterator = navigator.Select("/Contacts/Author/FirstName");
iterator.MoveNext();
string firstName = iterator.Current.InnerXml;
Console.WriteLine(firstName);
Run Code Online (Sandbox Code Playgroud)
'firstName'的值返回'Joe',这是完美的.但是,当我将这个attibute xmlns ="http://www.w3.org/1999/xhtml"添加到''标签时,它看起来如下:
<Author xmlns="http://www.w3.org/1999/xhtml">
Run Code Online (Sandbox Code Playgroud)
然后代码没有返回正确的值('Joe')为什么然后属性xmlns ="http://www.w3.org/1999/xhtml"影响上面的代码以及我缺少什么来返回正确的值?
任何帮助将不胜感激.
这是xml文件:
<?xml version="1.0" encoding="UTF-8" ?>
<Contacts>
<Author>
<FirstName>Joe</FirstName>
</Author>
<Teacher>
<FirstName>Larry</FirstName>
</Teacher>
<Painter>
<FirstName>Mary</FirstName>
</Painter>
</Contacts>
Run Code Online (Sandbox Code Playgroud) 我正在尝试不同的网页合成器,当我创建一个新项目时,大多数都是从这样的基本结构开始的:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>New Web Project</title>
</head>
<body>
<h1>New Web Project Page</h1>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我真的无法找到答案,为什么需要有一个xmlns如果它将成为一个普通的网页.我知道如果我愿意,我可以省略它,之前我一直在编写HTML5文档,没有它就可以正常工作.
所以,当它实际上是需要提供xmlns的<html>元素,为什么排字认为应该在那里,当我创建一个新的项目?有没有提供任何的意义xmlns与<html>在第一时间做HTML5标签时?添加它有什么好处吗?
我发现,如果XML文件中的标记包含:在其中,则Go中的解组代码似乎不起作用。有什么见解吗?
例如,在下面的XML文件中,Summary有效,但无效Cevent。
<summary>...AIR QUALITY ALERT </summary>
<cap:event>Air Quality Alert</cap:event>
Run Code Online (Sandbox Code Playgroud)
type Entry struct{
Summary string `xml:"summary"`
Cevent string `xml:"cap:event"`
}
Run Code Online (Sandbox Code Playgroud)