public void startChildHandler(Handler child) { // childHandlers.add(child); node.addChild(child.getParseNode()); // initialize the context for the handler if (child instanceof ElementHandler) { // get the containing type (we do this for anonymous complex types) ElementInstance childInstance = (ElementInstance) child.getComponent(); ContextInitializer initer = new ContextInitializer(childInstance, node, child.getContext()); parser.getBindingWalker() .walk(element.getElementDeclaration(), initer, container(), getContext()); } }
public Attr encode( Object value, XSDAttributeDeclaration attribute, Document document, XSDTypeDefinition container) { AttributeEncodeExecutor executor = new AttributeEncodeExecutor(value, attribute, document, logger); BindingVisitorDispatch.walk(value, bindingWalker, attribute, executor, container, context); return executor.getEncodedAttribute(); }
public void warning(SAXParseException e) throws SAXException { if (isValidating()) { validator.warning(e); } }
protected void endElementInternal(ElementHandler handler) { super.endElementInternal(handler); if (stream(handler)) { // throw value into buffer buffer.put(handler.getParseNode().getValue()); // remove this node from parse tree if (handler.getParentHandler() instanceof ElementHandler) { ElementHandler parent = (ElementHandler) handler.getParentHandler(); ((NodeImpl) parent.getParseNode()).removeChild(handler.getParseNode()); // parent.endChildHandler(handler); } } }
protected void configure(Configuration config) { // configure the bindings Map bindings = config.setupBindings(); handlerFactory = new HandlerFactoryImpl(); bindingLoader = new BindingLoader(bindings); bindingWalker = new BindingWalker(bindingLoader); }
public ElementHandler createElementHandler(QName qName, Handler parent, ParserHandler parser) { SchemaIndex index = parser.getSchemaIndex(); // look up the element in the schema XSDElementDeclaration element = index.getElementDeclaration(qName); if (element != null) { return createElementHandler(element, parent, parser); } return null; }
public void endDocument() throws SAXException { super.endDocument(); buffer.close(); }
public ComponentAdapter registerComponentImplementation( Object componentKey, Class componentImplementation) { put(componentKey, componentImplementation); return null; }
public Object getChildValue(Class clazz, Object defaultValue) { Object o = getChildValue(clazz); if (o == null) { o = defaultValue; } return o; }
/** * Sets flag that controls whether the parser will process mixed content in a way that preserves * order of child elements and text. * * @since 2.7 */ public void setHandleMixedContent(boolean handleMixedContent) { handler.setHandleMixedContent(handleMixedContent); }
/** * Sets Flag that forces of the check for {@link ParserDelegate} even in cases where an element * can be parsed normally. * * @since 8.0 * @see Parser#isForceParserDelegate() */ public void setForceParserDelegate(boolean forceParserDelegate) { handler.setForceParserDelegate(forceParserDelegate); }
/** * The type name of the root element being parsed. * * @see Parser#setRootElementType(QName) */ public QName getRootElementType() { return handler.getRootElementType(); }
/** * Returns a list of any validation errors that occured while parsing. * * @return A list of errors, or an empty list if none. */ public List getValidationErrors() { return handler.getValidationErrors(); }
protected HashMap getAttributeIndex() { if (attributeIndex == null) { synchronized (this) { if (attributeIndex == null) { buildAttriubuteIndex(); } } } return attributeIndex; }
public Object getAttributeValue(String name, Object defaultValue) { Object o = getAttributeValue(name); if (o == null) { o = defaultValue; } return o; }
/** * Sets the flag controlling wether the parser should validate or not. * * @param validating Validation flag, <code>true</code> to validate, otherwise <code>false * </code> */ public void setValidating(boolean validating) { handler.setValidating(validating); }
protected HashMap getAttributeGroupIndex() { if (attributeGroupIndex == null) { synchronized (this) { if (attributeGroupIndex == null) { buildAttributeGroupIndex(); } } } return attributeGroupIndex; }
/** * Flag that controls whether the parser will process mixed content in a way that preserves * order of child elements and text. * * <p>By default the parser will simply concatenate blindly all child text and not preserve * order with respect to other elements within a mixed content type. * * @since 2.7 */ public boolean isHandleMixedContent() { return handler.isHandleMixedContent(); }
public ComponentAdapter registerComponentInstance( Object componentKey, Object componentInstance) { put(componentKey, componentInstance); return null; }
public ComponentAdapter registerComponentImplementation( Object componentKey, Class componentImplementation, Parameter[] parameters) { put(componentKey, componentImplementation); return null; }