       else if @typeof
        return @newBNode()
 
-    getValue: ->
-      if @content
-        if @datatype
-          return {"@value": @content, "@datatype": @datatype}
-        else if @lang
-          # TODO: inherited (in compact: if diff. from top-level lang)
-          return {"@value": @content, "@language": @lang}
-        else
-          return @content
-      else# if @xml
-        return {"@value": @xml, "@datatype": @datatype}
+    getLiteral: ->
+      lit = @literal
+      return null unless lit
+      {"@value": lit.value, "@language": lit.lang, "@datatype": lit.datatype}
 
     getLinks: ->
       if @rels

      current = state.current
      nextObj = current

      s = desc.getSubject()
      if s
        current = res.all[s]
        unless current
          current = res.all[s] = {"@id": s}

      o = desc.getReference()
      if o
        nextObj = res.all[o]
        unless nextObj
          nextObj = res.all[o] = {"@id": o}

        for link in desc.getLinks()
          refs = current[link]
          unless refs
            refs = current[link] = []
          refs.push({"@id": o})

      value = desc.getValue()
      if value
        for prop in desc.getValueProperties()
          values = current[prop]
          unless values
            values = current[prop] = []
          values.push(value)

      subState = desc.getChildState()
      subState.current = nextObj
      return subState


      @attrs = @el.attributes
      @tagName = @el.nodeName.toLowerCase()
      @errors = []
      @state = parentState.createInherited(
        @getBase(), @getLang(), @getVocab(), @getPrefixes())

    getBase: ->
