Navigate XML document as tree
Hi Otn,
Can you help me! if is possible to navigate a specifed XML document as editable Tree / table tree using ADF components or using any another JSF component.
Thanks in advance :)))
hi user13326790
"A URL service data control is an Oracle ADF data control for URL services, such as XML files that can be accessed through a URL. ...", see "Use a URL Service Data Control"
at http://www.oracle.com/technetwork/developer-tools/jdev/ccset10-all-091120.html
But "H.1 Introduction to Data Controls" in the Developer's Guide for ADF says about the "URL Service Data Control":
"... This type of data control is not updateable. ..."
at http://download.oracle.com/docs/cd/E14571_01/web.1111/b31974/appendix_datacontrols.htm#ADFFD22257
Possibly the other types of Data Controls can be "programmed" to provide updateable access to an XML document, but can't immediately suggest a "preferred" approach.
(tip : You can use "Your Control Panel" to make your name visible in forum posts.)
regards
Jan Vervecken
Similar Messages
-
Hi folks,
I am using a cascaded mapping in my OM. I have a graphical mapping followed by the Java mapping. It is a flat file to IDOC mapping. Everything works fine in Dev but when I transport the same objects to QA, the Operation mapping though it doesn't fail in ESR testing tool, gives the following message and there is no output generated for the same payload which is successfully tested in DEV. Please advise on what could be the possible reasons.
Unable to display tree view; Error when parsing an XML document (Premature end of file.)kalyan,
There seems to be an invalid xml payload which causes this error in ESR not generating the tree view. Please find the similar error screenshot and rectify the payload.
Mutti -
Display xml documents - how to submit a feature request?
Safari is useless when it comes to render raw xml documents. You have to view the actual source to see the xml.
Is there an official way to submit a feature request for safari to apple? I would love to see something similar to what firefox does with xml. Safari is such a fast and nice browser, if it only could handle text/xml better...As you said Safari simply shows all xml element content concatenated together. But no tags or attribute values. If the ContentType in the http header is set to text/xml Firefox shows an xml tree that you can nicely browse. I think IE5+ and Opera do that too. It is important to set the right content type though. Here is an example that shows nice in FF, but is unreadable in Safari:
http://ww3.bgbm.org/biocase/pywrapper.cgi?dsa=Herbar
Sure you can look at the source code, but the xml might not be pretty printed. -
ClassCastException while creating an XML document in servlet
HI,
I am trying to create an XML document in a servlet and I am getting ClassCastException at runtime when casting org.w3c.dom.document to org.apache.crimson.tree.XmlDocument . I am using Tomcat 4.1
The same code is working fine when executed in a stand alone java program
Can anyone please help me in trying to solve this problem. I require it urgently.
The following is my code:
import java.io.*;
import javax.xml.parsers.*;
import org.w3c.dom.*;
import org.apache.crimson.tree.XmlDocument;
public class test{
public void createxml (String username) throws Exception
Document doc=null;
DocumentBuilderFactory dbf=null;
DocumentBuilder db=null;
Element root=null;
Element poline=null;
org.apache.crimson.tree.XmlDocument xmldoc=null;
FileOutputStream fos=null;
dbf = DocumentBuilderFactory.newInstance ();
db = dbf.newDocumentBuilder ();
doc = db.newDocument ();
root = doc.createElement ("album");
doc.appendChild (root);
poline= doc.createElement("album-name");
root.appendChild(poline);
//I am getting the ClassCastException in this statement
xmldoc = (XmlDocument) doc;
fos = new java.io.FileOutputStream("xyz.xml");
xmldoc.write(fos);
fos.close();
}I am not too much of an expert on this issue, but I did a search. Maybe this page can help or point you in the right direction.
http://www.jspwiki.org/Wiki.jsp?page=A2AClassCastException
I hope this helps. -
Creating an Element for an XML Document
Assuming I have an XML file
file.xml
<root>
<child1>
<child2>
<child100>
<root>
i do
SAXBuilder parser = new SAXBuilder();
doc = parser.build(file);
root = doc.getRootElement();This returns a root elemnet for the entire tree.Now my question is how do i create a root element for say jus the top 10 children? That is, is there a way i can create a document just reading the first 10 elements from the file tree above so that when i do a getChildren on root I should have only 10 elements in the list.| 1. How are the attributes of an XML element can be stored to the database
XML SQL Utility (which XSQL uses under the covers) only stores
documents in the canonical format. You'll need to use an XSLT
transformation to transform data into the canonical format
(including transforming attribute values into elements whose
names correspond to the column in which you'd like to store it)
| 2. How can I store a single XML document to multiple database tables?
I outline several techniques for this in my upcoming
O'Reilly book, "Building Oracle XML Applications".
The basic idea is to either:
(1) Use an Object View with an INSTEAD OF INSERT trigger, or
(2) Use a technique that transform the inbound document
into a multi-table insert-format and passes each
relevant part for insert to the XML SQL Utility separately.
null -
Creation of a XML Document with DTD entry
I am trying to create a XML file on the fly. I use the
NodeFactory to contruct a document (createDocument()). I have
then setStandalone("no") and setVersion("1.0"). when I try to
add a DOCTYPE node via appendChild( new XMLNode("test",
Node.DOCUMENT_TYPE_NODE)), I get a ClassCastException.
This is using the 1.0.1.1.0 xml parser.
What is the mechanism to add a node of this type? I noticed that
the NodeFactory did not have a machanism for creating a DOCTYPE
node.
nullNestor Dutko (guest) wrote:
: I am trying to create a XML file on the fly. I use the
: NodeFactory to contruct a document (createDocument()). I have
: then setStandalone("no") and setVersion("1.0"). when I try to
: add a DOCTYPE node via appendChild( new XMLNode("test",
: Node.DOCUMENT_TYPE_NODE)), I get a ClassCastException.
: This is using the 1.0.1.1.0 xml parser.
: What is the mechanism to add a node of this type? I noticed
that
: the NodeFactory did not have a machanism for creating a DOCTYPE
: node.
There is no mechanism to create a new DOCUMENT_TYPE_NODE object
via DOM APIs. The only way to get a DTD object is to parse the
DTD file or the XML file using the DOMParser, and then use the
getDocType() method. Note that new XMLNode("test",
Node.DOCUMENT_TYPE_NODE) does not create a DTD
object. It creates an XMLNode object with the type set to
DOCUMENT_TYPE_NODE, which infact should not be allowed. The
ClassCastException is raised because appendChild expects a DTD
object (based on the type).
Also, we do not do any validation while creating the DOM tree
using the DOM APIs. So setting the DTD in the Document will not
help in validating the DOM tree that is constructed. The only way
to validate an XML file is to parse the XML document using
DOMParser or SAXParser.
Oracle XML Team
http://technet.oracle.com
Oracle Technology Network
null -
How to split XML document into two
I want to create new docuemnt by taking part of the existent XML document under the node document_text
vNodeList := xmldom.getElementsByTagName(vdoc, 'document_text');
vNode := xmldom.item(vNodeList, 0); -- The xmldom.getNodeName(vNode) of this node is exactly what i am
-- looking for
vdoc:= xmldom.makeDocument( vNode);
insert into cltab values (empty_clob()) returning cl into cl;
xmldom.writeToClob(vdoc_txt, cl);
But after that i am still getting the whole document tree, - copy of the whole document.
What am i doing wrong? What functions should i use for this kind of task? xmldom.clonenode?
Could you recommend any good description of the xmldom package?
Thanks,
RomanIf you are using an FI entry F-43 to generate invoice this can be done by giving the same invoice ref. in the Inv. Ref. field for two vendors. This is manual
Document Split will split the document between two profit center and not between vendors. -
? is shown for Norwegian characters when XML document is parsed using DOM
Hi,
I've a sample program that creates a XML document with a single element book having Norwegian characters. Encoding is UTF-8. When i parse the XML document and try to access the value of that element then ? are shown for Norwegian characters. XML document file name is "Sample.xml"
DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = dbfac.newDocumentBuilder();
Document doc = docBuilder.newDocument();
Element root = doc.createElement("root");
root.setAttribute("value", "Á á Ą ą ä É é Ę");
doc.appendChild(root);
TransformerFactory transfac = TransformerFactory.newInstance();
Transformer trans = transfac.newTransformer();
trans.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
trans.setOutputProperty(OutputKeys.INDENT, "yes");
trans.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
//create string from xml tree
java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream();
StreamResult result = new StreamResult(baos);
DOMSource source = new DOMSource(doc);
trans.transform(source, result);
writeToFile("Sample.xml", baos.toByteArray());
InputSource is = new InputSource(new java.io.ByteArrayInputStream(readFile("Sample.xml")));
is.setEncoding("UTF-8");
DocumentBuilder obj_db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document obj_doc = obj_db.parse(is);
obj_doc.normalize();
System.out.println("Value is : " + new String(((Element) obj_doc.getElementsByTagName("root").item(0)).getAttribute("value").getBytes()));writeFile() - Writes the document bytes in Sample.xml file
readFile() - Reads the Sample.xml file
When i run this program XML editor shows the characters correctly but Java code output is: Á á ? ? ä É é ?
What's the problematic area in my java code. I didn't get any help from any source. Please suggest me the solution of this problem.
Thanx in advance.Hi,
I'm using JBuilder 2005 and i mentioned encoding UTF-8 for saving Java source files and also for compilation. I've modified my source code also. But the problem persists. After applying changing the dumped sample.xml file doesn't display these characters correctly in IE, but earlier it was displaying it correctly at IE.
Modified code is:
DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = dbfac.newDocumentBuilder();
Document doc = docBuilder.newDocument();
Element root = doc.createElement("root");
root.setAttribute("value", "Á á Ą ą ä É é Ę");
doc.appendChild(root);
OutputFormat output = new OutputFormat(doc, "UTF-8", true);
java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream();
OutputStreamWriter osw = new OutputStreamWriter(baos, "UTF-8");
XMLSerializer s = new XMLSerializer(osw, output);
s.asDOMSerializer();
s.serialize(doc);
writeToFile("Sample5.xml", baos.toByteArray());
InputSource o = new InputSource(new java.io.ByteArrayInputStream(readFile("Sample5.xml")));
o.setEncoding("UTF-8");
com.sun.org.apache.xerces.internal.parsers.DOMParser obj_parser = new com.sun.org.apache.xerces.internal.parsers.DOMParser();
obj_parser.parse(o);
Document obj_doc = obj_parser.getDocument();
System.out.println("Value : " + new String(((Element) obj_doc.getElementsByTagName("root").item(0)).getAttribute("value").getBytes()));I'm hanged on this issue. Can u please provide me the code snippet that works with these characters or suggest solution.
Thanx -
How can I open a link to an xml document with a specific helper application?
I have an html file with links to multiple xml files. When I click on one of these links, I would like Firefox to use an application of my choosing (e.g., Xmetal) to open the xml file. It works great with sgml files, because I was able to associate the "sgml" content with my external application. I can't seem to make the same thing happen for xml files, though.
Many people on this thread have a common problem, how to download documents that have a .XML extension and then be able to view/edit them in Word. The issue is that Firefox does not treat a file it receives with a .XML extension as a download candidate, it just displays the XML in a tree structure in a popup window or a new tab. If there was an option to automatically (by configuration) open a .XML file in Word or even if it was a manual select option, that would solve the problem. Today you have to go through the process of saving the page, then when the popup down window indicates is completed, you use the right mouse to select open, when then takes you to Word (assuming Word is configured in your OS to process .XML files. This process is difficult to teach to non technical people because it error prone. Any help would be greatly appreciated.
-
XML View & Model, Tree & binding
Hi there,
i'm trying to do some stuff with XML models, XML Views and Trees.
Here is my xml model file :
<objectSet version="1.2.3.4">
<aRoot code="testCode" reference="0123456789" description="TestDescription" owner="Tester">
<component name="MyCompo1" type="MyCompo1Type">
<component name="MyCompo2" type="MyCompo2Type">
<property name="myProperty2-1" type="string" value="null"/>
</component>
<component name="MyCompo3" type="MyCompo3Type">
<property name="myProperty3-1" type="string" value="null"/>
</component>
</component>
</aRoot>
</objectSet>
My XML View file :
<core:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m" xmlns:cmn="sap.ui.commons"
controllerName="cleanproject.TreeTest" xmlns:html="http://www.w3.org/1999/xhtml">
<cmn:Tree nodes="{/aRoot}">
<cmn:TreeNode text="{@name} TagNameHere?"></cmn:TreeNode>
</cmn:Tree>
</core:View>
My Js Controller file :
sap.ui.controller("cleanproject.TreeTest", {
onInit: function() {
var xmlModel = new sap.ui.model.xml.XMLModel("cleanproject/"+xmlPath3);
xmlModel.setXML("the full xml document here"); // bad trick
this.getView'().setModel(xmlModel);
I have multiples questions :
What is the way to wait the xml file to be loaded, because when i'm not using setXML function in my controller, the view is instantiated too fast and an error is raised as the model is not accessible ( Error message : "N is null" )
Is it possible to display in a TreeNode the tagName of an element? ( e.g : "component", "property" )
Is it possible to build the tree only with "component" TreeNodes ?
4. Is it possible to bind a part of the datas , eg : bind with a deepth of 1,2,...n ?
Thanks for helping,
Regards,
Marc
Edit :
1. In the onInit function, use attachRequestCompleted method. In my case :
var thus= this;
xmlModel.attachRequestCompleted(function(event){
thus.getView().setModel(xmlModel);
2.
tree.bindNodes("/",function(sId, oContext){
var tagName = oContext.getObject().tagName;
var name = oContext.getObject().getAttribute("name");
var sText = tagName;
if(name){
sText+=" "+name;
return new cleanproject.custom.ComplexTreeNode({text:sText});
},null,[oFilter]);
3. It does not seem possible even with filters
4. Can be done using javascript and a custom methodHi all,
I just tested again and now it's working...
<Label xmlns="sap.m" design="Standard" text="{/MAIN_OBJECTSet('1')/PROPERTY_NAME}"
visible="true" textAlign="Begin" textDirection="Inherit" width="200px"
required="false" labelFor="">
</Label>
The relative path syntax depends on the used model!
Strange - but ok.
Thanks.
Best regards,
Christoph -
How to write an xml Document to a flat file using JAVA....
Can any one help me out.....
How to write a XML Document to the current filesystem using JAVA....
without using com.sun.xml.tree.*....
Document xmlDoc;
Node rows = (Node) xmlDoc.createElement("ROWS");
xmlDoc.appendChild(rows);
and i have to write this xmlDoc to a file called(abc.xml) for further use...Have you considered using JDOM? ( www.jdom.org )
The XMLOutputter class can write the Document to a file. ( The Document however will be an org.jdom.Document object ).
If you are weary of a new API, you could just create a new File object called abc.xml and stream the data from the XML Document you have to this new File object. -
Traversing the entire nodes of an xml document ?
Hi,
I want to traverse through the entire nodes of an if_ixml_document. which is the best way to do this?
Please find the sample document.
<text>
<id>
<guid auto="false">
432543254543
</guid>
</id>
<title>
<short_title italics="on">
<bold language = "german">
"Hello"
</bold>
</short_title>
</title>
</text>
In this document, i need to traverse through the nodes <text>, <id>, <guid> , <title>, <short_title>, <bold> etc.
Thanks in advance
Regards,
IsharaHi,
there are lots of examples in SDN. Could you try, and revert back in case of specific issue?
There are also examples in SAP library: [SAP Library: Parsing an XML document DOM-based|http://help.sap.com/saphelp_nw70/helpdata/en/86/8280d212d511d5991b00508b6b8b11/frameset.htm ], [SAP Library: Traversing the DOM tree|http://help.sap.com/saphelp_nw70/helpdata/en/86/8280de12d511d5991b00508b6b8b11/frameset.htm ], [SAP Library: Traversing the DOM tree with iterators|http://help.sap.com/saphelp_nw70/helpdata/en/86/8280e112d511d5991b00508b6b8b11/frameset.htm ], ...
And there is demo program: BCCIIXMLT12
Sandra -
Can I append an XML Document into another?
I have a large xml document which I open into coldfusion (mx
7), and then a smaller group of files that are opened into thier
own xml objects. After some customization of xml text values, I
want to append the smaller xml documents into the larger document
at specific positions within the document tree.
I have the code that I thought would do this, using an
arrayappend function, but what happens is that only the root
element of the smaller (inserted) xml document is placed into the
main document.
Is this possible, or do I need to modify the code so that the
entire tree of xml data that I am appending is created on the
fly?Personally I do this with XSLT.
<cfxml variable="doc1">
<root>
<member id="10">
<name>Ian</name>
<sex>male</sex>
</member>
</root>
</cfxml>
<cfxml variable="doc2">
<root>
<member id="1">
<name>Joe</name>
<sex>male</sex>
</member>
<member id="2">
<name>John</name>
<sex>male</sex>
</member>
<member id="3">
<name>Sue</name>
<sex>female</sex>
</member>
</root>
</cfxml>
<cffile action="write" file="#expandPath("/")#\doc2.xml"
output="#ToString(doc2)#" nameconflict="overwrite">
<!--- METHOD ONE using a depreciated and undocumented
method --->
<cfset newNode = doc1.root.member.cloneNode(true)>
<cfset doc2.changeNodeOwner(newNode)>
<cfset doc2.root.appendChild(newNode)>
<cfdump var="#doc2#" label="Merged by hidden functions"
expand="no">
<!--- METHOD TWO using XSLT --->
<!--- create an xsl docutment--->
<cfoutput>
<cfsavecontent variable="transformer">
<xsl:stylesheet xmlns:xsl="
http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="xml"/>
<!--load the merge file -->
<xsl:variable name="emps"
select="document('#expandPath("/")#\doc2.xml')"/>
<!--- this line references and XML file to be combined
with the main file,
I wonder if there is a way to use an XML document in memory
here? --->
<!-- combine the files -->
<xsl:template match="/">
<root>
<!-- select all the child nodes of the root tag in the
main file -->
<xsl:for-each select="root/child::*">
<!-- copy the member tag -->
<xsl:copy-of select="."/>
</xsl:for-each>
<!-- and all the child nodes of the root tag in the merge
file -->
<xsl:for-each select="$emps/root/child::*">
<!-- copy the member tag -->
<xsl:copy-of select="."/>
</xsl:for-each>
</root>
</xsl:template>
</xsl:stylesheet>
</cfsavecontent>
</cfoutput>
<!--- create a combined xml document --->
<cfset doc2 = XMLparse(XMLtransform(doc1,transformer))>
<cfdump var="#doc2#" label="Merged by XSLT"
expand="no"> -
Create xml document by xpath in java
as i know, i can navigate existing xml document by xpath in java, i wonder if i can create a xml document framework by xpath in java?
something like:
Document doc = someobject.create(xpath expression);
then i can use DOM to fill the framework?
ThanksPlease refer
http://www.packtpub.com/article/xpath-support-in-oracle-jdeveloper-xdk-11g -
Does unmarshall operation hold entire XML document in memory?
Hi,
When the unmarshall operation is done on a large XML file, does the root element Java object returned hold the entire XML document in memory? I have a large XML file that I want to unmarshall that contains many <product> elements for example. I want use up as less memory as possible. How would I achieve this?
Thanks.Yes. I am going with Stax + JAXB to unmarshall. Stax so I could iterate over each element and then use JAXB to unmarshall an element at a time. But the solution is a bit involved. I wanted to do it with just JAXB and so I want to know if JAXB holds the entire content tree in memory if I unmarshall the root element.
Maybe you are looking for
-
My caller ID switched itself to off and I can't flick it back to on, everything esle is working is working fine but the button wont move over to on, I reset my settings and the phone but it still wont wor
-
JSP database access application code
Does anyone know of existing sample code, that can be downloaded, for the above that can do the following: 1. User login 2. Data retrieval from database 3. Data submission by fill in form Any help appreciated? Rupert
-
Request iDoc and status iDoc correlation
Hello, I have a strange problem. In my XI 3.0, I have an iDoc2iDoc interface which used to work fine, until I installed patch level 14. Now, when the acknowledgement (ALEAUD) comes back into my R/3 system, the iDoc system does not recognize it as a r
-
Problem with 80GB classic it won't be recognised on itunes or my computer
My girlfriend told me that her pod had suddenly stopped working on her and was telling her that she had to restore it within her itunes, when she tried this the computer wouldn't recognise that there was even anything there. Later trying the same ipo
-
IPhone5 on 6.1.4 - missing named contacts on contact list. Can see missing named contacts when messaging, but when selected come up as only phone numbers in the sent to window. What is resolution? Can I sync only contact list from to iTunes backup?