Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for package html #2970

Open
insinfo opened this issue May 27, 2024 · 1 comment
Open

Add support for package html #2970

insinfo opened this issue May 27, 2024 · 1 comment

Comments

@insinfo
Copy link

insinfo commented May 27, 2024

Add support for package html https://pub.dev/packages/html

since dart:html cannot be used in the backend and several use cases for this package, to analyze html files to obtain certain text, web crawler, Generating HTML etc

Example

import 'package:html/parser.dart' as parser;
import 'package:html/dom.dart';

void main() {
  // Example HTML string
  String htmlString = '''
    <html>
      <body>
        <div>Inscrição Estadual: 123456789</div>
        <div>Other content</div>
      </body>
    </html>
  ''';

  // Parse the HTML string
  Document document = parser.parse(htmlString);

  // Find the tag containing 'Inscrição Estadual'
  Element? tag = document.querySelector('body')?.children.firstWhere(
        (element) => element.text.contains('Inscrição Estadual'),
      );

  // Print the found tag or a message if not found
  if (tag != null) {
    print('Found tag: ${tag.outerHtml}');
  } else {
    print('Tag with "Inscrição Estadual" not found.');
  }
}

image

@AkashKeote
Copy link

i would like to work on this project please assign me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants