Loading ...
Sorry, an error occurred while loading the content.

52221DataSource XML Schema - XML Object?

Expand Messages
  • athies
    Dec 1, 2009
    • 0 Attachment
      I am using YUI3 DataSource to pull in some XML. Everything works great except I have a comments section of the returned XML that contains an arbitrary number of comment objects within it. I can't figure out how to pull this comments section out into a usable object, as opposed to a string.

      Here is my DataSource schema:

      myDataSourceXML.plug(Y.Plugin.DataSourceXMLSchema, {
      schema: {
      resultListLocator: "MediaDo",
      resultFields: [
      {key:"mediaID", locator:"*[local-name() ='mediaID']"},
      {key:"title", locator:"*[local-name() ='title']"},
      {key:"originalUrl", locator:"*[local-name() ='originalUrl']"},
      {key:"desc", locator:"*[local-name() ='description']"},
      {key:"creator", locator:"*[local-name() ='creatorNickName']"},
      {key:"posted", locator:"*[local-name() ='creationDate']"},
      {key:"height", locator:"images/ImageDo[type='or']/height"},
      {key:"width", locator:"images/ImageDo[type='or']/width"},
      {key:"size", locator:"images/ImageDo[type='or']/size"},
      {key:"comments", locator:"comments"}
      ]
      }

      Here is what the XML for comments looks like:

      <comments>
      <CommentDo>
      <canEdit>false</canEdit>
      <comment>volcano comment 2</comment>
      <commentID>814511802</commentID>
      <creationDate>1259542360000</creationDate>
      <creatorNickName>athiesv3</creatorNickName>
      <creatorYUID>athiesv3#jb</creatorYUID>
      <domainID>0</domainID>
      <flag/>
      <groupID>0</groupID>
      <mediaID>0</mediaID>
      <parentID/>
      <rootID/>
      </CommentDo>
      <CommentDo>
      <canEdit>false</canEdit>
      <comment>volcano comment 1</comment>
      <commentID>729126005</commentID>
      <creationDate>1259542350000</creationDate>
      <creatorNickName>athiesv3</creatorNickName>
      <creatorYUID>athiesv3#jb</creatorYUID>
      <domainID>0</domainID>
      <flag/>
      <groupID>0</groupID>
      <mediaID>0</mediaID>
      <parentID/>
      <rootID/>
      </CommentDo>
      </comments>
    • Show all 2 messages in this topic