summaryrefslogtreecommitdiff
path: root/appl/lib/xml.b
diff options
context:
space:
mode:
authorCharles.Forsyth <devnull@localhost>2006-12-23 00:30:12 +0000
committerCharles.Forsyth <devnull@localhost>2006-12-23 00:30:12 +0000
commit6e425a9de8c003b5a733621a6b6730ec3cc902b8 (patch)
tree314123bcab78ff295f38f85f31dc141e5fe22d15 /appl/lib/xml.b
parent74a4d8c26dd3c1e9febcb717cfd6cb6512991a7a (diff)
20061220
Diffstat (limited to 'appl/lib/xml.b')
-rw-r--r--appl/lib/xml.b21
1 files changed, 13 insertions, 8 deletions
diff --git a/appl/lib/xml.b b/appl/lib/xml.b
index 5e10608d..f93cad8a 100644
--- a/appl/lib/xml.b
+++ b/appl/lib/xml.b
@@ -94,16 +94,22 @@ blankparser: Parser;
open(srcfile: string, warning: chan of (Locator, string), preelem: string): (ref Parser, string)
{
- x := ref blankparser;
- x.in = bufio->open(srcfile, Bufio->OREAD);
- if (x.in == nil)
+ fd := bufio->open(srcfile, Bufio->OREAD);
+ if(fd == nil)
return (nil, sys->sprint("cannot open %s: %r", srcfile));
- # ignore utf16 intialisation character (yuck)
+ return fopen(fd, srcfile, warning, preelem);
+}
+
+fopen(fd: ref Bufio->Iobuf, name: string, warning: chan of (Locator, string), preelem: string): (ref Parser, string)
+{
+ x := ref blankparser;
+ x.in = fd;
+ # ignore utf16 initialisation character (yuck)
c := x.in.getc();
if (c != 16rfffe && c != 16rfeff)
x.in.ungetc();
x.estack = nil;
- x.loc = Locator(1, srcfile, "");
+ x.loc = Locator(1, name, "");
x.warning = warning;
x.preelem = preelem;
return (x, "");
@@ -235,9 +241,8 @@ getparcel(x: ref Parser): ref Parcel
if (p == nil)
p = ref Parcel.EOF;
return p;
- }
- exception e{
- "sax:*" =>
+ }exception e{
+ "sax:*" =>
return ref Parcel.Error(x.loc, x.errormsg);
}
}