/** * INTERNAL: */ public Map buildAppInfoMap(List appInfoElements) { HashMap appInfoMap = new HashMap(); // Build AppInfo map if (appInfoElements != null) { for (int i = 0; i < appInfoElements.size(); i++) { Element nextElement = (Element)appInfoElements.get(i); if (nextElement.getNamespaceURI().equals(javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI) && nextElement.getLocalName().equals("appinfo")) { String key = nextElement.getAttribute(SDOConstants.APPINFO_SOURCE_ATTRIBUTE); String value = (String)appInfoMap.get(key); StringWriter sw = new StringWriter(); WriterRecord wrec = new WriterRecord(); wrec.setWriter(sw); wrec.node(nextElement, new NamespaceResolver()); wrec.flush(); appInfoMap.put(key, value == null ? sw.toString() : value + sw.toString()); } } } return appInfoMap; }
/** * INTERNAL: */ public void attribute(XPathFragment xPathFragment, NamespaceResolver namespaceResolver, String value) { attribute(null, xPathFragment.getLocalName(), getNameForFragment(xPathFragment), value); }
public void characters(CharSequence characters) throws SAXException { if (isProcessingCData) { cdata(characters.toString()); return; } if (isStartElementOpen) { builder.append('>'); isStartElementOpen = false; } writeValue(characters.toString()); }
writerRecord = new FormattedWriterRecord(); } else { writerRecord = new WriterRecord(); writerRecord.setMarshaller(this); writer = new BufferedWriter(writer); writerRecord.setWriter(writer); xmlDocument = objectToXMLNode(object, session, xmlDescriptor, isXMLRoot); writerRecord.setSession(session); if (isFragment()) { writerRecord.node(xmlDocument, xmlDescriptor.getNamespaceResolver()); } else { writerRecord.startDocument(encoding, version); writerRecord.node(xmlDocument, writerRecord.getNamespaceResolver()); writerRecord.endDocument();
writerRecord = new FormattedWriterRecord(); } else { writerRecord = new WriterRecord(); writerRecord.setWriter(writer); writerRecord.setMarshaller(anXMLMarshaller); writerRecord.flush(); }catch(XMLMarshalException xme){ if(xme.getErrorCode() == XMLMarshalException.DESCRIPTOR_NOT_FOUND_IN_PROJECT){
Attr attr = (Attr) node; String resolverPfx = null; if (getNamespaceResolver() != null) { resolverPfx = this.getNamespaceResolver().resolveNamespaceURI(attr.getNamespaceURI()); attribute(attr.getNamespaceURI(), Constants.EMPTY_STRING, resolverPfx+Constants.COLON+attr.getLocalName(), attr.getNodeValue()); } else { attribute(attr.getNamespaceURI(), Constants.EMPTY_STRING, attr.getName(), attr.getNodeValue()); namespaceDeclaration(attr.getPrefix(), attr.getNamespaceURI()); this.getNamespaceResolver().put(attr.getPrefix(), attr.getNamespaceURI()); characters(node.getNodeValue()); } else { try {
marshalRecord = new JSONWriterRecord(writer, callbackName); } else { marshalRecord = new WriterRecord(); ((WriterRecord) marshalRecord).setWriter(writer);
attribute(attr.getNamespaceURI(), XMLConstants.EMPTY_STRING, resolverPfx+XMLConstants.COLON+attr.getLocalName(), attr.getNodeValue()); } else { attribute(attr.getNamespaceURI(), XMLConstants.EMPTY_STRING, attr.getName(), attr.getNodeValue()); attribute(XMLConstants.XMLNS_URL, XMLConstants.EMPTY_STRING,XMLConstants.XMLNS + XMLConstants.COLON + attr.getPrefix(), attr.getNamespaceURI()); characters(node.getNodeValue()); } else { try {
protected void handleAttributes(Attributes atts) { for (int i=0, attsLength = atts.getLength(); i<attsLength; i++) { String qName = atts.getQName(i); if((qName != null && (qName.startsWith(javax.xml.XMLConstants.XMLNS_ATTRIBUTE + Constants.COLON) || qName.equals(javax.xml.XMLConstants.XMLNS_ATTRIBUTE)))) { continue; } attribute(atts.getURI(i), atts.getLocalName(i), qName, atts.getValue(i)); } }
/** * INTERNAL: */ public void characters(String value) { super.characters(value); isLastEventText = true; complexType = false; }
/** * INTERNAL: */ public void cdata(String value) { //Format the CDATA on it's own line if(isStartElementOpen) { builder.append('>'); isStartElementOpen = false; } super.cdata(value); complexType=false; }
public void startPrefixMapping(String prefix, String uri) throws SAXException { String namespaceUri = getNamespaceResolver().resolveNamespacePrefix(prefix); if(namespaceUri == null || !namespaceUri.equals(uri)) { prefixMappings.put(prefix, uri); } }
/** * INTERNAL: */ public void element(XPathFragment frag) { isLastEventText = false; if (isStartElementOpen) { builder.append('>'); isStartElementOpen = false; } builder.append(Constants.cr()); for (int x = 0; x < numberOfTabs; x++) { builder.append(tab()); } super.element(frag); }
/** * INTERNAL: */ public void endElement(XPathFragment xPathFragment, NamespaceResolver namespaceResolver) { isLastEventText = false; numberOfTabs--; if (isStartElementOpen) { builder.append('/'); builder.append('>'); isStartElementOpen = false; return; } if (complexType) { builder.append(cr); for (int x = 0; x < numberOfTabs; x++) { builder.append(tab()); } } else { complexType = true; } super.endElement(xPathFragment, namespaceResolver); }
writerRecord = new FormattedWriterRecord(); } else { writerRecord = new WriterRecord(); writerRecord.setWriter(writer); writerRecord.setMarshaller(anXMLMarshaller); writerRecord.flush(); }catch(XMLMarshalException xme){ if(xme.getErrorCode() == XMLMarshalException.DESCRIPTOR_NOT_FOUND_IN_PROJECT){
Attr attr = (Attr) node; String resolverPfx = null; if (getNamespaceResolver() != null) { resolverPfx = this.getNamespaceResolver().resolveNamespaceURI(attr.getNamespaceURI()); attribute(attr.getNamespaceURI(), Constants.EMPTY_STRING, resolverPfx+Constants.COLON+attr.getLocalName(), attr.getNodeValue()); } else { attribute(attr.getNamespaceURI(), Constants.EMPTY_STRING, attr.getName(), attr.getNodeValue()); namespaceDeclaration(attr.getPrefix(), attr.getNamespaceURI()); this.getNamespaceResolver().put(attr.getPrefix(), attr.getNamespaceURI()); characters(node.getNodeValue()); } else { try {
marshalRecord = new JSONWriterRecord(writer, callbackName); } else { marshalRecord = new WriterRecord(); ((WriterRecord) marshalRecord).setWriter(writer);
protected void handleAttributes(Attributes atts) { for (int i=0, attsLength = atts.getLength(); i<attsLength; i++) { String qName = atts.getQName(i); if((qName != null && (qName.startsWith(javax.xml.XMLConstants.XMLNS_ATTRIBUTE + Constants.COLON) || qName.equals(javax.xml.XMLConstants.XMLNS_ATTRIBUTE)))) { continue; } attribute(atts.getURI(i), atts.getLocalName(i), qName, atts.getValue(i)); } }
/** * INTERNAL: */ public void characters(String value) { super.characters(value); isLastEventText = true; complexType = false; }
/** * INTERNAL: */ public void cdata(String value) { //Format the CDATA on it's own line if(isStartElementOpen) { builder.append('>'); isStartElementOpen = false; } super.cdata(value); complexType=false; }