/** * {@inheritDoc} */ @Override public String toString() { return XmlUtil.indentXmlSimple(FullRenderer.render(this)); } }
/** * Set the classDescriptor attribute to be the ClassDescriptor for the given className in the * Model set by setModel(). Returns immediately if the Model hasn't been set or the className * parameter is "". * * @param className the class name */ protected void setClassDescriptor(String className) { if (model != null && !"".equals(className)) { String fullClassName = model.getPackageName() + "." + XmlUtil.getFragmentFromURI(className); classDescriptor = getClassDescriptorByName(fullClassName); } }
if (bytes[i] == '<' && bytes[i + 1] == '/') { os.write('\n'); writeIndentation(os, --indent); } else if (bytes[i] == '<') { if (i > 0) { os.write('\n'); writeIndentation(os, indent++); } else if (bytes[i] == '/' && bytes[i + 1] == '>') { indent--;
value = URLDecoder.decode(value, "UTF-8"); value = XmlUtil.fixEntityNames(value); valList.set(i, value);
sequenceID = XmlUtil.fixEntityNames(URLDecoder.decode(st.nextToken(), "UTF-8")).trim(); source = st.nextToken().trim(); if ("".equals(source) || ".".equals(source)) {
/** * {@inheritDoc} */ @Override public String toString() { return XmlUtil.indentXmlSimple(FullRenderer.render(this)); } }
/** * Generate a package qualified class name within the specified model from a space separated * list of namespace qualified names * * @param classNames the list of namepace qualified names * @param model the relevant model * @return the package qualified names */ public static String generateClassNames(String classNames, Model model) { if (classNames == null) { return null; } StringBuffer sb = new StringBuffer(); for (String s : StringUtil.tokenize(classNames)) { sb.append(model.getPackageName() + "." + XmlUtil.getFragmentFromURI(s + " ")); } return sb.toString().trim(); } }
public void testFixEntityNames() throws Exception { assertEquals("foo γ bar β zz", XmlUtil.fixEntityNames("foo &ggr; bar &bgr; zz")); } }
if (bytes[i] == '<' && bytes[i + 1] == '/') { os.write('\n'); writeIndentation(os, --indent); } else if (bytes[i] == '<') { if (i > 0) { os.write('\n'); writeIndentation(os, indent++); } else if (bytes[i] == '/' && bytes[i + 1] == '>') { indent--;
writer.close(); fw.write(XmlUtil.indentXmlSimple(sw.toString())); fw.close(); } catch (Exception e) {
/** * Set the classDescriptor attribute to be the ClassDescriptor for the given className in the * Model set by setModel(). Returns immediately if the Model hasn't been set or the className * parameter is "". * * @param className the class name */ protected void setClassDescriptor(String className) { if (model != null && !"".equals(className)) { String fullClassName = model.getPackageName() + "." + XmlUtil.getFragmentFromURI(className); classDescriptor = getClassDescriptorByName(fullClassName); } }
public void testIndentXmlSimple() throws Exception { String input = "<query name=\"\" model=\"testmodel\" view=\"Employee\"><constraint path=\"Employee.age\" op=\"=\" " + "value=\"10\"/><constraint path=\"Employee.department.name\" op=\"=\" value=\"DepartmentA1\"/></query>"; String expected = "<query name=\"\" model=\"testmodel\" view=\"Employee\">\n" + " <constraint path=\"Employee.age\" op=\"=\" value=\"10\"/>\n" + " <constraint path=\"Employee.department.name\" op=\"=\" value=\"DepartmentA1\"/>\n" + "</query>"; String output = XmlUtil.indentXmlSimple(input); System.out.println(output); assertEquals(output, expected); }
/** * Generate a package qualified class name within the specified model from a space separated * list of namespace qualified names * * @param classNames the list of namepace qualified names * @param model the relevant model * @return the package qualified names */ public static String generateClassNames(String classNames, Model model) { if (classNames == null) { return null; } StringBuffer sb = new StringBuffer(); for (String s : StringUtil.tokenize(classNames)) { sb.append(model.getPackageName() + "." + XmlUtil.getFragmentFromURI(s + " ")); } return sb.toString().trim(); } }
writer.close(); fw.write(XmlUtil.indentXmlSimple(sw.toString())); fw.close(); } catch (Exception e) {
/** * Throw a RuntimeException if any of the named class isn't in the Model set by setModel(). * Returns null if the model isn't set or className is "". * * @param className the class name * @return the ClassDescriptor for the given class */ protected ClassDescriptor getClassDescriptorByName(String className) { if (model == null) { return null; } if ("".equals(className)) { return null; } String fullClassName = model.getPackageName() + "." + XmlUtil.getFragmentFromURI(className); ClassDescriptor cd = model.getClassDescriptorByName(fullClassName); if (cd == null) { throw new IllegalArgumentException("class \"" + fullClassName + "\" is not in the Model"); } return cd; }
/** * Throw a RuntimeException if any of the named class isn't in the Model set by setModel(). * Returns null if the model isn't set or className is "". * * @param className the class name * @return the ClassDescriptor for the given class */ protected ClassDescriptor getClassDescriptorByName(String className) { if (model == null) { return null; } if ("".equals(className)) { return null; } String fullClassName = model.getPackageName() + "." + XmlUtil.getFragmentFromURI(className); ClassDescriptor cd = model.getClassDescriptorByName(fullClassName); if (cd == null) { throw new IllegalArgumentException("class \"" + fullClassName + "\" is not in the Model"); } return cd; }