[AXIS2][AXIOM] org.w3c.dom.DOMException: WRONG_DOCUMENT_ERR with OMElement created from XML file. HELP ME PLEASE, IMPORTANT!
FILIPPO AGAZZI <[email protected]>
| Newsgroups | gmane.text.xml.axis.user |
|---|---|
| Message-ID | <CAKLekw=Me=jTm4JCbyf2h3nYLoi72tFaLwn6M_MTKOMzcXQmmg@mail.gmail.com> |
Hi,
i've got a big problem with this: i wanto to do sth like this.
FileInputStream policyStream = null;
try {
policyStream = new FileInputStream (policy_file);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
StAXOMBuilder stAXOMBuilder = new
StAXOMBuilder(policyStream);
OMElement documentElement =
stAXOMBuilder.getDocumentElement();
tnPolicyColl.addChild(documentElement);
where tnPolicyColl is an OMElement created with a determinate OMFactory.
But i get an error " WRONG_DOCUMENT_ERR: A node is used in a different
document than the one that created it." By many searches i understand that
thw two OMElement must have the same OMFactory. But, the problem is: how
can i do this, when i need to attach as a child an OMElement created from a
source, that is a n XML File? I try also this:
FileReader soapFileReader = new FileReader(policy_file);
XMLStreamReader parser =
XMLInputFactory.newInstance().createXMLStreamReader(soapFileReader);
StAXOMBuilder stAXOMBuilder = new StAXOMBuilder(omFactory,
parser);
OMElement documentElement =
stAXOMBuilder.getDocumentElement();
But it didn't work. How can i creat an AXIOM object, with a child created
from XML File? Please help me, i'm in big trouble!
Thanks in advance,
Agazzi