/** * Determines the Input Encoding of the Document Node to serialize. If the Document Node * is not a DOM Level 3 Node, then null is returned. * * @param nodeArg The Node to serialize * @return A String containing the input encoding. */ protected String getInputEncoding(Node nodeArg) { Document doc = null; // Determine the Input Encoding of the document if (nodeArg != null) { if (nodeArg.getNodeType() == Node.DOCUMENT_NODE) { // The Document node is the Node argument doc = (Document)nodeArg; } else { // The Document node is the Node argument's ownerDocument doc = nodeArg.getOwnerDocument(); } // Determine the DOM Version. if (doc != null && doc.getImplementation().hasFeature("Core","3.0")) { return doc.getInputEncoding(); } } // The default encoding returned is null return null; }
/** * Determines the Input Encoding of the Document Node to serialize. If the Document Node * is not a DOM Level 3 Node, then null is returned. * * @param nodeArg The Node to serialize * @return A String containing the input encoding. */ protected String getInputEncoding(Node nodeArg) { Document doc = null; // Determine the Input Encoding of the document if (nodeArg != null) { if (nodeArg.getNodeType() == Node.DOCUMENT_NODE) { // The Document node is the Node argument doc = (Document)nodeArg; } else { // The Document node is the Node argument's ownerDocument doc = nodeArg.getOwnerDocument(); } // Determine the DOM Version. if (doc != null && doc.getImplementation().hasFeature("Core","3.0")) { return doc.getInputEncoding(); } } // The default encoding returned is null return null; }
DocumentBuilder domBuilder = documentBuilder(schema); this.document = domBuilder.parse(url.toExternalForm()); this.renderedDocument = urlToText(url, document.getInputEncoding());
this.templates = configWrapper.getTemplates(); this.renderedDocument = ConfigurationParser.urlToText(url, document.getInputEncoding()); } catch (XmlConfigurationException e) { throw e;
/** * @inheritDoc */ public String getInputEncoding() { return dom.getInputEncoding(); }
@Override public String getInputEncoding() { return original_.getInputEncoding(); }
public String getInputEncoding() { return _delegate.getInputEncoding(); }
public String getInputEncoding() { return this.doc.getInputEncoding(); }
public String getEncoding() { if (event == START_DOCUMENT) { return node != null ? ((Document)node).getInputEncoding() : null; } else { throw new IllegalStateException(); } }
public String getEncoding() { if (event == START_DOCUMENT) { return dom3 && node != null ? ((Document)node).getInputEncoding() : null; } else { throw new IllegalStateException(); } }
public String getEncoding() { if (event == START_DOCUMENT) { return dom3 && node != null ? ((Document)node).getInputEncoding() : null; } else { throw new IllegalStateException(); } }
/** * Gets the encoding of a document * * @return the encoding */ public static String getDeclaredEncoding(Document document) { String result = document.getXmlEncoding(); if (result == null) result = document.getInputEncoding(); return result; }
public static String getEncoding(Document xmlDocument){ String encoding = xmlDocument.getInputEncoding(); if(encoding == null){ encoding = xmlDocument.getXmlEncoding(); } if(encoding == null){ encoding = "UTF-8"; } return encoding; }
public static String getEncoding(Document xmlDocument){ String encoding = xmlDocument.getInputEncoding(); if(encoding == null){ encoding = xmlDocument.getXmlEncoding(); } if(encoding == null){ encoding = "UTF-8"; } return encoding; }
public final String getEncoding() { Document doc = _doc; String encoding = doc.getInputEncoding(); if (encoding == null) { encoding = doc.getXmlEncoding(); } if (encoding == null) { encoding = "utf-8"; } return encoding; }
public static String serializeToString(Document doc) throws IOException { String encoding = doc.getInputEncoding(); if(encoding == null) encoding = "UTF-8"; return serializeToString(doc, encoding); }
/** * @return * @see org.w3c.dom.Document#getInputEncoding() */ public String getInputEncoding() { return getParent().getInputEncoding(); }
public static String documentToString( Document ownerDocument) { String enc = "UTF-8"; if (ownerDocument.getXmlEncoding() == null) { if (ownerDocument.getInputEncoding() != null) enc = ownerDocument.getInputEncoding(); } else enc = ownerDocument.getXmlEncoding(); String xml = "<?xml version=\"1.0\" encoding=\"" + enc + "\"?>"; xml += "\n" + elementToString(ownerDocument.getDocumentElement()); return xml; }
/** * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ public void runTest() throws Throwable { Document doc; String encodingName; doc = (Document) load("barfoo_utf16", false); encodingName = doc.getInputEncoding(); assertEqualsIgnoreCase("documentgetinputencoding03", "UTF-16BE", encodingName); } /**
/** * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ public void runTest() throws Throwable { Document doc; String encodingName; doc = (Document) load("hc_staff", false); encodingName = doc.getInputEncoding(); assertEqualsIgnoreCase("documentgetinputencoding01", "UTF-8", encodingName); } /**