[open [HTML|XML|DOCBOOK] [FILE|PIPE|STRING]] id=expression


Load a new XML, HTML or SGML DOCBOOK document from the file (actually arbitrary URL), command output or string provided by the expression. In XSH the document is given a symbolic name id. To identify the documentin commands like close, save, validate, dtd or enc simply use id. In commands which work on document nodes, give id: prefix to XPath expressions to point the XPath to the document.

xsh> open x=mydoc.xml # open a document

# open a HTML document from the Internet
xsh> open HTML h=""
# quote file name if it contains whitespace
xsh> open y="document with a long name with spaces.xml"

# you may omit the word open when loading an XML file/URI.
xsh> z=mybook.xml

# use HTML or DOCBOOK keywords to load these types
xsh> open HTML z=index.htm

# use PIPE keyword to read output of a command
xsh> open HTML PIPE z='wget -O -'

# use z: prefix to identify the document opened with the
# previous comand in an XPath expression.
xsh> ls z://chapter/title