public static XMLStreamException missingAttributes(final Location location, final Set<? extends XmlNameProvider> requiredAttributes) { final StringBuilder b = new StringBuilder("Missing required attributes"); for (XmlNameProvider attribute : requiredAttributes) { b.append(' ').append(attribute.getLocalName()); } return new XMLStreamException(b.toString(), location); }
public static XMLStreamException missingOneOfAttributes(final Location location, XmlNameProvider... attrs) { final StringBuilder b = new StringBuilder("Missing one of required attributes"); for (XmlNameProvider attribute : attrs) { b.append(' ').append(attribute.getLocalName()); } return new XMLStreamException(b.toString(), location); }
public static XMLStreamException expectedAtLeastOneChild(final XMLExtendedStreamReader reader, XmlNameProvider parent, XmlNameProvider... child) { final StringBuilder buf = new StringBuilder("The content of element '").append(parent.getLocalName()).append("' is not complete. One of "); XmlNameProvider c = child[0]; buf.append('\'').append(c.getLocalName()).append('\''); if(child.length > 1) { for(int i = 1; i < child.length; ++i) { buf.append(", '").append(child[i].getLocalName()).append('\''); } } buf.append(" is expected."); return new XMLStreamException(buf.toString(), reader.getLocation()); }
protected static void addAttribute(ElementNode e, XmlNameProvider name, String value) { addAttribute(e, name.getLocalName(), value); }
protected static ElementNode addElement(ElementNode parent, XmlNameProvider e) { return addElement(parent, e.getLocalName(), e.getNamespace()); }