xml library
RDF/XML Codec Implementation for locorda_rdf_core
This library provides decoding and encoding support for the RDF/XML format as defined by the W3C Recommendation. RDF/XML is the original standard format for representing RDF data as XML, allowing semantic web data to be exchanged in an XML-compatible syntax.
The implementation handles key RDF/XML features including:
- Resource descriptions with rdf:about, rdf:ID, and rdf:resource attributes
- Literal properties with language tags and datatypes
- Container elements (rdf:Bag, rdf:Seq, rdf:Alt)
- Collection elements (rdf:List)
- Blank nodes and reification
To use this package, import it and either:
- Use the pre-defined global codec (similar to dart:convert's json):
import 'package:locorda_rdf_core/core.dart';
import 'package:locorda_rdf_xml/xml.dart';
// Use the global rdfxml codec
final rdfGraph = rdfxml.decode(rdfXmlContent);
final rdfXml = rdfxml.encode(rdfGraph);
- Or register with the format registry for automatic format handling:
import 'package:locorda_rdf_core/core.dart';
import 'package:locorda_rdf_xml/xml.dart';
// Use RdfCore with standard codecs plus RdfXmlCodec
final rdfCore = RdfCore.withStandardCodecs(additionalCodecs: [RdfXmlCodec()]);
// Decode RDF/XML content
final rdfGraph = rdfCore.decode(rdfXmlContent);
// Encode a graph as RDF/XML
final rdfXml = rdfCore.encode(rdfGraph, contentType: "application/rdf+xml");
Classes
- IBlankNodeManager
- Manages blank node creation and retrieval
- IRdfXmlBuilder
- Provides XML building functionality for RDF/XML serialization
- IRdfXmlParser
- Contract for RDF/XML parsing functionality
- IRdfXmlSerializer
- Contract for RDF/XML serialization functionality
- IUriResolver
- Handles URI resolution for RDF/XML processing
- IXmlDocumentProvider
- Provides XML document parsing functionality
- RdfXmlCodec
- Codec plugin for RDF/XML
- RdfXmlDecoderOptions
- Decoder options for RDF/XML processing
- RdfXmlEncoderOptions
- Encoder options for RDF/XML output
Properties
- rdfxml → RdfXmlCodec
-
Global convenience variable for working with RDF/XML format
final
Exceptions / Errors
- RdfStructureException
- Exception for RDF structure errors
- RdfXmlBaseUriRequiredException
- Exception for cases where a base URI is required but not available
- RdfXmlDecoderException
- Base class for RDF/XML-specific exceptions
- RdfXmlEncoderException
- Exception for encoding errors
- UriResolutionException
- Exception for URI resolution errors
- XmlParseException
- Exception for XML parsing errors