rak*_*esh 1 c# xml xmpp namespaces windows-phone-7
我XElement
在名称"stream:stream"上创建对象,但它引发XMLException
了':'不能包含在名称中.
这里的第一个流是命名空间.
您可以指定以下命名空间:
XNamespace streamNs = "some-url-here";
// The + operator here creates an XName
XElement element = new XElement(streamNs + "stream");
Run Code Online (Sandbox Code Playgroud)
要使其创建"stream:stream"元素,您需要在某个元素中使用xmlns
属性stream
,例如
// Add this to an element - either the element in the namespace, or some parent
// element. The document root is a common place to put all namespaces...
XAttribute streamNs = new XAttribute(XNamespace.Xmlns + "stream",
streamNs.NamespaceName);
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
242 次 |
最近记录: |