public Object getAttribute(String name) throws NotFoundException { ElementRecord elementRecord = lookupSingleElement(); if (elementRecord.containsAttribute(name)) { return elementRecord.getAttribute(name).getValue(); } else { throw new NotFoundException("Element " + elementRecord.getName() + " has no attribute " + name); } }
@Override public void startElement(String name, UIComponent component) throws IOException { currentRecord = currentRecord.addRecord(new ElementRecord(name,component)); }
@Override public void writeURIAttribute(String name, Object value, String property) throws IOException { currentRecord.addAttribute(new URIAttribute(name, value, property)); }
private ElementRecord lookupSingleElement() throws NotFoundException { List<ElementRecord> result = lookup(); if (0 == result.size()) { throw new NotFoundException("No element found for criteria " + toString()); } else if(result.size()>1){ throw new NotFoundException("More then one element found for criteria " + toString()); } return result.get(0); }
@Override public void writeAttribute(String name, Object value, String property) throws IOException { currentRecord.addAttribute(new Attribute(name, value, property)); }
@Override public void writeText(Object text, String property) throws IOException { currentRecord.addRecord(new TextRecord(text,property)); }
@Override public void startCDATA() throws IOException { currentRecord = currentRecord.addRecord(new CDATARecord()); }
@Override public void writeComment(Object comment) throws IOException { currentRecord.addRecord(new CommentRecord(comment)); }
public String getName() throws NotFoundException { return lookupSingleElement().getName(); }
public String getText() throws NotFoundException { return lookupSingleElement().getText(); }
@Override public String toString() { return "<!--"+getText()+"-->"; }
@Override public String toString() { return "<![CDATA["+getText()+"]]>"; }
public Object getAttribute(String name) throws NotFoundException { ElementRecord elementRecord = lookupSingleElement(); if (elementRecord.containsAttribute(name)) { return elementRecord.getAttribute(name).getValue(); } else { throw new NotFoundException("Element " + elementRecord.getName() + " has no attribute " + name); } }
@Override public void startElement(String name, UIComponent component) throws IOException { currentRecord = currentRecord.addRecord(new ElementRecord(name,component)); }
@Override public void writeURIAttribute(String name, Object value, String property) throws IOException { currentRecord.addAttribute(new URIAttribute(name, value, property)); }
@Override public void writeAttribute(String name, Object value, String property) throws IOException { currentRecord.addAttribute(new Attribute(name, value, property)); }
@Override public void writeText(Object text, String property) throws IOException { currentRecord.addRecord(new TextRecord(text,property)); }
@Override public void startCDATA() throws IOException { currentRecord = currentRecord.addRecord(new CDATARecord()); }
@Override public void writeComment(Object comment) throws IOException { currentRecord.addRecord(new CommentRecord(comment)); }
public String getName() throws NotFoundException { return lookupSingleElement().getName(); }