Skip to content

tonis2/xml.c3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

xml.c3

XML parser in C3


Installing

Add this file to C3 dependencies folder

And then xml to project.json like below

"dependencies": ["xml"]

Check tests for examples


Using in code

XML nodes can be searched like below

  NodeList members;
  defer members.free();
  
  NodeList types;
  defer types.free();

  root_node.find(fn (node) => node.name == "member", &members);
  root_node.find(fn (node) => node.name == "type" && node.attributes.has_key("category"), &types);
  
  NodeList command_nodes;
  defer command_nodes.free();

  root_node.find(fn (node) => {|
      if (node.name == "command" && node.children.len() > 0) {
          if (node.attributes.has_key("api") && node.attributes["api"]!! == "vulkansc") {
               return false;
          };
          return true;
      }
      return false;
  |}, &command_nodes);

Releases

No releases published

Packages

No packages published

Languages