Flatten Nested (Hierarchical) XML file
Hello,
We are looking to load an XML file into BI. However the XML file is Nested (Hierarchical). Would XI be able to flatten the XML file? We would like to push the data into BI using ABAP proxy and BI would not be able to deal with a nested XML file directly pushed using SOAP RFC or Web services.
Thanks.
In the nested structure, there are repeating sections where the header is not repeated. Flatten would imply each data record contains all fields, i.e. the header/parent gets repeated at the child level.
H-
|_A1_
|_B1 -
> HA1B1
|_B2 -
> HA1B2
|_A2_ HA2B3
|_B3
Similar Messages
-
How to get Hierarchical XML File from a Database Join Query !
Hi,
How can i get a Hierarchical XML File from a Database Join Query ?
Any join query returns repeated values as below:
BD17:SQL>select d.dname, e.ename, e.sal
2 from dept d
3 natural join
4 emp e
5 /
DNAME ENAME SAL
ACCOUNTING CLARK 2450
ACCOUNTING KING 5000
ACCOUNTING MILLER 1300
RESEARCH SMITH 800
RESEARCH ADAMS 1100
RESEARCH FORD 3000
RESEARCH SCOTT 3000
RESEARCH JONES 2975
SALES ALLEN 1600
SALES BLAKE 2850
SALES MARTIN 1250
SALES JAMES 950
SALES TURNER 1500
SALES WARD 1250
14 rows selected.
We tried use DBMS_XMLQUERY to generate a xml file, but it was unable to get xml in Hierarchical format.
<?xml version="1.0" encoding="ISO-8859-1" ?>
- <ROWSET>
- <ROW num="1">
<DNAME>ACCOUNTING</DNAME>
<ENAME>CLARK</ENAME>
<SAL>2450</SAL>
</ROW>
- <ROW num="2">
<DNAME>ACCOUNTING</DNAME>
<ENAME>KING</ENAME>
<SAL>5000</SAL>
</ROW>
- <ROW num="3">
<DNAME>ACCOUNTING</DNAME>
<ENAME>MILLER</ENAME>
<SAL>1300</SAL>
</ROW>
- <ROW num="4">
<DNAME>RESEARCH</DNAME>
<ENAME>SMITH</ENAME>
<SAL>800</SAL>
</ROW>
- <ROW num="5">
<DNAME>RESEARCH</DNAME>
<ENAME>ADAMS</ENAME>
<SAL>1100</SAL>
</ROW>
- <ROW num="6">
<DNAME>RESEARCH</DNAME>
<ENAME>FORD</ENAME>
<SAL>3000</SAL>
</ROW>
- <ROW num="7">
<DNAME>RESEARCH</DNAME>
<ENAME>SCOTT</ENAME>
<SAL>3000</SAL>
</ROW>
- <ROW num="8">
<DNAME>RESEARCH</DNAME>
<ENAME>JONES</ENAME>
<SAL>2975</SAL>
</ROW>
- <ROW num="9">
<DNAME>SALES</DNAME>
<ENAME>ALLEN</ENAME>
<SAL>1600</SAL>
</ROW>
- <ROW num="10">
<DNAME>SALES</DNAME>
<ENAME>BLAKE</ENAME>
<SAL>2850</SAL>
</ROW>
- <ROW num="11">
<DNAME>SALES</DNAME>
<ENAME>MARTIN</ENAME>
<SAL>1250</SAL>
</ROW>
- <ROW num="12">
<DNAME>SALES</DNAME>
<ENAME>JAMES</ENAME>
<SAL>950</SAL>
</ROW>
- <ROW num="13">
<DNAME>SALES</DNAME>
<ENAME>TURNER</ENAME>
<SAL>1500</SAL>
</ROW>
- <ROW num="14">
<DNAME>SALES</DNAME>
<ENAME>WARD</ENAME>
<SAL>1250</SAL>
</ROW>
</ROWSET>
Thank you for some help.
Nelson AlbertiHi,
I wrote a general ABAP program which can be configured to grab contrent from an URL and post that content as a new PI message into the integration adapter .... from that point on normal PI configuration can be used to route it to anywhere ...
It can be easily scheduled as a background job to grab content on a daily basis etc ...
Regards,
Steven -
Creation of hierarchical XML file
Hi,
I have a requirement to create hierarchical XML file... the levels are mentioned...
any idea whihc FM to be used here?
Regards,
PoonamHi Poonam,
Please describe the problem in detail...
The post is really leads nowhere... nobody can understand what exactly u r loking for
Babu -
Hi all,
any idea on how to create an XML file whihc is hierarchical in structure.... any FM or so?
I have to fetch data from EWM and move it to legacy system using hierarchical AML file format.Hi Poonam,
Best option is to use SAP - PI.
Or
You need to use XSLT methods.
Link:[http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/2e98a690-0201-0010-3b90-cda224bad152?quicklink=index&overridelayout=true]
Regards,
Amitava -
How to update XML file using XSLT
Hi there,
I have a "small" issue with exporting data to an XML file using XSLT.
A two steps process is needed to import data from a non-hierarchical XML file into ABAP, change the data, and then update the XML file with new values. The problem is not trivial, since the format of the XML file is a complex one: there are many interdependent elements on the same level, pointing to each other by using id and ref attributes. Based on these values the data can be read and written into an internal table. I use XSLT and XPath for that. So the inbound process is done and seems to work correctly. I have to mention that the file contains much more data than I need. I am working only with a small part of it.
Now the changed data must be exported back into the XML file, meaning that the content of certain elements must be updated. How can this be done with XSLT? I can pass only the internal table to the transformation, so how do I access the XML file in order to update it? I have tried to use the <B>xsl:document()</B> function to access the content of the file store locally on my PC, but it fails each time by throwing and URI exception. I have tried the absolute path without any addition and the path with the file:/// addition. Same result. Please advise.
Many thanks,
Ferenc
P.S. Please provide me with links only if they are relevant for this very matter. I will not give points for irrelevant postings...Now the changed data must be exported back into the XML file, meaning that the content of certain elements must be updated. How can this be done with XSLT?
XSLT approach: check these online tutorial
http://www.xml.com/pub/a/2000/08/02/xslt/index.html
http://www.xml.com/pub/a/2000/06/07/transforming/index.html
ABAP approach:
for example you have the xml (original) in a string called say xml_out .
data: l_xml type ref to cl_xml_document ,
node type ref to if_ixml_node .
create object l_xml.
call method l_xml->parse_string
exporting
stream = xml_out.
node = l_xml->find_node(
name = 'IDENTITY'
ROOT = ROOT
l_xml->set_attribute(
name = 'Name'
value = 'Charles'
node = node
(the above example reads the element IDENTITY and sets attribute name/value to the same)
like wise you can add new elements starting from IDENTITY using various methods available in class CL_XML_DOCUMENT
so how do I access the XML file in order to update it?
you have already read this XML into a ABAP variable right?
Sorry couldnt understand your whole process, why do you need to read local XML file?
Raja -
Hello
My objective is to have a xml file created from a list for anonymous access. The SharePoint RSS feed is a .aspx file not xml, as shown below:
_layouts/listfeed.aspx?List=21c2cdaa%2D52f3%2D4057%2Db674%2D45e63ba77e31&View=535eb328%2Db5fb%2D45c5%2D8fe8%2Da130e92afc41
Also, is there a way to do this so that the xml content has current data like the list.
Thank you for any insight and direction.Hi,
According to your post, my understanding is that you wanted to create a xml file from a SharePoint list.
To generate a XML file, we can use the SharePoint Object Model or PowerShell to achieve it.
Generate a hierarchical XML file from SharePoint list using Client Object Model.
http://maxderungs.wordpress.com/2012/05/12/generate-a-hierarchical-xml-file-from-sharepoint-list/
Get SharePoint list items and export them to XML using PowerShell
http://www.robertkuzma.com/2012/09/get-sharepoint-list-items-and-export-them-to-xml-using-powershell/
More reference:
http://www.robertkuzma.com/2010/08/how-to-create-a-custom-xml-output-using-sharepoint-services-3-0/
http://traceynolte.com/blog/convert-sharepoint-list-to-xml/
Thanks & Regards,
Jason
Jason Guo
TechNet Community Support -
Create xml file with nested internla table or with header & item tables
Hi I have a requirement like, I need to create an xml file for header and item details. For 1 header there may be multiple line items.
I did search in forums some where I came to know that we can use XSL:IF to achieve this. but I could not able to do this.
I tried with using nested internal tables also but now luck.
can anybody please suggest how can we create xml for header and item detials.
<xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:sap="http://www.sap.com/sapxsl"
xmlns:asx="http://www.sap.com/abapxml"
exclude-result-prefixes="asx"
>
<xsl:template match="/">
<OrbisomRequest>
<xsl:attribute name="Version">
<xsl:value-of select="11.1"/>
</xsl:attribute>
<xsl:attribute name="IssuerID">
<xsl:value-of select="1"/>
</xsl:attribute>
<xsl:for-each select="asx:abap[1]/asx:values[1]/T_FINAL[1]/*">
<CreateApprovedPurchaseRequest
RerquestID="{VBLNR}"
CommonName="User1"
Amount="{WRBTR}"
Comment="TestComment"
CurrencyCode="978"
PurchaseType="All"
SupplierName="All"
VCardAlias="PurchaseCard"
ValidFrom="1M"
CurrencyType="B">
<CDFs>
<Invoice> <xsl:value-of select="BELNR"/> </Invoice>
<Amount> <xsl:value-of select="WRBTR"/> </Amount>
</CDFs>
</CreateApprovedPurchaseRequest>
</xsl:for-each>
</OrbisomRequest>
</xsl:template>
</xsl:transform>
here belnr and wrbtr will be my item details. for each payment document I can have multiple invoices. in CDF I need to display the invoices for that particular payment document.
what conditions can I put there before CDFs to make the item internal table to loop based on header internal table.
Regards,
Ranganadh.Looks like you have already created the transformation "Z_ID"
Take a look at the following thread, it answers many of the questions you have asked:
[ABAP data to XML conv with UTF-8 encoding and custom namespace|Re: ABAP data to XML conv with UTF-8 encoding and custom namespace;
Che -
Flatten to XML does not save Item Names of ListBox to XML file.
On my Front Panel, I have a ListBox Indicator that has Strings from which the User can select. Also the User can edit items in the ListBox to add new elements. After the user selects one and pushes my Save button, I use the Flatten to XML function to save the selection in an XML file. But Flatten to XML only saves the Value (index of the selected item(s)) to the XML file and not the ListBox Item Names. That is enough information to reconstruct which of the String data that the user selected.
In a ListBox where a User is selecting among a list of Strings, shouldn't the Flatten to XML function also store the String(s) that were selected?
Solved!
Go to Solution.Dennis Knutson wrote:
The control is a U32 which is no different than placing a regular numeric control on the front panel. The flatten to xml is only passed a numeric value in both cases. It can't record something that you do not pass to it. The state of the control is the numeric value and the state can be reconstructed with that numeric. If you want to reconstuct the strings (which are not states), use the property node.
I disagree. A ListBox that contains Stings to select from is full of String information. Both I and the User entered those Strings into the ListBox. It is the only data in the Listbox that we see. It is the most important information in the ListBox. The Strings are present in the Item Names. The Flatten to XML does have access to the Item Names and can and should provide them. Neither I nor the User are interested in the Numeric Index of the Selected Items. That is useless information to us. Both of use are dealing with Strings. If the State of the ListBox control is to be reconstructed from the XML data provided by the Flatten to XML function, then the Strings (Item Names) in the Listbox must be provided in the XML data. -
HELP:Miltiple nested level in xml file & Oracle 8i
Hello,
I have xml file with multiple nested level. How can I load the xml file data in Oracle 8i.
Thanks.This is not entirely true as you can have object types as columns.
See the following example from the xsql-demo which selects from a 'nested' table. You can do inserts on this type of tabel as well:
DROP TABLE LOCATION;
DROP TYPE POINT;
CREATE TYPE POINT AS OBJECT (X NUMBER, Y NUMBER);
CREATE TABLE LOCATION (
NAME VARCHAR2(80),
ORIGIN POINT
INSERT INTO LOCATION VALUES ( 'Someplace', POINT(11,17) );
COMMIT;
<?xml version="1.0"?>
<xsql:query connection="demo" xmlns:xsql="urn:oracle-xsql">
SELECT name, origin
FROM location loc
WHERE loc.origin.x = {@x-coord}
</xsql:query> -
Is there a way of flattering an hierarchical xml?
<menu name="Safety Catalog" menuid="1" parentid="">
<menu name="General Regulations" menuid="12">
<menu name="Rule Gr-1" menuid="13" parentid="12"/>
<menu name="Rule Gr-2" menuid="14" parentid="12"/>
</menu>
</menu>
will become
<menu name="Safety Catalog" menuid="1" parentid="">
<menu name="General Regulations" menuid="12"/>
<menu name="Rule Gr-1" menuid="13" parentid="12"/>
<menu name="Rule Gr-2" menuid="14" parentid="12"/>
</menu>
ThanksI think you'd have to do that manually, but xml..menu will flatten the
second and higher levels into one XMLList -
Creating XML nested tags as output in XML files
Hello:
My question is a little extraordinary compared to most users since I am
primarily concerned with the xml output that is generated when a form is
submitted and emailed to a recipient.
Can anyone tell me if it is possible to design a form that can generate an xml file containing nested XML tags using Designer? (See sample output below).
Example:
PARTIAL
MONOCLONAL ANTIBODY
Our company needs this type of nested code for input so we can paste it into a database field we are testing. I have other concerns but I'll defer these to another forum question.
Regards.
Harold[email protected] wrote:<br />> Thanks for the reply. That really helped! To build on this, I have another question which really gets to my dilemma.<br />> <br />> Is there a way to program a numeric text field to control the number of instances of a subform? For example, I would like to have a nested subform appear twice in the form if the user enters 2 in the numeric field. But more importantly, I would like to see its corresponding XML output appear like the following:<br />> <br />> <SUBUNIT_1><br />> <LENGTH></LENGTH><br />> <SEQUENCE><br />> ELEESGGGLVQPGGRQSPEKGLETHYAE<br />> </SEQUENCE><br />> <N_TERMINAL>Yes</N_TERMINAL><br />> <C_TERMINAL></C_TERMINAL><br />> </SUBUNIT_1><br />> <br />> <SUBUNIT_2><br />> <LENGTH></LENGTH><br />> <SEQUENCE><br />> ELEESGGGLVQPGGRQSPEKGLETHYAE<br />> </SEQUENCE><br />> <N_TERMINAL>No</N_TERMINAL><br />> <C_TERMINAL></C_TERMINAL><br />> </SUBUNIT_2><br />> <br />> If you pay close attention to the above code, you will see that I want the parent tag's ending digit incremented each time the subform is repeated. <SUBUNIT_1> <SUBUNIT_2> <SUBUNIT_3> ect . . .<br />> <br />> That is the twist! Is this programmatically possible?<br />> <br />> I might mention that the numeric field is not included as part of the subform. It is part of another subform.<br />> <br />> Regards.<br />> <br />> Harold<br /><br />I am going to respond to your question with another question. Why do <br />you want to do it in this manner? What you are trying to do is change <br />your XML schema on the fly. In my opinion, this is not a good idea, <br />because the data is no longer consistent. Couldn't you just add an <br />index attribute to your xml? For example:<br /> <SUBUNIT><br /> <INDEX>1</INDEX><br /> <LENGTH></LENGTH><br /> <SEQUENCE><br /> ELEESGGGLVQPGGRQSPEKGLETHYAE<br /> </SEQUENCE><br /> <N_TERMINAL>Yes</N_TERMINAL><br /> <C_TERMINAL></C_TERMINAL><br /> </SUBUNIT><br /> <SUBUNIT><br /> <INDEX>2</INDEX><br /> <LENGTH></LENGTH><br /> <SEQUENCE><br /> ELEESGGGLVQPGGRQSPEKGLETHYAE<br /> </SEQUENCE><br /> <N_TERMINAL>No</N_TERMINAL><br /> <C_TERMINAL></C_TERMINAL><br /> </SUBUNIT><br /><br /><br /> Justin Klei<br /> Cardinal Solutions Group<br /> www.cardinalsolutions.com
-
How to parse nested xml file using dom
i want to parse nested xml file
please tell me how to parse nested xml
for eg.
<xml>
<row>
<name>Rahul<name>
<row><newXml>
<newXML>
<Row>
<code>12</code>
</Row>
<newXML>
<XML>
please tell how to parse this fileNormally if you have no idea about X, the first thing you should do is google "X tutorial". You will find plenty of them out there. And the advantage is, they are better written than whatever we spend two minutes throwing together here. Not to mention that it saves us the two minutes.
But if you have specific questions with your SAX parser when you get it going, then ask them here. Actually, ask them in the XML forum here, not this one. -
XML file in Processing not moving further
Dear Expert,
XML file which is continuously generating after 5 seconds in processing
B1i Admin Console > Monitor > Message Box > Processing , I want to stop that and move in success
In detail I open each XML file is showing me different contain.
Now, how to break processing mode to success ?
In Object type i have not set any Filter
ValueMapping : no mapping
Criteria Fields :no criteria fields
Key Handling :4 - Closed System with Return
Schema:/com.sap.b1i.datasync.repository/ObjectType.xsd/B1.8.8_Orders.xsd
<?xml version="1.0" encoding="utf-8"?>
Also getting Technical Error
SAP iApp Explorer > Monitor > Technical Error Monitor
IPO Step
/0010000100.provide/com.sap.b1i.datasync.ipo/P05/P05.ipo/Provide
Time Stamp
20110707132803
Error Description
com.sap.b1i.xcellerator.Xce...com.sap.b1i.xcellerator.XcelleratorException: XCE001 Nested exception: com.sap.b1i.bizprocessor.BizProcException: BPE001 Nested exception: com.sap.b1i.utilities.UtilException: UTE001 Nested exception: com.sap.engine.lib.xml.util.NestedException: -> com.sap.engine.lib.xml.util.NestedException: -> com.sap.engine.lib.xml.util.NestedException: Error parsing query -> java.lang.NullPointerException: while trying to invoke the method com.sap.engine.lib.xsl.xpath.ETItem.evaluate(com.sap.engine.lib.xsl.xpath.XPathContext) of an object loaded from field com.sap.engine.lib.xsl.xpath.ETObject.et of an object loaded from local variable 'q'
Thanks
Kevin
Edited by: Kevin Shah on Jul 7, 2011 1:32 PMHi Kevin,
There must be some errors in your development that block B1iSN processing. You can try to debug your xsl transformation with Xsl debuggers like for example the one included inside XmlSpy.
If you are not developing a B1 to SAP Business Suite you should consider moving your development to B1if. In B1if it is easier to develop and debug your scenarios. With the debug feature you will be able to know which step is blocking your processing very easily.
You can see some recordings showing how to develop new scenarios with B1if in the following link (SAP user login required):
https://psd.sap-ag.de/PEC/calendar/
Hope it helps
Trinidad. -
Getting ORA-22805 when trying to load XML file using SQLLDR
I'm trying to learn the basics of XML since we'll be getting XML files in the near future. I'm using one of the sample schemas that comes with XMLSPY. I loaded this schema into an 11g Oracle DB using XMLSPY:
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XML Spy v4.0 NT beta 1 build Jun 13 2001 (http://www.xmlspy.com) by Alexander Falk (Altova, Inc.) -->
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:ipo="http://www.altova.com/IPO" targetNamespace="http://www.altova.com/IPO" elementFormDefault="unqualified" attributeFormDefault="unqualified">
<annotation>
<documentation>
International Purchase order schema for Example.com
Copyright 2000 Example.com. All rights reserved.
</documentation>
</annotation>
<!-- include address constructs -->
<include schemaLocation="address.xsd"/>
<element name="purchaseOrder" type="ipo:PurchaseOrderType"/>
<element name="comment" type="string"/>
<complexType name="PurchaseOrderType">
<sequence>
<element name="shipTo" type="ipo:Address"/>
<element name="billTo" type="ipo:Address"/>
<element ref="ipo:comment" minOccurs="0"/>
<element name="Items" type="ipo:Items"/>
</sequence>
<attribute name="orderDate" type="date"/>
</complexType>
<complexType name="Items">
<sequence>
<element name="item" minOccurs="0" maxOccurs="unbounded">
<complexType>
<sequence>
<element name="productName" type="string"/>
<element name="quantity">
<simpleType>
<restriction base="positiveInteger">
<maxExclusive value="100"/>
</restriction>
</simpleType>
</element>
<element name="price" type="decimal"/>
<element ref="ipo:comment" minOccurs="0"/>
<element name="shipDate" type="date" minOccurs="0"/>
</sequence>
<attribute name="partNum" type="ipo:Sku"/>
</complexType>
</element>
</sequence>
</complexType>
<simpleType name="Sku">
<restriction base="string">
<pattern value="\d{3}-[A-Z]{2}"/>
</restriction>
</simpleType>
</schema>
Then I created an XMLType table:
CREATE TABLE purchaseOrder OF XMLType
XMLSCHEMA "ipo.xsd" ELEMENT "purchaseOrder"
I'm trying to load the sample XML file ipo.xml into purchaseOrder using SQLLDR. This is ipo.xml:
<?xml version="1.0"?>
<!-- edited with XMLSPY v2004 rel. 4 U (http://www.xmlspy.com) by Mr. Nobody (Altova GmbH) -->
<ipo:purchaseOrder xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ipo="http://www.altova.com/IPO" orderDate="1999-12-01" xsi:schemaLocation="http://www.altova.com/IPO
ipo.xsd">
<shipTo export-code="1" xsi:type="ipo:EU-Address">
<ipo:name>Helen Zoe</ipo:name>
<ipo:street>47 Eden Street</ipo:street>
<ipo:city>Cambridge</ipo:city>
<ipo:postcode>126</ipo:postcode>
</shipTo>
<billTo xsi:type="ipo:US-Address">
<ipo:name>Robert Smith</ipo:name>
<ipo:street>8 Oak Avenue</ipo:street>
<ipo:city>Old Town</ipo:city>
<ipo:state>AK</ipo:state>
<ipo:zip>95819</ipo:zip>
</billTo>
<Items>
<item partNum="833-AA">
<productName>Lapis necklace</productName>
<quantity>2</quantity>
<price>99.95</price>
<ipo:comment>Need this for the holidays!</ipo:comment>
<shipDate>1999-12-05</shipDate>
</item>
<item partNum="748-OT">
<productName>Diamond heart</productName>
<quantity>1</quantity>
<price>248.90</price>
<ipo:comment>Valentine's day packaging.</ipo:comment>
<shipDate>2000-02-14</shipDate>
</item>
<item partNum="783-KL">
<productName>Uncut diamond</productName>
<quantity>7</quantity>
<price>79.90</price>
<shipDate>2000-01-07</shipDate>
</item>
<item partNum="238-KK">
<productName>Amber ring</productName>
<quantity>3</quantity>
<price>89.90</price>
<ipo:comment>With no inclusions, please.</ipo:comment>
<shipDate>2000-01-07</shipDate>
</item>
<item partNum="229-OB">
<productName>Pearl necklace</productName>
<quantity>1</quantity>
<price>4879.00</price>
<shipDate>1999-12-05</shipDate>
</item>
<item partNum="128-UL">
<productName>Jade earring</productName>
<quantity>5</quantity>
<price>179.90</price>
<shipDate>2000-02-14</shipDate>
</item>
</Items>
</ipo:purchaseOrder>
This is what's in the control file:
LOAD DATA
INFILE *
INTO TABLE purchaseOrder TRUNCATE
xmltype(xmldata)
FIELDS
xmldata LOBFILE (CONSTANT ipo.xml)
BEGINDATA
0
The load fails with:
Record 1: Rejected - Error on table PURCHASEORDER.
ORA-22805: cannot insert NULL object into object tables or nested tables
Another question I have is, how do we know how many records (0's) to specify in the control file? In this case there's only one but when real files are used we won't know how many are in the file.
Thanks for your help!The concept was "Don't use SQL*Loader to parse XML".
You can use SQL*Loader to load an entire XML document into the DB. That is fine. You can do the same via BFILENAME to read in files from disk as well.
If you want to parse XML, do that from within Oracle via PL/SQL and/or SQL. The solution depends upon your version of Oracle and what is good enough for you in terms of performance.
So the basics are
a) How am I getting the information?
b) How am I getting in into Oracle?
c) How do I want to parse it?
As I see the schema, it only allows for one ipo:purchaseOrder node in the document, since that is the root node. If you have multiple in the incoming file, you no longer have valid XML, both per the schema and because you have no single root node. You have an XML fragment, which must be treated different.
Just trying to understand the question since I now realize it does not agree with what the schema in your initial example shows. -
Trying to create a XML file from an ASP Form
I have an ASP form on my website that generates a XML data
file, but there are a few problems with it. First, when I generate
the file, it creates a new file every time a user clicks on
"Submit" and I would like the data to just be appended to a
particular, existing XML file...how can I append the data to the
XML file? The code I am currently using is shown below.
Secondly, I need to nest/repeat certain fields within the XML
file. Basically, I want the XML file to look like this (I
simplified the code for ease of writing, so don't bother with the
syntax):
<Recipe>
<RecipeName>
<SubmittedBy>
<Ingredients>
<Amount>
<Unit>
<Ingredient>
<Description>
<Directions>
<Recipe>
<RecipeName>
etc...
How would I create a form that would create that type of XML
file? Think of a MS Access form with linked subforms, but I don't
want to repeat more data than I have to.
Any advice or help would be very appreciated!!! Also, if you
know of a 3-party product that might solve this for me, I am open
to that also!
Thanks!!!
ASP Page Code:You may find this article useful
http://xmlfiles.com/articles/michael/appendxml/default.asp
Paul Whitham
Certified Dreamweaver MX2004 Professional
Adobe Community Expert - Dreamweaver
Valleybiz Internet Design
www.valleybiz.net
"kbeveridge6778" <[email protected]> wrote
in message
news:[email protected]...
>I have an ASP form on my website that generates a XML
data file, but there
>are
> a few problems with it. First, when I generate the file,
it creates a new
> file
> every time a user clicks on "Submit" and I would like
the data to just be
> appended to a particular, existing XML file...how can I
append the data to
> the
> XML file? The code I am currently using is shown below.
>
> Secondly, I need to nest/repeat certain fields within
the XML file.
> Basically, I want the XML file to look like this (I
simplified the code
> for
> ease of writing, so don't bother with the syntax):
> <Recipe>
> <RecipeName>
> <SubmittedBy>
> <Ingredients>
> <Amount>
> <Unit>
> <Ingredient>
> <Description>
> <Directions>
> <Recipe>
> <RecipeName>
> etc...
> How would I create a form that would create that type of
XML file? Think
> of a
> MS Access form with linked subforms, but I don't want to
repeat more data
> than
> I have to.
>
> Any advice or help would be very appreciated!!! Also, if
you know of a
> 3-party product that might solve this for me, I am open
to that also!
>
> Thanks!!!
>
> ASP Page Code:
>
> Function saveXMLData(strPath, strFileName)
>
> 'Declare local variables.
> Dim aXMLDoca
> Dim aRootNode
> Dim aFormVar
> Dim aPI
> Dim Item
>
> 'Create an XMLDOM Object
> Set aXMLDoca = server.CreateObject("Microsoft.XMLDOM")
> aXMLDoca.preserveWhiteSpace = True
>
>
> 'Create the root node for the document
> Set aRootNode = aXMLDoca.createElement("function")
> aXMLDoca.appendChild aRootNode
>
>
> 'Iterate the Request Object for all form data
> For Each item in Request.Form
>
> 'Do not include the variable if it contains btn
> If instr(1,item,"btn") = 0 Then
> Set aFormVar =aXMLDoca.createElement(item)
> aFormVar.Text = Request.Form(item)
> aRootNode.appendChild aFormVar
> End If
>
> Next
>
>
> 'Append the processing instruction
>
> Set aPI =
aXMLDoca.createProcessingInstruction("xml","version='1.0'")
> aXMLDoca.insertBefore aPI, aXMLDoca.childNodes(0)
>
>
> 'Save the XML document.
> aXMLDoca.save strPath & "\" & strFileName
>
>
> 'Release all references.
> Set aXMLDoca = Nothing
> Set aRootNode = Nothing
> Set aFormVar= Nothing
> Set item = Nothing
> Set aPI = Nothing
> End Function
>
> dim strFullFile
>
> Function DoesFileExist(ByVal strFullFile)
> Dim objFSO
>
> 'If InStr(strFullFile, ":") = 0 Then
> 'strFileNam = Server.MapPath(strFullFile)
> 'End If
>
> Set objFSO =
Server.CreateObject("Scripting.FileSystemObject")
> DoesFileExist = objFSO.FileExists(strFullFile)
> Set objFSO = Nothing
> End Function
>
>
> Const cont_Num=10000
> Randomize
> Dim intNumber
> dim strFile
> Dim blnYes
>
> blnYes=False
>
> Do Until blnYes=True
>
> intNumber=Int((Cont_Num * Rnd)+1)
>
> 'Create a random file name so you don't write over the
same file
> strFile="Recipe"& intNumber &".xml"
>
> strFullFile="c:\inetpub\wwwroot\xmltest\" & strFile
>
> if DoesFileExist(strFullFile)=False then
> blnYes=True
> End If
> Loop
>
> ' The page starts here
> On Error Resume Next
>
> ' Save the XML Data
> SaveXMLData "c:\inetpub\wwwroot\xmltest",strFile
>
Maybe you are looking for
-
Error While calling remote object
[RPC Fault faultString="Send failed" faultCode="Client.Error.MessageSend" faultDetail="Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Failed: url: 'http://localhost:8080/Remote/messagebroker/amf'"] This is the error I am getting when I
-
Getting errors when iam using BAPI_PO_CREATE1 for Purchase Order creation
Hi sap Gurus, I am getting Errors when iam using BAPI_PO_CREATE1 for Purchase Order creation that Material (144) does not exist but it is alreardy maintained in MM01. I dont get how it is coming.and what are the mandatory fields in bapi BAPI_PO_CR
-
SEVERAL USER BELONG TO THE TABLESPACE I WANT TO EXPORT I WANT TO ONLY WEED OUT THE TABLESSPACE AND THE TABLES BELONGING TO ONE USER. THE USER ALSO WANT SOME OF THE TABLES WITH ALL THE DATA IN THEM AND SOME OF THE TABLES WITH NO DATA IN THEM I TRIED A
-
/underadmin not starting and uwl iviews are failing
Dear All, We have unix based Portal installation, suddenly /underadmin is not working... though i am able to perform admin activities from User admin roles.... Uwl is also failing... i am unable to see Uwl system admin pages.. it gives me iview error
-
How to remove adobe flash player from Mac
How do you remove Adobe Flash player from an iMac desktop running the latest Yosemite 10.10.3?