public Object unmarshal(String systemId, ObjectModelFactory factory, Object root) throws JBossXBException { if(builder == null) { builder = new ObjectModelBuilder(); } builder.init(factory, root); parser.parse(systemId, builder); return builder.getRoot(); }
public void read(ObjectModelBuilder builder) { builder.endPrefixMapping(prefix); } }
public void startDTD(String name, String publicId, String systemId) { GenericObjectModelFactory factory = getFactory(systemId); try { Class[] sig = {String.class, String.class, String.class}; Method startDTD = factory.getClass().getMethod("startDTD", sig); Object[] args = {name, publicId, systemId}; startDTD.invoke(factory, args); } catch(Exception e) { log.debug("No startDTD found on factory: " + factory); } }
public void mapFactoryToNamespace(ObjectModelFactory factory, String namespaceUri) { if(builder == null) { builder = new ObjectModelBuilder(); } builder.mapFactoryToNamespace(factory, namespaceUri); }
public Object newChild(Object parent, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { // Get the newChild method Class objClass = parent.getClass(); Class[] classes = new Class[] { objClass, UnmarshallingContext.class, String.class, String.class, Attributes.class }; Method method = ObjectModelBuilder.getMethodForElement(typedFactory, "newChild", classes); // If null, try to get the newChild method from the super class while (method == null && objClass.getSuperclass() != Object.class) { objClass = objClass.getSuperclass(); classes = new Class[] { objClass, UnmarshallingContext.class, String.class, String.class, Attributes.class }; method = ObjectModelBuilder.getMethodForElement(typedFactory, "newChild", classes); } // invoke the setValue method Object child = null; if (method != null) { Object[] objects = new Object[] { parent, navigator, namespaceURI, localName, attrs }; child = ObjectModelBuilder.invokeFactory(typedFactory, method, objects); } return child; }
XSTypeDefinition type) Object parent = accepted.isEmpty() ? root : peekAccepted(); if(!namespaceURI.equals(curNsSwitchingFactory)) GenericObjectModelFactory newFactory = getFactory(namespaceURI); if(newFactory != curFactory) pushFactory(namespaceURI, localName, newFactory); pushAll(IGNORED); pushAll(element); pushAccepted(element);
public void endElement(String namespaceURI, String localName, String qName) AllElement element = popAll(); Object acceptedElement = peekAccepted(); if(element.characters != null && element.characters.length() > 0) popFactory(); popAccepted(); Object parent = (accepted.isEmpty() ? null : peekAccepted());
public void mapFactoryToNamespace(ObjectModelFactory factory, String namespaceUri) { if(factoriesToNs == Collections.EMPTY_MAP) { factoriesToNs = new HashMap(); } factoriesToNs.put(namespaceUri, getGenericObjectModelFactory(factory)); }
if(method != null) ObjectModelBuilder.invokeFactory(typedFactory, method, new Object[]{
mapFactoryToNamespace(factory, nsProp);
public void setValue(Object o, UnmarshallingContext navigator, String namespaceURI, String localName, String value) { // Get the setValue method Class objClass = o.getClass(); Class[] classes = new Class[] { objClass, UnmarshallingContext.class, String.class, String.class, String.class }; Method method = ObjectModelBuilder.getMethodForElement(typedFactory, "setValue", classes); // If null, try to get the setValue method from the super class while (method == null && objClass.getSuperclass() != Object.class) { objClass = objClass.getSuperclass(); classes = new Class[] { objClass, UnmarshallingContext.class, String.class, String.class, String.class }; method = ObjectModelBuilder.getMethodForElement(typedFactory, "setValue", classes); } // invoke the setValue method if (method != null) { // property replacement if( replaceProps ) value = StringPropertyReplacer.replaceProperties(value); Object[] objects = new Object[] { o, navigator, namespaceURI, localName, value }; ObjectModelBuilder.invokeFactory(typedFactory, method, objects); } }
public void init(ObjectModelFactory defaultFactory, Object root) { this.defaultFactory = getGenericObjectModelFactory(defaultFactory); all.clear(); accepted.clear(); this.root = root; }
public Object unmarshal(Reader reader, ObjectModelFactory factory, Object root) throws JBossXBException { if(builder == null) { builder = new ObjectModelBuilder(); } builder.init(factory, root); parser.parse(reader, builder); return builder.getRoot(); }
public void popFactory() { if(nsSwitchingFactory == null || nsSwitchingFactory.isEmpty()) { curNameSwitchingFactory = null; curNsSwitchingFactory = null; } else { curNameSwitchingFactory = (String)nameSwitchingFactory.pop(); curNsSwitchingFactory = (String)nsSwitchingFactory.pop(); } curFactory = getFactory(curNsSwitchingFactory); }
public Object unmarshal(InputStream is, ObjectModelFactory factory, Object root) throws JBossXBException { if(builder == null) { builder = new ObjectModelBuilder(); } builder.init(factory, root); parser.parse(is, builder); return builder.getRoot(); }