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

A complete XML example #2

Open
Sarge2013 opened this issue Aug 6, 2013 · 2 comments
Open

A complete XML example #2

Sarge2013 opened this issue Aug 6, 2013 · 2 comments

Comments

@Sarge2013
Copy link

Dear Arnold,

I spent few hours with lib_mysqludf_xml - no doubts, it's very smart and powerful.
Please, could you help the newbies like me to add to your examples one simple BUT complete one - so that we could SEE HOW IT WORKS based on simple classic XML.
As to me - I'd be glad to pay for your time :) or beer :) - but to see how the functions produces something complete.

As I see it - such example starts from test 'yourtable' creation


CREATE TABLE `yourtable` (
`id` int(11) NOT NULL auto_increment,
`title` varchar(15), 
`text` varchar(255), 
`freenumber` varchar (15), 
PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 DEFAULT COLLATE utf8_bin;

INSERT INTO yourtable
    (`id`, `title`, `text`, `freenumber`)
VALUES
    (1, 'Arnold', 'has created', '15'),
    (2, 'Daniels', 'this smart lib_mysqludf_xml', '1.5'),
    (3, 'Now', 'you can see', '10.52'),
    (4, 'How', 'this simple', '3'),
    (5, 'Example', 'will be transformed to XML', '123.587')
;

HERE YOU could give example with the lib_mysqludf_xml functions using
title AS title,
text AS text,
'freenumber' AS 'value' with a standartized decimal number .00 (just cut, no runaround)
to have a final XML like below :
(including two lines below if possible - because not shown in the code due to an autoencoding on Github)


<row>
    <title>Arnold</title>
    <text>has created</text>
    <value>15.00</value>
</row>
<row>
    <title>Daniels</title>
    <text>this smart lib_mysqludf_xml</text>
    <value>1.50</value>
</row>
<row>
    <title>Now</title>
    <text>you can see</text>
    <value>10.52</value>
</row>
<row>
    <title>How</title>
    <text>this simple</text>
    <value>3.00</value>
</row>
<row>
    <title>Example</title>
    <text>will be transformed to XML</text>
    <value>123.58</value>
</row>

Thank you VERY MUCH IN ADVANCE for such simple but complete illustrative example !
Again, I'm sure any newbie will be thankful if such one will be included to the /test where is your "example_list",

Best regards,
Serge

@jasny
Copy link
Member

jasny commented Aug 8, 2013

Yeah the examples got lost 😦. Have a look at https://github.com/mysqludf/lib_mysqludf_xml/blob/master/API.

SELECT xql_agg('row' AS `xql:child`, `title`, `text`, `freenumber` AS `value`) FROM `yourtable`;

@Sarge2013
Copy link
Author

Yeah :) this is exactly what I mean, dear Arnold.
So many interesting functions - but all spread - you should be a very good prof to understand how to compile a one complete solution.
By the way, sorry, your example above does not work. You could create table as above and try.
First it says "no column 'test' in field list" - when corrected to "title" - it says "no column 'row' in field list.
Sorry my joke - but it seems this is not easy even for you to compile the functions in a right way to have the output XML exactly as above.
This is why I'm offering to write and show very simple but comprehensive example.
Simplest table as above -> your functions = simplest but finalized XML file.
After that everybody could read API and try to complicate basing on own needs.
It's just my opinion, you decide.
Have a nice day !

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

No branches or pull requests

2 participants