小编use*_*233的帖子

XmlNode InnerXml与OuterXml

我遇到了一个奇怪的情况,希望有一个比我了解得更多的人可以帮助我解决这个问题。

我正在将图像插入Xml文档中,以便可以使用Microsoft Word打开它。作为其中的一部分,我需要添加一个映射到包含图像的元素的Xml'Relationship'。直截了当。

我添加的节点应如下所示:

<Relationship Id="rId6" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="media/image1.png"  />
Run Code Online (Sandbox Code Playgroud)

但是,在最终的.doc文件中,该行显示如下:

<Relationship Id="rId6" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="media/image1.png" xmlns="" />
Run Code Online (Sandbox Code Playgroud)

即它现在具有一个空的xmlns =“”属性。

这足以让Word相信文档已损坏并拒绝打开。如果我手动打开文件并删除该属性,则会打开文件。

显然,我想以编程方式删除它:-)所以我找到了父节点。这是我的理解有些模糊的地方。我相信OuterXml元素包含节点及其所有子元素的内容,而InnerXml仅包含子元素。

这就是我所看到的(请注意,转义字符是因为我是从Visual Studio的文本查看器中剪切下来的)。

外层Xml:

"<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">
<Relationship Id=\"rId3\"     Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings\" Target=\"webSettings.xml\" />
 <Relationship Id=\"rId2\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings\" Target=\"settings.xml\" />
<Relationship Id=\"rId1\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles\" Target=\"styles.xml\" />
<Relationship Id=\"rId5\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme\" Target=\"theme/theme1.xml\" />
<Relationship Id=\"rId4\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable\" Target=\"fontTable.xml\" />
<Relationship Id=\"rId6\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\" Target=\"media/image1.png\" xmlns=\"\" />

</Relationships>"
Run Code Online (Sandbox Code Playgroud)

InnerXml:

"<Relationship Id=\"rId3\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings\" Target=\"webSettings.xml\" xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\" />
<Relationship Id=\"rId2\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings\" Target=\"settings.xml\" xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\" />
<Relationship Id=\"rId1\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles\" Target=\"styles.xml\" xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\" />
<Relationship Id=\"rId5\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme\" Target=\"theme/theme1.xml\" …
Run Code Online (Sandbox Code Playgroud)

xml innerxml xmlnode outerxml

6
推荐指数
1
解决办法
4107
查看次数

如何在Azure上的MVC应用程序中托管和嵌入视频?

我创建了一个基本应用程序并上传到Azure.我想嵌入视频,以便用户可以从列表中进行选择并查看每个视频的视频; 例如,选择一部电影并观看它的预告片.

我创建了两个文件夹在我的MVC解决方案:"/海报"包含.jpg文件作为背景为每个视频,和"/视频"包含.mp4文件作为来源为每个视频.

.cshtml片段在这里:

 <video controls="controls" poster="@Model.PosterPath" width="640" height="360">
    <source src="@Model.VideoPath" type="video/mp4" />

        <object type="application/x-shockwave-flash" data="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf" width="640" height="360">
            <param name="movie" value="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf" />
            <param name="allowFullScreen" value="true" />
            <param name="wmode" value="transparent" />
            <param name="flashVars" value="config={'playlist':['@Model.PosterUrl',{'url':'@Model.VideoUrl','autoPlay':false}]}" />
            <img alt="@Model.AltText" src="@Model.PosterPath" width="640" height="360" title="No video playback capabilities" />
        </object>
</video>
Run Code Online (Sandbox Code Playgroud)

发布后,视频元素就在那里,海报显示正确,但是当我点击播放按钮时,我收到"未找到流"错误.

我正在使用VideoPath和PosterPath值的相对路径,如下所示:

../../Videos/myvideo.mp4 
Run Code Online (Sandbox Code Playgroud)

VideoUrl和PosterUrl值必须是绝对路径,并替换':'和'/'值,因此'http://mywebsite.azurewebsites.net/Videos/myvideo.mp4'显示如下:

http%3A%2F%2Fmywebsite.azurewebsites.net%2FVideos%2Fmyvideo.mp4
Run Code Online (Sandbox Code Playgroud)

显然路径(相对和绝对)不正确的可能性; 但由于海报正确显示,我不知道是否还有其他原因.

有没有办法让我测试视频是否已正确发布?抱歉,如果这是一个非常基本的问题,这是我的第一个Azure应用程序:-)

谢谢

video azure asp.net-mvc-4

2
推荐指数
1
解决办法
5228
查看次数

标签 统计

asp.net-mvc-4 ×1

azure ×1

innerxml ×1

outerxml ×1

video ×1

xml ×1

xmlnode ×1