   RDF_XMLLiteral = RDF_IRI + 'XMLLiteral'
 
 
-  extract = (doc, base) ->
-    resolver = doc.createElement('a')
-    resolveURI = (ref) ->
-      resolver.href = ref
-      return resolver.href
-    state = new State(base, resolveURI)
-    builder.init(state)
+  extract = (doc, base, profile='html') ->
+    state = builder.init(doc, base, profile)
     walk(doc.documentElement, state)
     return builder.complete(state)
 

      @data.errors

    getSubject: ->

    getReference: ->
      #resource else if typeof then bnode

    getValue: ->

    getLinks: ->

    getValueProperties: ->

    getListLinks: ->

    getListValueProperties: ->

    getRevLinks: ->


  ##
  # A representation of the logical data expressed by an element. This takes
  # context mappings into account, but does not interpret the # attribute
  # interplay and generation of triples.
  class ElementData
    constructor: (@el, parentState) ->


    getAbout: ->
      if @attrs.about? #and not parent
        next = @state.resolveURI(@attrs.about.value)

    getResource: ->
      if @attrs.resource?
        next = @state.resolveURI(@attrs.resource.value)
      else if @attrs.href?
        next = @el.href
      else if @attrs.src?
        next = @state.resolveURI(@attrs.src.value)

    getTypes: ->
      @attrs.typeof?.value.split(/\s+/)
