2
아파치 공리를 사용하여 XML 파일을 생성하는 데 도움을 주시기 바랍니다 아파치 공리를 사용하여, 하나의 부모와 두 개의 자식 태그있는 모든 XML 파일, 나는샘플 XML 파일 생성
OMFactory factory = OMAbstractFactory.getOMFactory();
OMNamespace ns1 = factory.createOMNamespace("bar","x");
OMElement root = factory.createOMElement("root",ns1);
OMNamespace ns2 = root.declareNamespace("bar1","y");
OMElement elt1 = factory.createOMElement("foo",ns1);
OMElement elt2 = factory.createOMElement("yuck",ns2);
OMText txt1 = factory.createOMText(elt2,"blah");
elt2.addChild(txt1);
elt1.addChild(elt2);
root.addChild(elt1);
어떻게 직렬화하는 방법 좀 도와주세요 다음 코드를 시도 루트 요소. 여기서 OMElment는 직렬화되지 않은 API 클래스입니다. 도와주세요.
고맙습니다. 저에게 맞습니다. 직렬화 된 파일에 루트 요소 문제가 설명되어 있습니다. – Shekkar
반갑습니다. –