1 17 package org.apache.ws.jaxme.xs.xml.impl; 18 19 import java.util.ArrayList ; 20 import java.util.List ; 21 22 import javax.xml.parsers.ParserConfigurationException ; 23 24 import org.apache.ws.jaxme.xs.XSParser; 25 import org.apache.ws.jaxme.xs.parser.DOMBuilder; 26 import org.apache.ws.jaxme.xs.parser.XsObjectCreator; 27 import org.apache.ws.jaxme.xs.xml.*; 28 import org.apache.ws.jaxme.xs.xml.XsAnyURI; 29 import org.apache.ws.jaxme.xs.xml.XsEAppinfo; 30 import org.xml.sax.ContentHandler ; 31 import org.xml.sax.SAXException ; 32 33 34 52 public class XsEAppinfoImpl extends XsObjectImpl implements XsEAppinfo { 53 private List childs; 54 private XsAnyURI source; 55 56 protected XsEAppinfoImpl(XsObject pParent) { 57 super(pParent); 58 } 59 60 protected void addChild(Object pChild) { 61 if (childs == null) { 62 childs = new ArrayList (); 63 } 64 childs.add(pChild); 65 } 66 67 protected XsObjectCreator[] getXsObjectCreators() { 68 return null; 69 } 70 71 public Object [] getChilds() { 72 if (childs == null) { 73 return new Object [0]; 74 } else { 75 return childs.toArray(); 76 } 77 } 78 79 public void setSource(XsAnyURI pSource) { 80 source = pSource; 81 } 82 83 public XsAnyURI getSource() { 84 return source; 85 } 86 87 public ContentHandler getChildHandler(String pQName, String pNamespaceURI, String pLocalName) throws SAXException { 88 XsObjectCreator[] objectCreators = getXsObjectCreators(); 89 if (objectCreators != null) { 90 XsQName qName = new XsQName(pNamespaceURI, pLocalName, XsQName.prefixOf(pQName)); 91 for (int i = 0; i < objectCreators.length; i++) { 92 XsObject result = objectCreators[i].newBean(this, getObjectFactory().getLocator(), qName); 93 if (result != null) { 94 addChild(result); 95 return getObjectFactory().newXsSAXParser(result); 96 } 97 } 98 } 99 100 if (XSParser.XML_SCHEMA_URI.equals(pNamespaceURI)) { 101 return null; } 103 104 try { 105 DOMBuilder db = new DOMBuilder(); 106 addChild(db.getDocument()); 107 return db; 108 } catch (ParserConfigurationException e) { 109 throw new SAXException (e); 110 } 111 } 112 113 115 public void addText(String pText) { 116 addChild(pText); 117 } 118 } 119 | Popular Tags |