简体   繁体   English

XML模式解析[newbie]

[英]XML Schema parsing [newbie]

<log sessions="5" complete="5" timeouts="5" incomplete="5">
  <session>
    <event date="Fri Feb 1 05:31:18 GMT+0000 2013">LANDING_PAGE_CLICK</event>
    <event date="Fri Feb 1 05:31:39 GMT+0000 2013">TIMEOUT</event>
  </session>
</log>

I have the above XML. 我有上面的XML。 How would I extract the date, and the "event" node? 我将如何提取日期和“事件”节点? This is my first time writing an XSD I have came across this: 这是我第一次编写XSD,遇到了以下问题:

var dateString : String = response.status.@date;
var date : Date = DateFormatter.parseDateString (dateString);

but have no idea how this even fits into an XSD. 但不知道它怎么适合XSD。

Help would be greatly appreciated. 帮助将不胜感激。

Thanks,James. 谢谢,詹姆斯。

<xs:attribute name="lang" type="xs:string"/>

above is the code used to fix this problem. 以上是用于解决此问题的代码。

EDIT: I have to rush home from work, but it's documented here http://www.w3schools.com/schema/schema_simple_attributes.asp 编辑

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM