/** @see java.lang.Object#equals(java.lang.Object) */ public boolean equals(Object obj) { if (super.equals(obj)) { return true; } if (obj instanceof XSIElementHandler) { XSIElementHandler ob = (XSIElementHandler) obj; if (getLocalName() != null) { return getLocalName().equals(ob.getLocalName()); } return (null == ob.getLocalName()); } return false; }
/** * Sets the logging level for all the XSISAXHandlers. * * @param l */ public static void setLogLevel(Level l) { logger.setLevel(l); XSIElementHandler.setLogLevel(l); }
((XSIElementHandler) handlers.peek()).getHandler(namespaceURI, localName); logger.finest( "Parent Node = " + ((XSIElementHandler) handlers.peek()).getClass().getName()); eh.startElement(namespaceURI, localName, atts); } catch (SAXException e) { logger.warning(e.toString());
static SimpleType[] getSimpleTypes(XSIElementHandler child, SchemaHandler parent) { switch (child.getHandlerType()) { case RESTRICTION: return getSimpleTypes((RestrictionHandler) child, parent); case LIST: return getSimpleTypes((ListHandler) child, parent); case UNION: return getSimpleTypes((UnionHandler) child, parent); default: throw new RuntimeException( "Should not be here ... child is one of the other three types."); } }
/** Handles the string chunks collected in {@link #characters}. */ private void handleCharacters() throws SAXException { final String text = characters.toString(); characters.setLength(0); if (text.length() == 0) { return; } XSIElementHandler peek = null; try { if ((text != null) && !"".equals(text.trim())) { peek = (XSIElementHandler) handlers.peek(); peek.characters(text); } } catch (SAXException e) { logger.warning(e.toString()); throw e; } }
/** * Implementation of endElement. push NS,Name * * @param namespaceURI * @param localName * @param qName * @throws SAXException * @see org.xml.sax.ContentHandler#endElement(java.lang.String, java.lang.String, * java.lang.String) */ public void endElement(String namespaceURI, String localName, String qName) throws SAXException { handleCharacters(); logger.fine("END: " + qName); try { XSIElementHandler element = (XSIElementHandler) handlers.pop(); element.endElement(namespaceURI, localName); } catch (SAXException e) { logger.warning(e.toString()); throw e; } }
/** * compacts the data resolving references. * * @param parent */ protected SimpleType compress(SchemaHandler parent) { logger.info("Start compressing SimpleType " + getName()); if (cache != null) { return cache; } Facet[] facets = null; if (child.getHandlerType() == SimpleType.RESTRICTION) { facets = getFacets((RestrictionHandler) child); } SimpleType[] simpleTypes = getSimpleTypes(child, parent); cache = new SimpleTypeGT( id, name, parent.getTargetNamespace(), child.getHandlerType(), simpleTypes, facets, finaL); logger.info("End compressing SimpleType " + getName()); id = null; child = null; return cache; }