1

I'm using Java (JAXP) for XML transformation and I need to pass a fragment of xml as parameter to the transformer:

<DOCTYPES>
    <SUBTYPE>Passport</SUBTYPE>
    <DOCTYPE>Proof of identity</DOCTYPE>
</DOCTYPES>
<DOCTYPES>
    <SUBTYPE>Driving License</SUBTYPE>
    <DOCTYPE>Proof of address</DOCTYPE>
</DOCTYPES>

Let's say xmlfrag contains the above piece of xml. I pass it to the transformer:

transformer.setParameter("orset", xmlfrag);

What is the type that xmlfrag needs to be so I can access it as xml during the transformation? I tried string and xmltype but no luck.

6
  • Could you please specify how will this parameter be used during transformation? It might be possible that you don't need to specify the parameter of this type.
    – oiavorskyi
    Apr 6, 2011 at 17:03
  • @Oleg lavorskyi: The xml nodes I'm trying to pass are a result of a database xquery. Depending on the metadata I need to fetch specific elements from this parameter to insert during the transformation. For this I'm trying to use eXSLT but that fails so I'm not sure whether the XMLType is accepted by the transformer.
    – L4zl0w
    Apr 6, 2011 at 17:08
  • Is converting to String option for you?
    – oiavorskyi
    Apr 6, 2011 at 17:09
  • @Oleg lavorskyi: Unfortunately no. I tried that but if I use string I won't be able to use specific nodes. I believe NodeList would work but I have no idea how to build a NodeList from XMLType.
    – L4zl0w
    Apr 6, 2011 at 17:11
  • Maybe this post might help - stackoverflow.com/questions/2001548/…
    – oiavorskyi
    Apr 6, 2011 at 17:28

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.