List of usage examples for org.jdom2 Attribute getNamespacePrefix
public String getNamespacePrefix()
Attribute
. From source file:ca.nrc.cadc.xml.JsonOutputter.java
License:Open Source License
private boolean writeAttributes(Element e, PrintWriter w, int i) throws IOException { boolean ret = writeSchemaAttributes(e, w, i); Iterator<Attribute> iter = e.getAttributes().iterator(); if (ret && iter.hasNext()) w.print(","); while (iter.hasNext()) { ret = true;//from ww w. ja v a 2 s . c o m Attribute a = iter.next(); indent(w, i); w.print(QUOTE); w.print("@"); if (StringUtil.hasText(a.getNamespacePrefix())) { w.print(a.getNamespacePrefix()); w.print(":"); } w.print(a.getName()); w.print(QUOTE); w.print(" : "); if (isBoolean(e.getName(), a.getValue()) || isNumeric(e.getName(), a.getValue())) { w.print(a.getValue()); } else { w.print(QUOTE); w.print(a.getValue()); w.print(QUOTE); } if (iter.hasNext()) w.print(","); } return ret; }
From source file:es.upm.dit.xsdinferencer.extraction.extractorImpl.TypesExtractorImpl.java
License:Apache License
/** * Returns a path of the attribute made of the name of the elements and their prefixes. * Prefixes are separated from element names by :, so THEY MUST BE REPLACED BY _ if they are going to be used to build type names. * Note that the : WILL always appear, although there is not any namespace prefix. * @param attribute the attribute//from w w w.j a va 2 s .co m * @param config current inference configuration * @param solvedNamespaceToPrefixMapping the solved mappings between the namespace URIs and prefix * @return a list that represents the path * @throws NullPointerException if any argument is null */ public static List<String> getRealPathOfAttributeUnfiltered(Attribute attribute, XSDInferenceConfiguration config, Map<String, String> solvedNamespaceToPrefixMapping) { checkNotNull(attribute, "'attribute' must not be null"); checkNotNull(config, "'config' must not be null"); List<String> path = getRealPathOfElementUnfiltered(attribute.getParent(), config, false, solvedNamespaceToPrefixMapping); path.add("@" + attribute.getNamespacePrefix() + ":" + attribute.getName()); return path; }