/** End prefix mapping. */ public void endPrefixMapping(String prefix, Augmentations augs) throws XNIException { // check for end of document if (fSeenRootElementEnd) { return; } // call handler if (fDocumentHandler != null) { XercesBridge.getInstance().XMLDocumentHandler_endPrefixMapping(fDocumentHandler, prefix, augs); } } // endPrefixMapping(String,Augmentations)
XercesBridge.getInstance().XMLDocumentHandler_startDocument(fDocumentHandler, locator, encoding, nscontext, augs);
/** Start prefix mapping. */ public void startPrefixMapping(String prefix, String uri, Augmentations augs) throws XNIException { // check for end of document if (fSeenRootElementEnd) { return; } // call handler if (fDocumentHandler != null) { XercesBridge.getInstance().XMLDocumentHandler_startPrefixMapping(fDocumentHandler, prefix, uri, augs); } } // startPrefixMapping(String,String,Augmentations)
String prefix = fNamespaceContext.getDeclaredPrefixAt(i); String uri = fNamespaceContext.getURI(prefix); XercesBridge.getInstance().XMLDocumentHandler_startPrefixMapping(fDocumentHandler, prefix, uri, augs); for (int i = dcount-1; i >= 0; i--) { String prefix = fNamespaceContext.getDeclaredPrefixAt(i); XercesBridge.getInstance().XMLDocumentHandler_endPrefixMapping(fDocumentHandler, prefix, augs);
/** Returns the parser's sub-version number. */ private static int getParserSubVersion() { try { String VERSION = XercesBridge.getInstance().getVersion(); int index1 = VERSION.indexOf('.') + 1; int index2 = VERSION.indexOf('.', index1); if (index2 == -1) { index2 = VERSION.length(); } return Integer.parseInt(VERSION.substring(index1, index2)); } catch (Exception e) { return -1; } } // getParserSubVersion():int
/** Synthesize namespace binding. */ protected void synthesizeBinding(XMLAttributes attrs, String ns) { String prefix = "xmlns"; String localpart = ns; String qname = prefix+':'+localpart; String uri = NamespaceBinder.NAMESPACES_URI; String atype = "CDATA"; String avalue = SYNTHESIZED_NAMESPACE_PREFX+fSynthesizedNamespaceCount++; // add attribute fQName.setValues(prefix, localpart, qname, uri); attrs.addAttribute(fQName, atype, avalue); // bind namespace XercesBridge.getInstance().NamespaceContext_declarePrefix(fNamespaceContext, ns, avalue); } // synthesizeBinding(XMLAttributes,String)
for (int i = 0; i < filters.length; i++) { XMLDocumentFilter filter = filters[i]; XercesBridge.getInstance().XMLDocumentFilter_setDocumentSource(filter, lastSource); lastSource.setDocumentHandler(filter); lastSource = filter;
private static XercesBridge makeInstance() { final String[] classNames = { "org.cyberneko.html.xercesbridge.XercesBridge_2_3", "org.cyberneko.html.xercesbridge.XercesBridge_2_2", "org.cyberneko.html.xercesbridge.XercesBridge_2_1", "org.cyberneko.html.xercesbridge.XercesBridge_2_0" }; for (int i = 0; i != classNames.length; ++i) { final String className = classNames[i]; final XercesBridge bridge = newInstanceOrNull(className); if (bridge != null) { return bridge; } } throw new IllegalStateException("Failed to create XercesBridge instance"); }
String prefix = fNamespaceContext.getDeclaredPrefixAt(i); String uri = fNamespaceContext.getURI(prefix); XercesBridge.getInstance().XMLDocumentHandler_startPrefixMapping(fDocumentHandler, prefix, uri, augs); for (int i = dcount-1; i >= 0; i--) { String prefix = fNamespaceContext.getDeclaredPrefixAt(i); XercesBridge.getInstance().XMLDocumentHandler_endPrefixMapping(fDocumentHandler, prefix, augs);
/** Returns the parser's sub-version number. */ private static int getParserSubVersion() { try { String VERSION = XercesBridge.getInstance().getVersion(); int index1 = VERSION.indexOf('.') + 1; int index2 = VERSION.indexOf('.', index1); if (index2 == -1) { index2 = VERSION.length(); } return Integer.parseInt(VERSION.substring(index1, index2)); } catch (Exception e) { return -1; } } // getParserSubVersion():int
/** Synthesize namespace binding. */ protected void synthesizeBinding(XMLAttributes attrs, String ns) { String prefix = "xmlns"; String localpart = ns; String qname = prefix+':'+localpart; String uri = NamespaceBinder.NAMESPACES_URI; String atype = "CDATA"; String avalue = SYNTHESIZED_NAMESPACE_PREFX+fSynthesizedNamespaceCount++; // add attribute fQName.setValues(prefix, localpart, qname, uri); attrs.addAttribute(fQName, atype, avalue); // bind namespace XercesBridge.getInstance().NamespaceContext_declarePrefix(fNamespaceContext, ns, avalue); } // synthesizeBinding(XMLAttributes,String)
for (int i = 0; i < filters.length; i++) { XMLDocumentFilter filter = filters[i]; XercesBridge.getInstance().XMLDocumentFilter_setDocumentSource(filter, lastSource); lastSource.setDocumentHandler(filter); lastSource = filter;
private static XercesBridge makeInstance() { final String[] classNames = { "org.cyberneko.html.xercesbridge.XercesBridge_2_3", "org.cyberneko.html.xercesbridge.XercesBridge_2_2", "org.cyberneko.html.xercesbridge.XercesBridge_2_1", "org.cyberneko.html.xercesbridge.XercesBridge_2_0" }; for (int i = 0; i != classNames.length; ++i) { final String className = classNames[i]; XercesBridge bridge = (XercesBridge) newInstanceOrNull(className); if (bridge != null) { return bridge; } } throw new IllegalStateException("Failed to create XercesBridge instance"); }
/** Start prefix mapping. */ public void startPrefixMapping(String prefix, String uri, Augmentations augs) throws XNIException { // check for end of document if (fSeenRootElementEnd) { return; } // call handler if (fDocumentHandler != null) { XercesBridge.getInstance().XMLDocumentHandler_startPrefixMapping(fDocumentHandler, prefix, uri, augs); } } // startPrefixMapping(String,String,Augmentations)
/** End prefix mapping. */ public void endPrefixMapping(String prefix, Augmentations augs) throws XNIException { if (fDocumentHandler != null) { XercesBridge.getInstance().XMLDocumentHandler_endPrefixMapping(fDocumentHandler, prefix, augs); } } // endPrefixMapping(String,Augmentations)
/** Start document. */ public void startDocument(XMLLocator locator, String encoding, NamespaceContext nscontext, Augmentations augs) throws XNIException { if (fDocumentHandler != null) { XercesBridge.getInstance().XMLDocumentHandler_startDocument(fDocumentHandler, locator, encoding, nscontext, augs); } } // startDocument(XMLLocator,String,Augmentations)
/** Doctype declaration. */ public void doctypeDecl(String root, String pubid, String sysid, Augmentations augs) throws XNIException { // NOTE: Xerces HTML DOM implementation (up to and including // 2.5.0) throws a heirarchy request error exception // when a doctype node is appended to the tree. So, // don't insert this node into the tree for those // versions... -Ac String VERSION = XercesBridge.getInstance().getVersion(); boolean okay = true; if (VERSION.startsWith("Xerces-J 2.")) { okay = getParserSubVersion() > 5; } // REVISIT: As soon as XML4J is updated with the latest code // from Xerces, then this needs to be updated to // check XML4J's version. -Ac else if (VERSION.startsWith("XML4J")) { okay = false; } // if okay, insert doctype; otherwise, don't risk it if (okay) { super.doctypeDecl(root, pubid, sysid, augs); } } // doctypeDecl(String,String,String,Augmentations)
/** Start prefix mapping. */ public void startPrefixMapping(String prefix, String uri, Augmentations augs) throws XNIException { if (fDocumentHandler != null) { XercesBridge.getInstance().XMLDocumentHandler_startPrefixMapping(fDocumentHandler, prefix, uri, augs); } } // startPrefixMapping(String,String,Augmentations)
/** End prefix mapping. */ public void endPrefixMapping(String prefix, Augmentations augs) throws XNIException { // check for end of document if (fSeenRootElementEnd) { return; } // call handler if (fDocumentHandler != null) { XercesBridge.getInstance().XMLDocumentHandler_endPrefixMapping(fDocumentHandler, prefix, augs); } } // endPrefixMapping(String,Augmentations)
/** Start document. */ public void startDocument(XMLLocator locator, String encoding, NamespaceContext nscontext, Augmentations augs) throws XNIException { if (fDocumentHandler != null) { XercesBridge.getInstance().XMLDocumentHandler_startDocument(fDocumentHandler, locator, encoding, nscontext, augs); } } // startDocument(XMLLocator,String,Augmentations)