fromSrc static method

Future<NclDocument> fromSrc(
  1. String docSrc, {
  2. GingaCC? gingacc,
})

Implementation

static Future<NclDocument> fromSrc(
  String docSrc, {
  GingaCC? gingacc,
}) async {
  _logger.info('Loading NCL document from src: $docSrc');
  gingacc ??= GingaCC();
  final String? xml;
  if (docSrc.trim().startsWith('<')) {
    xml = docSrc;
  } else {
    final docUri = gingacc.resolveUri(docSrc);
    xml = await gingacc.loadContent(docUri);
  }

  final doc = NclDocument.fromContent(
    xml ?? '',
    docSrc: docSrc,
    gingacc: gingacc,
  );
  return doc;
}