Exemplo n.º 1
0
 public void startElement(TagName tagName) throws SAXException {
   if (tagName.local.equals("Include") && tagName.uri.equals(WellKnownNamespace.XOP)) {
     // found xop:Include
     String href = tagName.atts.getValue("href");
     DataHandler attachment = au.getAttachmentAsDataHandler(href);
     if (attachment == null) {
       // report an error and ignore
       parent.getEventHandler().handleEvent(null);
       // TODO
     }
     base64data.set(attachment);
     next.text(base64data);
     inXopInclude = true;
     followXop = true;
   } else next.startElement(tagName);
 }
Exemplo n.º 2
0
  /**
   * Creates and configures a new unmarshalling pipe line. Depending on the setting, we put a
   * validator as a filter.
   *
   * @return A component that implements both {@link UnmarshallerHandler} and {@link
   *     ValidationEventHandler}. All the parsing errors should be reported to this error handler
   *     for the unmarshalling process to work correctly.
   *     <p>Also, returned handler expects all the XML names to be interned.
   */
  public final XmlVisitor createUnmarshallerHandler(
      InfosetScanner scanner, boolean inplace, JaxBeanInfo expectedType) {

    coordinator.reset(scanner, inplace, expectedType, idResolver);
    XmlVisitor unmarshaller = coordinator;

    // delegate to JAXP 1.3 for validation if the client provided a schema
    if (schema != null) {
      unmarshaller = new ValidatingUnmarshaller(schema, unmarshaller);
    }

    if (attachmentUnmarshaller != null && attachmentUnmarshaller.isXOPPackage()) {
      unmarshaller = new MTOMDecorator(this, unmarshaller, attachmentUnmarshaller);
    }

    return unmarshaller;
  }