xml.xml 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!-- ==========================================================================\
  3. |
  4. | To learn how to make your own language parser, please check the following
  5. | link:
  6. | https://npp-user-manual.org/docs/function-list/
  7. |
  8. \=========================================================================== -->
  9. <NotepadPlus>
  10. <functionList>
  11. <!-- ========================================================= [ XML ] -->
  12. <!-- XML - eXtensible Markup Language -->
  13. <parser
  14. displayName="XML Node"
  15. id ="xml_node"
  16. commentExpr="(?x) # Utilize inline comments (see `RegEx - Pattern Modifiers`)
  17. (?:\x3C!--(?:[^\-]|-(?!-\x3E))*--\x3E) # Multi Line Comment
  18. "
  19. >
  20. <function
  21. mainExpr="(?x) # Utilize inline comments (see `RegEx - Pattern Modifiers`)
  22. \x3C # begin of node
  23. (?:
  24. (?-i:\?XML) # only name of root node is allowed to start with a question mark
  25. | \w+(?::\w+)? # a node name can contain a colon e.g. `xs:schema`
  26. )
  27. (?: # match attributes
  28. \s+ # at least one whitespace before attribute-name
  29. \w+(?::\w+)? # an attribute name can contain a colon e.g. `xmlns:xs`
  30. \h*=\h* # name-value separator can be surrounded by blanks
  31. (?: # quoted attribute value, embedded escaped quotes allowed...
  32. \x22(?:[^\x22\x5C]|\x5C.)*?\x22 # ...double quoted...
  33. | \x27(?:[^\x27\x5C]|\x5C.)*?\x27 # ...single quoted
  34. )
  35. )+ # only match nodes with at least one attribute
  36. "
  37. >
  38. <functionName>
  39. <nameExpr expr="[^\x3C]*" />
  40. </functionName>
  41. </function>
  42. </parser>
  43. </functionList>
  44. </NotepadPlus>