XMLUtils.h 685 B

1234567891011121314151617181920212223242526272829
  1. /*
  2. * Copyright (c) 2023, Dan Klishch <danilklishch@gmail.com>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibXML/Forward.h>
  8. #include "Parser/ParseError.h"
  9. namespace JSSpecCompiler {
  10. struct IgnoreComments {
  11. ParseErrorOr<void> operator()(XML::Node::Comment const&) { return {}; }
  12. };
  13. inline constexpr IgnoreComments ignore_comments {};
  14. bool contains_empty_text(XML::Node const* node);
  15. Optional<StringView> get_attribute_by_name(XML::Node const* node, StringView attribute_name);
  16. Optional<StringView> get_text_contents(XML::Node const* node);
  17. Optional<XML::Node const*> get_single_child_with_tag(XML::Node const* element, StringView tag_name);
  18. }