<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Sorry if I was mis-interpreting what you are originally doing.  The
    other thread poster was literally new()-ing a AuthnRequestBuilder()
    or something, which is bad because as Scott said it's an
    implementation class.  Casting to KeyInfoBuilder is different, but
    still discouraged for the same reasons.<br>
    <br>
    <br>
    <br>
    <br>
    <blockquote cite="mid:5B572EC4-FFCC-4F2E-A923-A73EC168B688@osu.edu"
      type="cite">
      <blockquote type="cite">
        <pre wrap="">Well that makes sense I think. So, more like this then?

XMLObjectBuilder<?> kiBuilder = 
builderFactory.getBuilder(KeyInfo.DEFAULT_ELEMENT_NAME);
ki = (KeyInfo) kiBuilder.buildObject(KeyInfo.DEFAULT_ELEMENT_NAME);
</pre>
      </blockquote>
      <pre wrap="">
Yes, or cast to the SAMLObjectBuilder specialization, but same difference.</pre>
    </blockquote>
    <br>
    <br>
    Almost, but have to be careful.  The stuff in opensaml-xmlsec-impl
    doesn't know anything about SAML.  So the builders don't implement
    SAMLObjectBuilder. For example, the signature-oriented ones
    implement XMLSignatureBuilder, the encryption ones are
    XMLEncryptionBuilder.  What those interfaces (along with
    SAMLObjectBuilder) add is the no-arg buildObject() method.  They're
    all sub-interfaces of XMLObjectBuilder, which doesn't have such a
    method, only methods which take element and/or type QNames (or the
    constituent inputs).  There was a reason why Chad designed things
    that way, although off-hand I don't remember.<br>
    <br>
    So the real answer to your original question is either:<br>
    <br>
    1) cast the builder you get to XMLObjectBuilder<KeyInfo>. 
    Then you have to call buildObject(KeyInfo.DEFAULT_ELEMENT_NAME).<br>
    <br>
    2) cast the builder to XMLSignatureBuilder<KeyInfo>.  Then you
    can just call buildObject().<br>
    <br>
    <br>
    <br>
    <br>
    <blockquote cite="mid:5B572EC4-FFCC-4F2E-A923-A73EC168B688@osu.edu"
      type="cite">
      <pre wrap="">

</pre>
      <blockquote type="cite">
        <pre wrap="">But I wouldn't have thought that based on the example Brent referenced ...
</pre>
      </blockquote>
      <pre wrap="">
</pre>
      <blockquote type="cite">
        <pre wrap="">// Get the assertion builder based on the assertion element name
SAMLObjectBuilder<Assertion> builder = (SAMLObjectBuilder<Assertion>) 
builderFactory.getBuilder(Assertion.DEFAULT_ELEMENT_NAME);

// Create the assertion
Assertion assertion = builder.buildObject();</pre>
      </blockquote>
    </blockquote>
    <br>
    <br>
    Yeah, I guess those examples in the wiki docs are really targeting
    SAMLObjects specifically.  Per the above, they're not completely
    accurate for the non-SAML schemas.  The concepts are the same, just
    not some of the specifics.<br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <blockquote cite="mid:5B572EC4-FFCC-4F2E-A923-A73EC168B688@osu.edu"
      type="cite">
      <blockquote type="cite">
      </blockquote>
    </blockquote>
    <br>
  </body>
</html>