On this page:
ssax:  xml->sxml
sxml:  document

2 SAX Parsing

procedure

(ssax:xml->sxml port    
  namespace-prefix-assig)  sxml?
  port : input-port?
  namespace-prefix-assig : (listof (cons/c symbol? string?))
Reads an XML document (which can be a single XML element) from port, and returns the corresponding SXML (top) representation. The namespace-prefix-assig association list provides shortened forms to be used in place of namespaces.

Examples:
> (ssax:xml->sxml
   (open-input-string
    "<zippy><pippy pigtails=\"2\">ab</pippy>cd</zippy>")
   '())

'(*TOP* (zippy (pippy (@ (pigtails "2")) "ab") "cd"))

> (ssax:xml->sxml
    (open-input-string
     "<car xmlns=\"vehicles\"><wheels>4</wheels></car>")
    '())

'(*TOP* (vehicles:car (vehicles:wheels "4")))

> (ssax:xml->sxml
    (open-input-string
     "<car xmlns=\"vehicles\"><wheels>4</wheels></car>")
    '((v . "vehicles")))

'(*TOP* (@ (*NAMESPACES* (v "vehicles"))) (v:car (v:wheels "4")))

procedure

(sxml:document url-string    
  namespace-prefix-assig)  sxml?
  url-string : string?
  namespace-prefix-assig : any/c
Obtain a [possibly, remote] document by its URI

Supported URI formats: local file and HTTP schema

Supported document formats: XML and HTML

REQ-URI - a string that contains the URI of the requested document

NAMESPACE-PREFIX-ASSIG - is passed as-is to the SSAX parser: there it is used for assigning certain user prefixes to certain namespaces.

NAMESPACE-PREFIX-ASSIG is an optional argument and has an effect for an XML resource only. For an HTML resource requested, NAMESPACE-PREFIX-ASSIG is silently ignored.

Result: the SXML representation for the requested document