Simple XML subset parser comparable to glib's Markup parser, but without any dependencies in one self contained file. Forked from https://github.com/ooxi/xml.c
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

test-xml-c.c 8.6 KiB

New easy xml interface Squashed commit of the following: commit 7300b93a1ffaf69f6af257c83ca1b486bccce5b0 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:51:19 2012 +0100 Easy development... commit 66b764840d94bb8106a68b425ad85890efe3bba3 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:50:11 2012 +0100 Easy development... commit 62e4801612cf3a5852057718f0ade6f8c12b2f18 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:47:26 2012 +0100 Easy development... commit d3b67262ff57f765e39808b47f3329bf9ec493bc Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:47:08 2012 +0100 Easy development... commit 65661e2ac0d938fe7f5e98e0d6e6531ed812807a Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:45:05 2012 +0100 Easy development... commit 3ae765fd82342564b2be740a931637fe66ebb706 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:44:58 2012 +0100 Easy development... commit c6d1a3bb2c5f3900b1f5f4d5f1d4ffe132b0f3bd Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:44:36 2012 +0100 Easy development... commit deb98462367776b762a2dc6d01d0f86a3c053602 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:44:13 2012 +0100 Easy development... commit 53cb08c3fc47c8b076bb07c2ab8776df38565de8 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:43:41 2012 +0100 Easy development... commit ce3766de258290017b121eafa4d832443cdcc19b Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:40:47 2012 +0100 Easy development... commit 9df056a6a0b5e264e5608d6649760f434e1d66a1 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:37:59 2012 +0100 Easy interface... commit c6b1797f0a472dc529b32676070db471974ad26d Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:37:49 2012 +0100 Easy interface... commit b72f20c42d311880992c3d5e81483063ede5533c Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:37:32 2012 +0100 Easy interface... commit 9d9e3994a328b1f18271d4f3076a4a0db5828e38 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:36:52 2012 +0100 Easy interface... commit fe43225e7dbd2fc1d86d569f024b7dc80238189b Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:36:18 2012 +0100 Easy interface... commit 9881f5516d24da521b701befc999b190770fa5a3 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:35:55 2012 +0100 Easy interface... commit 5a0b4197be4aff87ff13532b1aad723a8536d129 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:35:23 2012 +0100 Easy interface... commit e4bce00912811bc1638ebe1a4f5d91b61b615f7c Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:34:47 2012 +0100 Easy interface... commit 0872374b18ad5634550226579a6d483e2bcb7a12 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:33:56 2012 +0100 Easy interface... commit fa075c61c663c9fd4514df22fcd4a58c2c44ca0a Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:31:58 2012 +0100 Easy interface... commit 221f9cd044ce97464fca93332f1e679e2058d1cf Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:30:12 2012 +0100 Easy interface... commit ec2b858a82b50d8cd93b053152de8719d44b6da0 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:29:32 2012 +0100 Easy interface... commit 4159c7318162d58d6a658b6e2bd154289a75f5d8 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:29:17 2012 +0100 Easy interface... commit e040c00436ff5592478e9e08c2f7cd65d0ab7c3d Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:28:35 2012 +0100 Easy interface... commit a34b05154ca7195fa221bbd13bb49ce988fb2996 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:27:39 2012 +0100 Easy interface... commit f9b46f112b96e0ed075e9c2a4eddeaff8d0cd782 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:26:37 2012 +0100 Easy interface... commit d049b2f822cf81cbca670769f993ab81f624247e Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:26:24 2012 +0100 Easy interface... commit 8ff31ce1f38c3649728095b0702ee0313618e785 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:25:39 2012 +0100 Easy interface... commit 004a580c6b11cf08b7e370ade0b10a0a2e49d75f Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:25:12 2012 +0100 Easy interface... commit 29d1070b98cfd201af2298e4eb85ce562d00311a Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:23:57 2012 +0100 Easy interface... commit 158f5db9046a9ff9c3259ea836c6c476b25c9c49 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:23:40 2012 +0100 Easy interface... commit 9f761ff51b53913b21fbde30a652d21064840361 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:21:27 2012 +0100 Easy interface... commit 795c6464ca8be977ad1cdfad44c5cc7b427d30c5 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:19:08 2012 +0100 Easy interface... commit 64f60cddad9eefec5819d20c4f021c3608b2a822 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:18:32 2012 +0100 Easy interface... commit d0c595ea84d21e9ac947fc24d5620e20fb307840 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:18:23 2012 +0100 Easy interface... commit 4a593ce313848da9921c3b33cbf3d0cf5f713799 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:17:59 2012 +0100 Easy interface... commit a1552478a0f765fdef516643586c1950f8ba217f Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:15:54 2012 +0100 Easy interface... commit ac2184dee39db2fbcc0aee73da04116dd6bd93d5 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:14:57 2012 +0100 Easy interface... commit 393cbe4bf0eea270e37b8a2ecd78b71152272461 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:14:31 2012 +0100 Easy interface... commit a56995ac8aef7caf10a184acb93b7755b2b541f0 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:13:55 2012 +0100 Easy interface... commit 921d7d6740f4c774bbaed220c0ab109f43ee8849 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:07:57 2012 +0100 Easy interface... commit fe7de39d75e238f5f674c21ecec39f487d941907 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:04:36 2012 +0100 Easy interface... commit e6e158dd4343e4d75d385ae0861dc1df131a1c42 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 13:59:29 2012 +0100 Easy interface... commit 9bb88f95d4cb42a393077b578fe697916a638f0d Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 13:59:01 2012 +0100 Easy interface...
12年前
Added xml_open_document API call to read a XML document from file Squashed commit of the following: commit 3501a6d4a4696fe14781043109964f42ff489309 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 16:10:37 2012 +0100 Open XML document... commit e4f63354259055578ef8827bde25c3322c5386ec Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 16:10:04 2012 +0100 Open XML document... commit cf9b46c26059a668f842b472609454ab0f9b809f Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 16:09:56 2012 +0100 Open XML document... commit be3baa3d99609744084f0a2bfe49b5cd73f7ad87 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 16:09:48 2012 +0100 Open XML document... commit 9be46ba2cf68f22f3aa1befd75f6e63a3cc3972f Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 16:07:35 2012 +0100 Open XML document... commit 081a5997470c2e633bc1c8703c14ef7b70c55f29 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 16:06:58 2012 +0100 Open XML document... commit 4af333480380d603266f8df42b8c45408c05d48d Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 16:05:24 2012 +0100 Open XML document... commit f5c3a25541864db290895b652648485bba2e72fc Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 16:04:30 2012 +0100 Open XML document... commit 81ee66c39efaa110e92af713e04cb4249be536dc Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 16:02:53 2012 +0100 Open XML document... commit 1448aa14844bf74c3ccbcc6c4cd62476b6987f04 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 16:02:03 2012 +0100 Open XML document... commit dc767c8d671013b936fdcb729d1ebcad250f6dd4 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 16:01:14 2012 +0100 Open XML document... commit ad23dcc1278b132f01bc1a9c403fbd2261341759 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 16:00:25 2012 +0100 Open XML document... commit f7c905130de9c210f6e522c19ef1d4f29fd1f218 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 15:59:31 2012 +0100 Open XML document... commit 1cce95d4627e1c62bf67b5531a20a49588bef792 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 15:57:29 2012 +0100 Open XML document... commit 1b3fa5f68492bf5091b4cd51dec6c2817e170efa Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 15:45:03 2012 +0100 Open XML document... commit 0778105ea2b0761342b17e22b4be541a6a2ded3b Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 15:41:48 2012 +0100 Open XML document... commit 64418dcb81dcad5cb771553260c54d45eb6544c5 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 15:41:06 2012 +0100 Open XML document... commit 54061a0e3b7a7eb19c2048452a445c654f64a5f4 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 15:40:39 2012 +0100 Open XML document... commit e776734fa212642d0fe467356c66211e06c489db Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 15:39:39 2012 +0100 Open XML document... commit 81bbf1e0c342888ece7de9c921cbd1fb66de3a38 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 15:38:36 2012 +0100 Open XML document...
12年前
New easy xml interface Squashed commit of the following: commit 7300b93a1ffaf69f6af257c83ca1b486bccce5b0 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:51:19 2012 +0100 Easy development... commit 66b764840d94bb8106a68b425ad85890efe3bba3 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:50:11 2012 +0100 Easy development... commit 62e4801612cf3a5852057718f0ade6f8c12b2f18 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:47:26 2012 +0100 Easy development... commit d3b67262ff57f765e39808b47f3329bf9ec493bc Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:47:08 2012 +0100 Easy development... commit 65661e2ac0d938fe7f5e98e0d6e6531ed812807a Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:45:05 2012 +0100 Easy development... commit 3ae765fd82342564b2be740a931637fe66ebb706 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:44:58 2012 +0100 Easy development... commit c6d1a3bb2c5f3900b1f5f4d5f1d4ffe132b0f3bd Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:44:36 2012 +0100 Easy development... commit deb98462367776b762a2dc6d01d0f86a3c053602 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:44:13 2012 +0100 Easy development... commit 53cb08c3fc47c8b076bb07c2ab8776df38565de8 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:43:41 2012 +0100 Easy development... commit ce3766de258290017b121eafa4d832443cdcc19b Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:40:47 2012 +0100 Easy development... commit 9df056a6a0b5e264e5608d6649760f434e1d66a1 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:37:59 2012 +0100 Easy interface... commit c6b1797f0a472dc529b32676070db471974ad26d Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:37:49 2012 +0100 Easy interface... commit b72f20c42d311880992c3d5e81483063ede5533c Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:37:32 2012 +0100 Easy interface... commit 9d9e3994a328b1f18271d4f3076a4a0db5828e38 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:36:52 2012 +0100 Easy interface... commit fe43225e7dbd2fc1d86d569f024b7dc80238189b Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:36:18 2012 +0100 Easy interface... commit 9881f5516d24da521b701befc999b190770fa5a3 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:35:55 2012 +0100 Easy interface... commit 5a0b4197be4aff87ff13532b1aad723a8536d129 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:35:23 2012 +0100 Easy interface... commit e4bce00912811bc1638ebe1a4f5d91b61b615f7c Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:34:47 2012 +0100 Easy interface... commit 0872374b18ad5634550226579a6d483e2bcb7a12 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:33:56 2012 +0100 Easy interface... commit fa075c61c663c9fd4514df22fcd4a58c2c44ca0a Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:31:58 2012 +0100 Easy interface... commit 221f9cd044ce97464fca93332f1e679e2058d1cf Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:30:12 2012 +0100 Easy interface... commit ec2b858a82b50d8cd93b053152de8719d44b6da0 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:29:32 2012 +0100 Easy interface... commit 4159c7318162d58d6a658b6e2bd154289a75f5d8 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:29:17 2012 +0100 Easy interface... commit e040c00436ff5592478e9e08c2f7cd65d0ab7c3d Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:28:35 2012 +0100 Easy interface... commit a34b05154ca7195fa221bbd13bb49ce988fb2996 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:27:39 2012 +0100 Easy interface... commit f9b46f112b96e0ed075e9c2a4eddeaff8d0cd782 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:26:37 2012 +0100 Easy interface... commit d049b2f822cf81cbca670769f993ab81f624247e Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:26:24 2012 +0100 Easy interface... commit 8ff31ce1f38c3649728095b0702ee0313618e785 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:25:39 2012 +0100 Easy interface... commit 004a580c6b11cf08b7e370ade0b10a0a2e49d75f Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:25:12 2012 +0100 Easy interface... commit 29d1070b98cfd201af2298e4eb85ce562d00311a Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:23:57 2012 +0100 Easy interface... commit 158f5db9046a9ff9c3259ea836c6c476b25c9c49 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:23:40 2012 +0100 Easy interface... commit 9f761ff51b53913b21fbde30a652d21064840361 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:21:27 2012 +0100 Easy interface... commit 795c6464ca8be977ad1cdfad44c5cc7b427d30c5 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:19:08 2012 +0100 Easy interface... commit 64f60cddad9eefec5819d20c4f021c3608b2a822 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:18:32 2012 +0100 Easy interface... commit d0c595ea84d21e9ac947fc24d5620e20fb307840 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:18:23 2012 +0100 Easy interface... commit 4a593ce313848da9921c3b33cbf3d0cf5f713799 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:17:59 2012 +0100 Easy interface... commit a1552478a0f765fdef516643586c1950f8ba217f Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:15:54 2012 +0100 Easy interface... commit ac2184dee39db2fbcc0aee73da04116dd6bd93d5 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:14:57 2012 +0100 Easy interface... commit 393cbe4bf0eea270e37b8a2ecd78b71152272461 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:14:31 2012 +0100 Easy interface... commit a56995ac8aef7caf10a184acb93b7755b2b541f0 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:13:55 2012 +0100 Easy interface... commit 921d7d6740f4c774bbaed220c0ab109f43ee8849 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:07:57 2012 +0100 Easy interface... commit fe7de39d75e238f5f674c21ecec39f487d941907 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 14:04:36 2012 +0100 Easy interface... commit e6e158dd4343e4d75d385ae0861dc1df131a1c42 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 13:59:29 2012 +0100 Easy interface... commit 9bb88f95d4cb42a393077b578fe697916a638f0d Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 13:59:01 2012 +0100 Easy interface...
12年前
Added xml_open_document API call to read a XML document from file Squashed commit of the following: commit 3501a6d4a4696fe14781043109964f42ff489309 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 16:10:37 2012 +0100 Open XML document... commit e4f63354259055578ef8827bde25c3322c5386ec Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 16:10:04 2012 +0100 Open XML document... commit cf9b46c26059a668f842b472609454ab0f9b809f Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 16:09:56 2012 +0100 Open XML document... commit be3baa3d99609744084f0a2bfe49b5cd73f7ad87 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 16:09:48 2012 +0100 Open XML document... commit 9be46ba2cf68f22f3aa1befd75f6e63a3cc3972f Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 16:07:35 2012 +0100 Open XML document... commit 081a5997470c2e633bc1c8703c14ef7b70c55f29 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 16:06:58 2012 +0100 Open XML document... commit 4af333480380d603266f8df42b8c45408c05d48d Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 16:05:24 2012 +0100 Open XML document... commit f5c3a25541864db290895b652648485bba2e72fc Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 16:04:30 2012 +0100 Open XML document... commit 81ee66c39efaa110e92af713e04cb4249be536dc Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 16:02:53 2012 +0100 Open XML document... commit 1448aa14844bf74c3ccbcc6c4cd62476b6987f04 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 16:02:03 2012 +0100 Open XML document... commit dc767c8d671013b936fdcb729d1ebcad250f6dd4 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 16:01:14 2012 +0100 Open XML document... commit ad23dcc1278b132f01bc1a9c403fbd2261341759 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 16:00:25 2012 +0100 Open XML document... commit f7c905130de9c210f6e522c19ef1d4f29fd1f218 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 15:59:31 2012 +0100 Open XML document... commit 1cce95d4627e1c62bf67b5531a20a49588bef792 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 15:57:29 2012 +0100 Open XML document... commit 1b3fa5f68492bf5091b4cd51dec6c2817e170efa Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 15:45:03 2012 +0100 Open XML document... commit 0778105ea2b0761342b17e22b4be541a6a2ded3b Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 15:41:48 2012 +0100 Open XML document... commit 64418dcb81dcad5cb771553260c54d45eb6544c5 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 15:41:06 2012 +0100 Open XML document... commit 54061a0e3b7a7eb19c2048452a445c654f64a5f4 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 15:40:39 2012 +0100 Open XML document... commit e776734fa212642d0fe467356c66211e06c489db Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 15:39:39 2012 +0100 Open XML document... commit 81bbf1e0c342888ece7de9c921cbd1fb66de3a38 Author: ooxi <85fcd0ef4ec8@f977375cdcd6.anonbox.net> Date: Thu Nov 1 15:38:36 2012 +0100 Open XML document...
12年前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. /**
  2. * Copyright (c) 2012 ooxi/xml.c
  3. * https://github.com/ooxi/xml.c
  4. *
  5. * This software is provided 'as-is', without any express or implied warranty.
  6. * In no event will the authors be held liable for any damages arising from the
  7. * use of this software.
  8. *
  9. * Permission is granted to anyone to use this software for any purpose,
  10. * including commercial applications, and to alter it and redistribute it
  11. * freely, subject to the following restrictions:
  12. *
  13. * 1. The origin of this software must not be misrepresented; you must not
  14. * claim that you wrote the original software. If you use this software in a
  15. * product, an acknowledgment in the product documentation would be
  16. * appreciated but is not required.
  17. *
  18. * 2. Altered source versions must be plainly marked as such, and must not be
  19. * misrepresented as being the original software.
  20. *
  21. * 3. This notice may not be removed or altered from any source distribution.
  22. */
  23. #include <alloca.h>
  24. #include <stdbool.h>
  25. #include <stdio.h>
  26. #include <stdlib.h>
  27. #include <xml.h>
  28. /**
  29. * Will halt the program iff assertion fails
  30. */
  31. static void _assert_that(_Bool condition, char const* message, char const* func, char const* file, int line) {
  32. if (!condition) {
  33. fprintf(stderr, "Assertion failed: %s, in %s (%s:%i)\n", message, func, file, line);
  34. exit(EXIT_FAILURE);
  35. }
  36. }
  37. #define assert_that(condition, message) \
  38. _assert_that(condition, message, __func__, __FILE__, __LINE__)
  39. /**
  40. * @return true iff xml string equals the c string
  41. */
  42. static _Bool string_equals(struct xml_string* a, char const* b) {
  43. size_t a_length = xml_string_length(a);
  44. size_t b_length = strlen(b);
  45. uint8_t* a_buffer = alloca((a_length + 1) * sizeof(uint8_t));
  46. xml_string_copy(a, a_buffer, a_length);
  47. a_buffer[a_length] = 0;
  48. if (a_length != b_length) {
  49. fprintf(stderr, "string_equals: %s#%i <> %s#%i\n", a_buffer, (int)a_length, b, (int)b_length);
  50. return false;
  51. }
  52. size_t i = 0; for (; i < a_length; ++i) {
  53. if (a_buffer[i] != b[i]) {
  54. fprintf(stderr, "string_equals: %s <> %s\n", a_buffer, b);
  55. return false;
  56. }
  57. }
  58. return true;
  59. }
  60. /**
  61. * Converts a static character array to an uint8_t data source
  62. */
  63. #define SOURCE(source, content) \
  64. uint8_t* source = calloc(strlen(content) + 1, sizeof(uint8_t)); \
  65. { char const* content_string = content; \
  66. memcpy(source, content_string, strlen(content) + 1); \
  67. }
  68. /**
  69. * Tries to parse a simple document containing only one tag
  70. */
  71. static void test_xml_parse_document_0() {
  72. SOURCE(source, "<Hello>World</Hello>");
  73. // uint8_t* source = malloc((1 + strlen("<Hello>World</Hello>")) * sizeof(uint8_t));
  74. // { char const* content_string = "<Hello>World</Hello>";
  75. // memcpy(source, content_string, strlen("<Hello>World</Hello>") + 1);
  76. // }
  77. struct xml_document* document = xml_parse_document(source, strlen(source));
  78. assert_that(document, "Could not parse document");
  79. struct xml_node* root = xml_document_root(document);
  80. assert_that(string_equals(xml_node_name(root), "Hello"), "root node name must be `Hello'");
  81. assert_that(string_equals(xml_node_content(root), "World"), "root node content must be `World'");
  82. xml_document_free(document, true);
  83. }
  84. /**
  85. * Tries to parse a document containing multiple tags
  86. */
  87. static void test_xml_parse_document_1() {
  88. SOURCE(source, ""
  89. "<Parent>\n"
  90. "\t<Child>\n"
  91. "\t\tFirst content\n"
  92. "\t</Child>\n"
  93. "\t<Child>\n"
  94. "\t\tSecond content\n"
  95. "\t</Child>\n"
  96. "</Parent>\n"
  97. );
  98. struct xml_document* document = xml_parse_document(source, strlen(source));
  99. assert_that(document, "Could not parse document");
  100. struct xml_node* root = xml_document_root(document);
  101. assert_that(string_equals(xml_node_name(root), "Parent"), "root node name must be `Parent'");
  102. assert_that(2 == xml_node_children(root), "root must have two children");
  103. struct xml_node* first_child = xml_node_child(root, 0);
  104. struct xml_node* second_child = xml_node_child(root, 1);
  105. assert_that(first_child && second_child, "Failed retrieving the children of root");
  106. struct xml_node* third_child = xml_node_child(root, 2);
  107. assert_that(!third_child, "root has a third child where non should be");
  108. assert_that(string_equals(xml_node_name(first_child), "Child"), "first_child node name must be `Child'");
  109. assert_that(string_equals(xml_node_content(first_child), "First content"), "first_child node content must be `First content'");
  110. assert_that(string_equals(xml_node_name(second_child), "Child"), "second_child node name must be `Child'");
  111. assert_that(string_equals(xml_node_content(second_child), "Second content"), "second_child node content must be `tSecond content'");
  112. xml_document_free(document, true);
  113. }
  114. /**
  115. * Tests the eas functionality
  116. */
  117. static void test_xml_parse_document_2() {
  118. SOURCE(source, ""
  119. "<Parent>\n"
  120. "\t<Child>\n"
  121. "\t\tFirst content\n"
  122. "\t</Child>\n"
  123. "\t<This><Is>\n"
  124. "<A><Test>Content A</Test></A>\n"
  125. "<B><Test>Content B</Test></B>\n"
  126. "\t</Is></This>\n"
  127. "\t<Child>\n"
  128. "\t\tSecond content\n"
  129. "\t</Child>\n"
  130. "</Parent>\n"
  131. );
  132. struct xml_document* document = xml_parse_document(source, strlen(source));
  133. assert_that(document, "Could not parse document");
  134. struct xml_node* root = xml_document_root(document);
  135. assert_that(string_equals(xml_node_name(root), "Parent"), "root node name must be `Parent'");
  136. assert_that(3 == xml_node_children(root), "root must have two children");
  137. struct xml_node* test_a = xml_easy_child(root, "This", "Is", "A", "Test", 0);
  138. assert_that(test_a, "Cannot find Parent/This/Is/A/Test");
  139. assert_that(string_equals(xml_node_content(test_a), "Content A"), "Content of Parent/This/Is/A/Test must be `Content A'");
  140. struct xml_node* test_b = xml_easy_child(root, "This", "Is", "B", "Test", 0);
  141. assert_that(test_b, "Cannot find Parent/This/Is/B/Test");
  142. assert_that(string_equals(xml_node_content(test_b), "Content B"), "Content of Parent/This/Is/B/Test must be `Content B'");
  143. struct xml_node* test_c = xml_easy_child(root, "This", "Is", "C", "Test", 0);
  144. assert_that(!test_c, "Must not find Parent/This/Is/C/Test because no such path exists");
  145. struct xml_node* must_be_null = xml_easy_child(root, "Child");
  146. assert_that(!must_be_null, "Parent/Child cannot be a valid expression, because there are two children named `Child' in `Parent'");
  147. uint8_t* name_is = xml_easy_name(xml_easy_child(root, "This", "Is", 0));
  148. assert_that(!strcmp(name_is, "Is"), "Name of Parent/This/Is must be `Is'");
  149. free(name_is);
  150. uint8_t* content_a = xml_easy_content(test_a);
  151. assert_that(!strcmp(content_a, "Content A"), "Content of Parent/This/Is/A/Test must be `Content A'");
  152. free(content_a);
  153. xml_document_free(document, true);
  154. }
  155. /**
  156. * Tests the xml_open_document functionality
  157. */
  158. static void test_xml_parse_document_3() {
  159. #define FILE_NAME "test.xml"
  160. FILE* handle = fopen(FILE_NAME, "rb");
  161. assert_that(handle, "Cannot open " FILE_NAME);
  162. struct xml_document* document = xml_open_document(handle);
  163. assert_that(document, "Cannot parse " FILE_NAME);
  164. struct xml_node* element = xml_easy_child(
  165. xml_document_root(document), "Element", "With", 0
  166. );
  167. assert_that(element, "Cannot find Document/Element/With");
  168. assert_that(string_equals(xml_node_content(element), "Child"), "Content of Document/Element/With must be `Child'");
  169. xml_document_free(document, true);
  170. #undef FILE_NAME
  171. }
  172. /**
  173. * Test parsing of attributes
  174. *
  175. * @author Isty001
  176. * @see https://github.com/Isty001/
  177. */
  178. static void test_xml_parse_attributes() {
  179. #define FILE_NAME "test-attributes.xml"
  180. FILE* handle = fopen(FILE_NAME, "rb");
  181. assert_that(handle, "Cannot open " FILE_NAME);
  182. struct xml_document* document = xml_open_document(handle);
  183. assert_that(document, "Cannot parse " FILE_NAME);
  184. struct xml_node* element = xml_easy_child(
  185. xml_document_root(document), 0
  186. );
  187. assert_that(element, "Cannot find Document/Element/With");
  188. assert_that(2 == xml_node_attributes(element), "Should have 2 attributes");
  189. assert_that(string_equals(xml_node_attribute_name(element, 0), "value"), "Content of Document/Element/With must be `Child'");
  190. assert_that(string_equals(xml_node_attribute_content(element, 0), "2"), "First attribute's content should be \"2\"");
  191. assert_that(string_equals(xml_node_attribute_name(element, 1), "value_2"), "Content of Document/Element/With must be `Child'");
  192. assert_that(string_equals(xml_node_attribute_content(element, 1), "Hello"), "Second attribute's content should be Hello");
  193. xml_document_free(document, true);
  194. #undef FILE_NAME
  195. }
  196. /**
  197. * Console interface
  198. */
  199. int main(int argc, char** argv) {
  200. test_xml_parse_document_0();
  201. test_xml_parse_document_1();
  202. test_xml_parse_document_2();
  203. test_xml_parse_document_3();
  204. test_xml_parse_attributes();
  205. fprintf(stdout, "All tests passed :-)\n");
  206. exit(EXIT_SUCCESS);
  207. }