Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data Format Conversion #7

Open
linyimin0812 opened this issue Aug 8, 2018 · 6 comments
Open

Data Format Conversion #7

linyimin0812 opened this issue Aug 8, 2018 · 6 comments
Labels
question Further information is requested

Comments

@linyimin0812
Copy link
Owner

anynoe has the idea that convert the follow xml to 你邀请"b1d5811c-aebe-4505-94bf-9e9d108ea3e8、b5333b25-1976-4d0b-a627-c4eb77361e80"加入了群聊

xml infomation

<sysmsg type="sysmsgtemplate">
  <sysmsgtemplate>
    <content_template type="tmpl_type_profilewithrevoke">
      <plain><![CDATA[]]></plain>
      <template><![CDATA[你邀请"$names$"加入了群聊  $revoke$]]></template>
      <link_list>
        <link name="names" type="link_profile">
          <memberlist>
            <member>
              <username><![CDATA[wxid_6023860170912]]></username>
              <nickname><![CDATA[b1d5811c-aebe-4505-94bf-9e9d108ea3e8]]></nickname>
            </member>
            <member>
              <username><![CDATA[wxid_thr4g3jd59a021]]></username>
              <nickname><![CDATA[b5333b25-1976-4d0b-a627-c4eb77361e80]]></nickname>
            </member>
          </memberlist>
          <separator><![CDATA[、]]></separator>
        </link>
        <link name="revoke" type="link_revoke" hidden="1">
          <title><![CDATA[撤销]]></title>
          <usernamelist>
            <username><![CDATA[wxid_6023860170912]]></username>
            <username><![CDATA[wxid_thr4g3jd59a021]]></username>
          </usernamelist>
        </link>
      </link_list>
    </content_template>
  </sysmsgtemplate>
</sysmsg>
@linyimin0812 linyimin0812 added the question Further information is requested label Aug 8, 2018
@huan
Copy link
Collaborator

huan commented Aug 8, 2018

Please have a look at https://github.com/lijiarui/wechaty-puppet-padchat/blob/7c4353225aa5a166c43c3a19264b83fa42718eb7/src/pure-function-helpers/xml2json.ts

I believe this utility function can help you turn XML into json format, then you can deal with the data easily.

@linyimin0812
Copy link
Owner Author

ok,I will have a try.Thanks very much

@huan
Copy link
Collaborator

huan commented Aug 9, 2018

Please have a look at wechaty/wechaty-puppet-padchat#143, it's all about XML to JSON.

@linyimin0812
Copy link
Owner Author

OK, I will have a try, thanks very much.

@huan huan reopened this Aug 31, 2018
@huan
Copy link
Collaborator

huan commented Aug 31, 2018

  1. To reference the issue number in the commit message is a good practice than post the source code code to issue comment.
  2. We need unit test (at least a very basic one) for the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants