List of utility methods to do XML QName
boolean | isPrimitiveType(final QName elementType) is Primitive Type if (elementType != null) { return CLASS_BINDING.containsKey(elementType.getLocalPart()); return false; |
boolean | isSameNamespace(QName q1, QName q2) is Same Namespace if (q1 == null && q2 != null) return false; if (q1 != null && q2 == null) return false; String p1 = q1 == null ? "" : q1.getPrefix() != null ? q1.getPrefix() : ""; String p2 = q2 == null ? "" : q2.getPrefix() != null ? q2.getPrefix() : ""; String n1 = q1 == null ? "" : q1.getNamespaceURI() != null ? q1.getNamespaceURI() : ""; String n2 = q2 == null ? "" : q2.getNamespaceURI() != null ? q2.getNamespaceURI() : ""; ... |
boolean | isSameNamespaceAndDifferentPrefix(QName qName, Element element) is Same Namespace And Different Prefix return element.getNamespaceURI() != null && qName.getNamespaceURI().equals(element.getNamespaceURI())
&& (element.getPrefix() == null || !qName.getPrefix().equals(element.getPrefix()));
|
boolean | isTagName(Element element, QName name) is Tag Name return (element.getLocalName().equals(name.getLocalPart())
&& (element.getNamespaceURI() != null && element.getNamespaceURI().equals(name.getNamespaceURI())));
|
boolean | isType(Map is Type if (types == null) { return false; Set<String> a = types.get(name); return a != null && a.contains(attributeName.getLocalPart()); |
boolean | isValidQName(String localPart) Returns true if QName is valid for a given local part.
QName parseqn = DatatypeConverter.parseQName(localPart, nsc);
return parseqn != null;
|
boolean | isWildcardType(QName type) is Wildcard Type return type.toString().equals("*"); |
void | marshal(T value, Class marshal final JAXBElement<T> jaxbEl = createRootElement(value, q_name, elementClass); final JAXBContext jc = JAXBContext.newInstance(packageName); final Marshaller m = jc.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); m.setProperty(Marshaller.JAXB_ENCODING, "UTF-8"); m.marshal(jaxbEl, oStream); |
JAXBElement | marshallJAXBElement(Class marshall JAXB Element if (v == null) { return null; } else { return new JAXBElement<BoundType>(name, declaredType, scope, v); |
String | marshalToString(T obj, Class marshal To String java.io.StringWriter sw = new java.io.StringWriter(); javax.xml.bind.JAXBContext jaxbCtx = javax.xml.bind.JAXBContext.newInstance(clazz.getPackage().getName()); javax.xml.bind.Marshaller marshaller = jaxbCtx.createMarshaller(); marshaller.setProperty(javax.xml.bind.Marshaller.JAXB_ENCODING, "UTF-8"); marshaller.setProperty(javax.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); marshaller.marshal(new JAXBElement(qname, clazz, obj), sw); sw.close(); return sw.toString(); ... |