axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From FILIPPO AGAZZI <filippo.aga...@studenti.unipr.it>
Subject [AXIS2][AXIOM] org.w3c.dom.DOMException: WRONG_DOCUMENT_ERR with OMElement created from XML file. HELP ME PLEASE, IMPORTANT!
Date Mon, 01 Oct 2012 10:02:13 GMT
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

Mime
View raw message