具有命名空间的 XDocument 后代
我有这个 xml:
<?xml version="1.0" encoding="UTF-8"?>
<CueList xmlns="urn:CueListSchema.xml" xmlns:s="urn:schemas-rcsworks-com:SongSchema" xmlns:n="urn:schemas-rcsworks-com:NoteSchema" xmlns:l="urn:schemas-rcsworks-com:LinkSchema" xmlns:t="urn:schemas-rcsworks-com:TrafficSchema" xmlns:p="urn:schemas-rcsworks-com:ProductSchema" xmlns:m="urn:schemas-rcsworks-com:MediaSchema" xmlns:w="urn:schemas-rcsworks-com:WebPageSchema" xmlns:ns="urn:CueListSchema.xml" time="2011-12-02T13:34:39">
<Event eventID="14" eventType="song" status="happening" scheduledTime="13:34:38" scheduledDuration="332.82">
<s:Song title="Long Time Coming (Holding On)" internalID="007700028007AD480000">
<s:Artist name="The Winans" sequenceNumber="1" internalID="0067000180002B020000" sortName="Winans, The" />
<m:Media ID="{7C734B6C-7AF7-4998-8366-F1F11F5D56D7}" runTime="332.82" fileName="{7C734B6C-7AF7-4998-8366-F1F11F5D56D7}.wav" />
</s:Song>
</Event>
<Event eventID="15" eventType="link" status="committed" startTime="13:40:10" scheduledDuration="3.49">
<l:Link title="PG MFL DRY FEMALE" internalID="007B00028002DAEA0000">
<m:Media ID="{036BB0ED-3130-4AD0-8BAF-E5D0FBA7DC3B}" runTime="3.49" fileName="{036BB0ED-3130-4AD0-8BAF-E5D0FBA7DC3B}.wav" />
</l:Link>
</Event>
<Event eventID="16" eventType="song" status="committed" startTime="13:40:10" scheduledDuration="303.55">
<s:Song title="Not Making Sense, Making Faith" internalID="007700028009377F0000">
<s:Artist name="Donald Lawrence" sequenceNumber="1" internalID="006700018000308A0000" sortName="Lawrence, Donald" />
<m:Media ID="{B6FD04EA-9B42-4E6A-AC80-A26BF65E6F11}" runTime="303.55" fileName="{B6FD04EA-9B42-4E6A-AC80-A26BF65E6F11}.wav" />
</s:Song>
</Event>
</CueList>
我能够为歌曲等设置命名空间。但是当我尝试选择事件时它不起作用,我尝试为 CueList 设置命名空间,当我调试时它说命名空间为空?
I have this xml:
<?xml version="1.0" encoding="UTF-8"?>
<CueList xmlns="urn:CueListSchema.xml" xmlns:s="urn:schemas-rcsworks-com:SongSchema" xmlns:n="urn:schemas-rcsworks-com:NoteSchema" xmlns:l="urn:schemas-rcsworks-com:LinkSchema" xmlns:t="urn:schemas-rcsworks-com:TrafficSchema" xmlns:p="urn:schemas-rcsworks-com:ProductSchema" xmlns:m="urn:schemas-rcsworks-com:MediaSchema" xmlns:w="urn:schemas-rcsworks-com:WebPageSchema" xmlns:ns="urn:CueListSchema.xml" time="2011-12-02T13:34:39">
<Event eventID="14" eventType="song" status="happening" scheduledTime="13:34:38" scheduledDuration="332.82">
<s:Song title="Long Time Coming (Holding On)" internalID="007700028007AD480000">
<s:Artist name="The Winans" sequenceNumber="1" internalID="0067000180002B020000" sortName="Winans, The" />
<m:Media ID="{7C734B6C-7AF7-4998-8366-F1F11F5D56D7}" runTime="332.82" fileName="{7C734B6C-7AF7-4998-8366-F1F11F5D56D7}.wav" />
</s:Song>
</Event>
<Event eventID="15" eventType="link" status="committed" startTime="13:40:10" scheduledDuration="3.49">
<l:Link title="PG MFL DRY FEMALE" internalID="007B00028002DAEA0000">
<m:Media ID="{036BB0ED-3130-4AD0-8BAF-E5D0FBA7DC3B}" runTime="3.49" fileName="{036BB0ED-3130-4AD0-8BAF-E5D0FBA7DC3B}.wav" />
</l:Link>
</Event>
<Event eventID="16" eventType="song" status="committed" startTime="13:40:10" scheduledDuration="303.55">
<s:Song title="Not Making Sense, Making Faith" internalID="007700028009377F0000">
<s:Artist name="Donald Lawrence" sequenceNumber="1" internalID="006700018000308A0000" sortName="Lawrence, Donald" />
<m:Media ID="{B6FD04EA-9B42-4E6A-AC80-A26BF65E6F11}" runTime="303.55" fileName="{B6FD04EA-9B42-4E6A-AC80-A26BF65E6F11}.wav" />
</s:Song>
</Event>
</CueList>
I am able to set the namespaces for songs etc. But when I try and select Events it does not work, I tried setting the namespace for CueList and when I debug it says that namespace is null?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您没有显示您正在使用的代码时,很难知道出了什么问题,但它应该很简单:
如果这不起作用,请给我们一个简短但完整的示例XML(请格式化,而不仅仅是从浏览器复制)和您正在使用的代码。
It's hard to know what's wrong when you haven't shown the code you're using, but it should be simple:
If that doesn't work, please give us a short but complete example of both the XML (formatted, please, and not just copied from a browser) and code you're using.