本文整理了Java中org.apache.axiom.om.OMElement.getParent()
方法的一些代码示例,展示了OMElement.getParent()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OMElement.getParent()
方法的具体详情如下:
包路径:org.apache.axiom.om.OMElement
类名称:OMElement
方法名:getParent
暂无
代码示例来源:origin: org.apache.ws.commons.axiom/axiom-impl
protected void doWriteEndElement() {
if (parent == root) {
parent = null;
} else {
// Since we use the createOMElement variant that takes a OMXMLParserWrapper parameter,
// we need to update the completion status.
((OMContainerEx)parent).setComplete(true);
parent = (OMElement)parent.getParent();
}
}
代码示例来源:origin: org.apache.ws.commons.axiom/axiom-api
private void endElement() {
target.setComplete(true);
if (elementLevel == 0) {
// This is relevant for OMSourcedElements and for the case where the document has been discarded
// using getDocumentElement(true). In these cases, this will actually set target to null. In all
// other cases, this will have the same effect as the instruction in the else clause.
target = (OMContainerEx)document;
} else {
target = (OMContainerEx)((OMElement)target).getParent();
}
}
代码示例来源:origin: org.apache.ws.commons.axiom/om-aspects
protected void doWriteEndElement() {
if (parent == root) {
parent = null;
} else {
// Since we use the createOMElement variant that takes a OMXMLParserWrapper parameter,
// we need to update the completion status.
((OMContainerEx)parent).setComplete(true);
parent = (OMElement)parent.getParent();
}
}
代码示例来源:origin: usnistgov/iheos-toolkit2
public String parent_id() {
OMElement parent = (OMElement) ro.getParent();
if (parent == null) return "Unknown";
return parent.getAttributeValue(MetadataSupport.id_qname);
}
代码示例来源:origin: usnistgov/iheos-toolkit2
public void rmObjectRefs() {
for (OMElement or : objectRefs) {
if (or.getParent() != null)
or.detach();
}
}
代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.extensions
private long getMaxTimeElement(List lastUpdateTimes) {
for (Object lastUpdateTime : lastUpdateTimes) {
OMElement maxTimeElement = (OMElement) lastUpdateTime;
OMContainer parentElement = maxTimeElement.getParent();
OMElement versionChild;
if ((versionChild = parentElement.getFirstChildWithName(new QName("version"))) != null) {
if (Integer.parseInt(versionChild.getText()) > 0) {
return Long.parseLong(maxTimeElement.getText());
}
}
}
return Long.MIN_VALUE;
}
代码示例来源:origin: org.apache.abdera/abdera-parser
public Map<String, String> getNamespaces() {
Map<String, String> namespaces = new HashMap<String, String>();
OMElement current = this;
while (current != null) {
Iterator i = current.getAllDeclaredNamespaces();
while (i.hasNext()) {
OMNamespace ns = (OMNamespace)i.next();
String prefix = ns.getPrefix();
String uri = ns.getNamespaceURI();
if (!namespaces.containsKey(prefix))
namespaces.put(prefix, uri);
}
OMContainer parent = current.getParent();
current = (OMElement)((parent != null && parent instanceof OMElement) ? parent : null);
}
return Collections.unmodifiableMap(namespaces);
}
代码示例来源:origin: usnistgov/iheos-toolkit2
public void rmObject(OMElement ele) {
if (ele.getParent() != null)
ele.detach();
List<List<OMElement>> containers = this.get_metadata_containers();
for (List<OMElement> container : containers)
container.remove(ele);
}
代码示例来源:origin: org.apache.ws.commons.axiom/axiom-impl
public PushOMBuilder(AxiomSourcedElement root) throws XMLStreamException {
this.root = root;
factory = (OMFactoryEx)root.getOMFactory();
// Seed the namespace context with the namespace context from the parent
OMContainer parent = root.getParent();
if (parent instanceof OMElement) {
for (Iterator it = ((OMElement)parent).getNamespacesInScope(); it.hasNext(); ) {
OMNamespace ns = (OMNamespace)it.next();
setPrefix(ns.getPrefix(), ns.getNamespaceURI());
}
}
}
代码示例来源:origin: usnistgov/iheos-toolkit2
@SuppressWarnings("unchecked")
public Slot(OMElement e) {
myElement = e;
OMContainer ownerContainer = e.getParent();
if (ownerContainer instanceof OMElement)
owner = (OMElement) ownerContainer;
name = e.getAttributeValue(MetadataSupport.slot_name_qname);
OMElement value_list = XmlUtil.firstChildWithLocalName(e, "ValueList");
for (Iterator<OMElement> it=value_list.getChildElements(); it.hasNext(); ) {
OMElement value = it.next();
values.add(value.getText());
}
}
代码示例来源:origin: org.apache.ws.commons.axiom/om-aspects
public PushOMBuilder(AxiomSourcedElement root) throws XMLStreamException {
this.root = root;
factory = (OMFactoryEx)root.getOMFactory();
// Seed the namespace context with the namespace context from the parent
OMContainer parent = root.getParent();
if (parent instanceof OMElement) {
for (Iterator it = ((OMElement)parent).getNamespacesInScope(); it.hasNext(); ) {
OMNamespace ns = (OMNamespace)it.next();
setPrefix(ns.getPrefix(), ns.getNamespaceURI());
}
}
}
代码示例来源:origin: org.wso2.carbon.governance/org.wso2.carbon.governance.registry.extensions
private static void updateTenantsUnboundedFieldMap(GovernanceArtifactConfiguration rxtConfiguration)
throws RegistryException {
if (rxtConfiguration.getMediaType().matches("application/vnd.(.)+\\+xml")) {
updateTenantsUnboundedFieldMap(rxtConfiguration.getContentDefinition().getParent().toString());
}
}
代码示例来源:origin: org.apache.abdera/abdera-parser
public void writeTo(Base base, Writer out, WriterOptions options) throws IOException {
try {
XMLStreamWriter w = StAXUtils.createXMLStreamWriter(out);
XMLStreamWriter pw = new PrettyStreamWriter(w);
OMElement om = (base instanceof Document) ? getOMElement(((Document)base).getRoot()) : (OMElement)base;
String charset = options.getCharset();
if (om.getParent() != null && om.getParent() instanceof OMDocument) {
OMDocument doc = (OMDocument)om.getParent();
pw.writeStartDocument(charset != null ? charset : doc.getCharsetEncoding(), doc.getXMLVersion());
}
om.serialize(pw);
pw.writeEndDocument();
if (options.getAutoClose())
out.close();
} catch (XMLStreamException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: org.wso2.bpel/ode-bpel-epr
@SuppressWarnings("unchecked")
private static void buildNScontext(NSContext nscontext, OMElement element) {
if (element == null)
return;
if (element.getParent() instanceof OMElement)
buildNScontext(nscontext, (OMElement) element.getParent());
if (element.getAllDeclaredNamespaces() != null)
for (Iterator<OMNamespace> i=element.getAllDeclaredNamespaces(); i.hasNext(); ){
OMNamespace omn = i.next();
nscontext.register(omn.getPrefix(), omn.getNamespaceURI());
}
if (element.getDefaultNamespace() != null)
nscontext.register("", element.getDefaultNamespace().getNamespaceURI());
}
代码示例来源:origin: usnistgov/iheos-toolkit2
public void addQueryResults(List<OMElement> metadatas, boolean deepCopy) throws XdsInternalException {
if (deepCopy) {
addQueryResults(metadatas);
return;
}
OMElement res = getQueryResult(); // used for side effect if v3 and error - must
// still have empty RegistryObjectList after RegistryErrorList
if (metadatas != null)
for (int i=0; i<metadatas.size(); i++) {
OMElement ele = metadatas.get(i);
OMContainer parent = ele.getParent();
if (parent != null)
ele.detach();
res.addChild(ele);
}
}
代码示例来源:origin: deegree/deegree3
private Map<String, LinkedList<String>> parseCoordinateSystems() {
Map<String, LinkedList<String>> layerTorCRS = new HashMap<String, LinkedList<String>>();
for ( String layer : namedLayers ) {
LinkedList<String> crss = new LinkedList<String>();
OMElement elem = getLayerElement( layer );
String crsElementName = getPrefix() + getLayerCRSElementName();
List<OMElement> es = getElements( elem, new XPath( crsElementName, nsContext ) );
while ( ( elem = (OMElement) elem.getParent() ).getLocalName().equals( "Layer" ) ) {
es.addAll( getElements( elem, new XPath( crsElementName, nsContext ) ) );
}
for ( OMElement e : es ) {
if ( !crss.contains( e.getText() ) ) {
crss.add( e.getText() );
}
}
layerTorCRS.put( layer, crss );
}
return layerTorCRS;
}
代码示例来源:origin: org.bluestemsoftware.open.eoa.ext/open-eoa-aspect-axiom
protected void setNewElement(OMElement myElement, OMElement newElement) {
if (myElement != null) {
myElement.discard();
}
if (newElement != null && newElement.getParent() != null) {
newElement.discard();
}
this.addChild(newElement);
}
代码示例来源:origin: deegree/deegree3
@SuppressWarnings("unchecked")
private void augmentNamespaceContext( OMElement element, NamespaceBindings nsContext ) {
Iterator<OMNamespace> iterator = element.getAllDeclaredNamespaces();
while ( iterator.hasNext() ) {
OMNamespace namespace = iterator.next();
if ( nsContext.translateNamespacePrefixToUri( namespace.getPrefix() ) == null ) {
nsContext.addNamespace( namespace.getPrefix(), namespace.getNamespaceURI() );
}
}
OMContainer parent = element.getParent();
if ( parent != null && parent instanceof OMElement ) {
augmentNamespaceContext( (OMElement) parent, nsContext );
}
}
代码示例来源:origin: usnistgov/iheos-toolkit2
public void validateStructure(ErrorRecorder er, ValidationContext vc) {
new RegistryObjectValidator(mo, this).validateId(er, vc, "entryUUID", mo.getId(), null);
OMElement parentEle = (OMElement) mo.getRo().getParent();
String parentEleId = ((parentEle == null) ? "null" :
parentEle.getAttributeValue(MetadataSupport.id_qname));
String registryObject = mo.getRo().getAttributeValue(MetadataSupport.registry_object_qname);
if (parentEle != null && !parentEleId.equals(registryObject))
er.err(XdsErrorCode.Code.XDSRegistryMetadataError, mo.identifyingString() + ": is a child of model " + parentEleId + " but the registryObject value is " +
registryObject + ", they must match", this, "ITI TF-3: 4.1.12.5");
if (mo.getValue() == null || mo.getValue().equals(""))
er.err(XdsErrorCode.Code.XDSRegistryMetadataError, mo.identifyingString() + ": value attribute missing or empty", this, "ebRIM 3.0 section 2.11.1");
if (mo.getName() == null || mo.getName().equals(""))
er.err(XdsErrorCode.Code.XDSRegistryMetadataError, mo.identifyingString() + ": display name (Name element) missing or empty", this, "ITI TF-3: 4.1.12.5");
}
代码示例来源:origin: usnistgov/iheos-toolkit2
public void validateStructure(ErrorRecorder er, ValidationContext vc) {
new RegistryObjectValidator(mo, this).validateId(er, vc, "entryUUID", mo.getId(), null);
OMElement parentEle = (OMElement) mo.getRo().getParent();
String parentEleId = ((parentEle == null) ? "null" :
parentEle.getAttributeValue(MetadataSupport.id_qname));
String classifiedObjectId = mo.getRo().getAttributeValue(MetadataSupport.classified_object_qname);
if (parentEle != null && !parentEleId.equals(classifiedObjectId))
er.err(XdsErrorCode.Code.XDSRegistryMetadataError, mo.identifyingString() + ": is a child of model " + parentEleId + " but the classifiedObject value is " +
classifiedObjectId + ", they must match", this, "ITI TF-3: 4.1.12.2");
try {
if (mo.getClassificationScheme() == null || mo.getClassificationScheme().equals(""))
er.err(XdsErrorCode.Code.XDSRegistryMetadataError, mo.identifyingString() + ": does not have a value for the classificationScheme attribute", this, "ebRIM 3.0 section 4.3.1");
else if (!mo.getClassificationScheme().startsWith("urn:uuid:"))
er.err(XdsErrorCode.Code.XDSRegistryMetadataError, mo.identifyingString() + ": classificationScheme attribute value is not have urn:uuid: prefix", this, "ITI TF-3: 4.3.1");
} catch (XdsInternalException e) {
er.err(XdsErrorCode.Code.XDSRegistryMetadataError, e);
}
}
内容来源于网络,如有侵权,请联系作者删除!