1 28 29 package com.caucho.xml; 30 31 class XmlPolicy extends Policy { 32 35 public void init() 36 { 37 super.init(); 38 39 } 40 41 int openAction(XmlParser parser, QName node, QName next) 42 throws XmlParseException 43 { 44 return PUSH; 45 } 46 47 51 int elementCloseAction(XmlParser parser, QName name, String tagEnd) 52 throws XmlParseException 53 { 54 String qname = name.getName(); 55 56 if (qname == "#document" && tagEnd.equals("")) 57 return POP; 58 else if (qname.equals(tagEnd)) 59 return POP; 60 else { 61 if (qname.equals("#document")) 62 qname = L.l("end of document"); 63 else 64 qname = "`</" + qname + ">'"; 65 if (tagEnd.equals("")) 66 tagEnd = L.l("end of file"); 67 else 68 tagEnd = "`</" + tagEnd + ">'"; 69 70 throw parser.error(L.l("expected {0} at {1} (open at {2})", 71 qname, tagEnd, 72 String.valueOf(parser.getNodeLine()))); 73 } 74 } 75 } 76 | Popular Tags |