Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dim xml: Set xml = CreateObject("MSXML2.DOMDocument")
- xml.async = False
- xml.loadxml "<xml>1 2</xml>"
- wscript.echo len(xml.documentelement.text)
- Dim xml: Set xml = CreateObject("MSXML2.DOMDocument")
- xml.async = False
- xml.loadxml "<xml> 2</xml>"
- wscript.echo len(xml.documentelement.text)
- <xml> 2</xml>
- Dim xml As MSXML2.DOMDocument
- Private Sub Form_Load()
- Set xml = CreateObject("MSXML2.DOMDocument")
- xml.async = False
- xml.loadxml "<xml> 2</xml>"
- Dim n
- n = Len(xml.documentelement.selectSingleNode("text()").nodeValue)
- wscript.echo Len(n)
- End Sub
- wscript.echo Len(n)
- <xml><![CDATA[ 2]]></xml>
- % ./whitespace "<foo> </foo>"
- Length of " " is 1
- % ./whitespace "<foo> 2</foo>"
- Length of " 2" is 2
- % ./whitespace "<foo>1 2</foo>"
- Length of "1 2" is 3
- #include <stdio.h>
- #include <string.h>
- #include <libxml/parser.h>
- int
- main(int argc, char **argv)
- {
- char *xml;
- xmlDoc *doc;
- xmlNode *first_child, *node;
- if (argc < 2) {
- fprintf(stderr, "Usage: %s XML-stringn", argv[0]);
- return 1;
- }
- xml = argv[1];
- doc = xmlReadMemory(xml, strlen(xml), "my data", NULL, 0);
- first_child = doc->children;
- first_child = first_child->children; /* Skip the root */
- for (node = first_child; node; node = node->next) {
- if (node->type == XML_TEXT_NODE) {
- fprintf(stdout, "Length of "%s" is %in", (char *) node->content,
- strlen((char *) node->content));
- }
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment