private boolean isStartToken(XmlCursor cursor, String string) { if (!cursor.isStart()) { return false; } QName qName = cursor.getName(); if (qName != null && qName.getLocalPart() != null && qName.getLocalPart().equals(string)) { return true; } return false; }
@Override public boolean isLineStyle() { XmlCursor cur = props.newCursor(); String name = cur.getName().getLocalPart(); cur.dispose(); return "lnRef".equals(name); } }
private static int translateParticleCode(Group parseEg) { if (parseEg == null) return 0; return translateParticleCode(parseEg.newCursor().getName()); }
if (attributeNameSet.contains(xc.getName()))
private static void addNoSchemaAttributes(XmlObject elem, List attrList) { XmlCursor cursor = elem.newCursor(); boolean hasAttributes = cursor.toFirstAttribute(); while (hasAttributes) { QName name = cursor.getName(); String namespaceURI = name.getNamespaceURI(); if ("".equals(namespaceURI) || "http://www.w3.org/2001/XMLSchema".equals(namespaceURI)) ; // no nothing else { String attValue = cursor.getTextValue(); String valUri; String prefix; if (attValue.indexOf(':') > 0) prefix = attValue.substring(0, attValue.indexOf(':')); else prefix = ""; cursor.push(); cursor.toParent(); valUri = cursor.namespaceForPrefix(prefix); cursor.pop(); attrList.add(new AttributeImpl(name, attValue, valUri)); //add the attribute } hasAttributes = cursor.toNextAttribute(); } cursor.dispose(); }
if (elementNameSet.contains(xc.getName()))
/** * Selects the content of the attribute with the given name. */ public XmlObject selectAttribute(QName attributeName) { XmlCursor xc = this.newCursor(); try { if (!xc.isContainer()) return null; if (xc.toFirstAttribute()) { //look for attributes do { if (xc.getName().equals(attributeName)) { return xc.getObject(); } } while (xc.toNextAttribute()); } return null; } finally { xc.dispose(); } }
protected Attribute processAttribute(XmlCursor xc, Inst2XsdOptions options, String parentNamespace, TypeSystemHolder typeSystemHolder) { assert xc.isAttr() : "xc not on attribute"; Attribute attribute = new Attribute(); QName attName = xc.getName(); attribute.setName(attName); XmlCursor parent = xc.newCursor(); parent.toParent(); Type simpleContentType = Type.createNamedType( processSimpleContentType(xc.getTextValue(), options, parent), Type.SIMPLE_TYPE_SIMPLE_CONTENT); parent.dispose(); attribute.setType(simpleContentType); checkIfAttributeReferenceIsNeeded(attribute, parentNamespace, typeSystemHolder); return attribute; }
private static String generateInternal(XmlCursor node, XmlCursor context, NamespaceContext nsctx) throws XPathGenerationException { if (node.isStartdoc()) return ""; if (context != null && node.isAtSamePositionAs(context)) return "."; assert node.isStart(); QName name = node.getName(); XmlCursor d = node.newCursor(); if (!node.toParent()) return "/" + name; int elemIndex = 0, i = 1; node.push(); if (!node.toChild(name)) throw new IllegalStateException("Must have at least one child with name: " + name); do { if (node.isAtSamePositionAs(d)) elemIndex = i; else i++; } while (node.toNextSibling(name)); node.pop(); d.dispose(); String pathToParent = generateInternal(node, context, nsctx); return i == 1 ? pathToParent + '/' + qnameToString(name, nsctx) : pathToParent + '/' + qnameToString(name, nsctx) + '[' + elemIndex + ']'; }
private boolean isStartToken(XmlCursor cursor, String string) { if (!cursor.isStart()) { return false; } QName qName = cursor.getName(); if (qName != null && qName.getLocalPart() != null && qName.getLocalPart().equals(string)) { return true; } return false; }
protected static BinaryComparisonOpType convertToBinaryComparisonOp(ComparisonOpsType ops) { QName coQName = ops.newCursor().getName(); if (EQUAL_QNAME.equals(coQName)) { BinaryComparisonOpType bcop = (BinaryComparisonOpType) ops; return bcop; } return null; }
@Override public boolean isLineStyle() { XmlCursor cur = props.newCursor(); String name = cur.getName().getLocalPart(); cur.dispose(); return "lnRef".equals(name); } }
private static int translateParticleCode(Group parseEg) { if (parseEg == null) return 0; return translateParticleCode(parseEg.newCursor().getName()); }
private static int translateParticleCode(Group parseEg) { if (parseEg == null) return 0; return translateParticleCode(parseEg.newCursor().getName()); }
switch (translateAttributeCode(cur.getName()))
for (boolean more = cur.toFirstChild(); more; more = cur.toNextSibling()) QName facetQName = cur.getName(); String facetName = facetQName.getLocalPart(); int code = translateFacetCode(facetQName);